Wowza Community

Dynamic stream switching

I have problem with stream switching with on demand (f4v file) content. The switch from stream A to B is extremely slow taking approx. 12-20sec. Most likely a keyframe is expected by the client from Wowza to start playing back. I am using Wowza version 2.2.3.

We were following Adobe documentation when implementing dynamic stream switching:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStreamPlayTransitions.html#SWITCH

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStreamPlayOptions.html

Our code is something like this:

var streamOptions:NetStreamPlayOptions = new NetStreamPlayOptions();

streamOptions.streamName = “HQStream”;

streamOptions.oldStreamName = “LQStream”;

streamOptions.start = lqStream.start; // LQ Stream start position

streamOptions.len = lqStream.len; // LQ Stream length

streamOptions.transition = NetStreamPlayOptions.SWITCH;

I also added this property to application.xml, but no effect:

enableDynamicStreamMarkers

true

Boolean

Could you please advise on the above? What is wrong with this? Is keyframe alignment is required for fast stream switching?

JW player has Flash Dynamic Streaming features that work well with Wowza. See if your files work using this:

http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/16012/setting-up-rtmp-dynamic-streaming

Also try Flash HTTP (Sanjose) with OSMF player using server-side smil following the multi-bitrate section of vod tutorial:

https://www.wowza.com/docs/how-to-set-up-video-on-demand-streaming

The enableDynamicStreamMarkers property is not required with that version of Wowza, but can’t hurt.

For encoding files that will be keyframe aligned, try MS Expression 4 encoder:

https://www.wowza.com/docs/how-to-encode-video-on-demand-content

Richard

In our tests, ffmpeg does not produce keyframe aligned sets. Expression 4 does work in our tests, it is inexpensive and we recommend it highly for this purpose.

The only way I know to test alignment is to play the vod streams as live streams with the Stream class scheduler, then use this method to debug keyframe alignment:

https://www.wowza.com/docs/how-to-debug-encoder-multi-bitrate-keyframe-alignment

This is the Stream class scheduler that you can use to setup live streams with file sources:

https://www.wowza.com/docs/how-to-schedule-streaming-with-wowza-streaming-engine-streampublisher

Wowza does require keyframe alignment when switching at present. A future version of Wowza may force switching regardless of alignment.

Richard

Expression 4 live streaming capabilities are not supported by Wowza, which does not accept pre-segmented Smooth streams. We recommend Expression 4 for encoding static files for multi-bitrate vod streaming.

https://www.wowza.com/docs/how-to-encode-video-on-demand-content

Richard

Unfortunately, it does not help. We know JW player example that is an OSMF based implementation as well. Adobe docs say this:

“Flash Media Server handles the actual switching of the streams for the user based on the client-originated request to do so. Once the server receives the request to switch the user’s stream to a different stream (bandwidth), it will wait a short period for the optimal point to switch with minimal playback impact to the user. This occurs on the nearest keyframe for video-only content, the nearest audio sample for audio-only streams, and the combination of the two for video content with audio. This means that video encoded with a keyframe every six seconds could take up to six seconds, once the command to switch streams has been received by the server, to actually switch the content and send the transition-complete notification.”

My questions are:

  1. What could be technically causing the very long stream switching time?

  2. How can I debug that?

  3. We use ffmpeg for conversion. Expression is not playing here. Could you please provide best practices examples with ffmpeg?

See this example for the speed of stream switch: http://client.shellshaper.com/v/Player_Video.html

In our tests, ffmpeg does not produce keyframe aligned sets. Expression 4 does work in our tests, it is inexpensive and we recommend it highly for this purpose.

I do have expressions encoder, but how can I get expressions encoder to publish to Wowza? I thought they were incompatible?