Lock multi-bitrate streams on a Wowza Streaming Engine live stream repeater edge

Ensure that each origin stream in an multi-bitrate stream on a Wowza Streaming Engine™ media server software live stream repeater edge server is locked so that the streams are aligned for proper switching.

Note: The technique described in this article doesn't fix misalignment in the source. For information about how to debug stream alignment on the origin server, see Debug encoder multi-bitrate keyframe alignment with Wowza Streaming Engine.

Configuration


  1. Configure an origin application name liveorigin. Change the StreamType property in [wowza-origin-install-dir]/conf/liveorigin/Application.xml to live.
    <StreamType>live</StreamType>
  2. Leave the LiveStreamPacketizers property empty in [wowza-origin-install-dir]/conf/liveorigin/Application.xml. If it's not already empty, remove any packetizers.
    <LiveStreamPacketizers></LiveStreamPacketizers>
  3. Configure an edge application named liveedge. Change the StreamType property in [wowza-edge-install-dir]/conf/liveedge/Application.xml to live.
    <StreamType>live</StreamType>
    Note: Don't use the liverepeater-edge stream type here because we will start the streams using [wowza-edge-install-dir]/conf/StartUpStreams.xml using MediaCaster type liverepeater. This will ensure that the MediaCaster system has a lock on each stream.
  4. Add the regular live stream packetizers to the LiveStreamPacketizers property in [wowza-edge-install-dir]/conf/liveedge/Application.xml. This enables packetizing to happen on the edge instead of the origin.
    <LiveStreamPacketizers>cupertinostreamingpacketizer,smoothstreamingpacketizer,sanjosestreamingpacketizer</LiveStreamPacketizers>
  5. Assume that there are three live streams that are keyframe-aligned versions with different bitrates. We'll use Wowza Transcoder and the default transrate.xml template. The source stream will be named livestream. This requires three .stream files on the edge in the edge content folder ([wowza-edge-install-dir]/content).

    file: [wowza-edge-install-dir]/content/livestream_source.stream
    contents: rtmp://[wowza-origin-address]/liveorigin/livestream_source

    file: [wowza-edge-install-dir]/content/livestream_360p.stream
    contents: rtmp://[wowza-origin-address]/liveorigin/livestream_360p

    file: [wowza-edge-install-dir]/content/livestream_160p.stream
    contents: rtmp://[wowza-origin-address]/liveorigin/livestream_160p
  6. Next we need a .smil file on the edge. It's placed in the [wowza-edge-install-dir]/content folder with the three .stream files. Use the method described in Create and play SMIL files with streams created by Wowza Transcoder to generate a SMIL file. With some minor adjustments (adding .stream to the stream names), this is the SMIL file you can copy to the [wowza-edge-install-dir]/content folder:
    <smil>
    <head></head>
    <body>
    	<switch>
    		<video src="mp4:livestream_source.stream" system-bitrate="567594" width="424" height="240">
    			<param name="audioBitrate" value="107450" valuetype="data"/>
    			<param name="videoBitrate" value="460144" valuetype="data"/>
    			<param name="videoCodecId" value="avc1.66.30" valuetype="data"/>
    			<param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
    		</video>
    		<video src="mp4:livestream_360p.stream" system-bitrate="957450" width="636" height="360">
    			<param name="audioBitrate" value="107450" valuetype="data"/>
    			<param name="videoBitrate" value="850000" valuetype="data"/>
    			<param name="videoCodecId" value="avc1.77.30" valuetype="data"/>
    			<param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
    		</video>
    		<video src="mp4:livestream_160p.stream" system-bitrate="307450" width="282" height="160">
    			<param name="audioBitrate" value="107450" valuetype="data"/>
    			<param name="videoBitrate" value="200000" valuetype="data"/>
    			<param name="videoCodecId" value="avc1.66.12" valuetype="data"/>
    			<param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
    		</video>
    	</switch>
    </body>
    </smil>
  7. Next, start each of the streams using the [wowza-edge-install-dir]/conf/StartUpStreams.xml so that they start when the edge server starts.
    <Root>
    	<StartupStreams>
    
    		<StartupStream>
    			<Application>liveedge/_definst_</Application>
    			<MediaCasterType>liverepeater</MediaCasterType>
    			<StreamName>livestream_source.stream</StreamName>
    		</StartupStream>
    
    		<StartupStream>
    			<Application>liveedge/_definst_</Application>
    			<MediaCasterType>liverepeater</MediaCasterType>
    			<StreamName>livestream_360p.stream</StreamName>
    		</StartupStream>
    
    		<StartupStream>
    			<Application>liveedge/_definst_</Application>
    			<MediaCasterType>liverepeater</MediaCasterType>
    			<StreamName>livestream_160p.stream</StreamName>
    		</StartupStream>
    
    	</StartupStreams>
    </Root>
  8. Start the origin, and then publish a stream named livestream to the liveorigin application, or a stream with Stream Manager. If the liveorigin application is configured with Wowza Transcoder using the default transrate.xml template, the filenames will match the above steps. If you're starting a stream with Stream Manager, you must use the StreamNameAlias AddOn to use the name livestream, or you can use a .stream file (livestream.stream) on the origin and then adjust the stream names in the above examples.
     
    Note: The live stream must contain H.264 video and AAC or MP3 audio.
  9. Start the edge. The [wowza-edge-install-dir]/conf/StartUpStreams.xml will run, loading and locking the three origin streams, which are now ready to play with cupertinostreaming to Apple iOS devices, smoothstreaming to Silverlight, and sanjosestreaming to Flash HTTP (OSMF) clients.

Playback


To play using Adobe Flash Player (San Jose/Adobe HTTP Dynamic Streaming) on Wowza Media Server 3.5.0 and later, double-click [install-dir]/examples/LiveVideoStreaming/FlashHTTPPlayer/player.html, enter the information below, and then click the Connect button.

Stream: http://[wowza-edge-address]:1935/liveedge/smil:livestream.smil/manifest.f4m
Notes:
  • The stream can only be played from an OSMF-based Flash player that's embedded in a webpage.
  • To play the stream from a remote computer, copy the contents of the FlashHTTPPlayer or clientOSMF/bin-release folders to a web server.

To play using an Apple iOS device (Cupertino/Apple HTTP Live Streaming), enter the following URL into Safari on the device:

http://[wowza-edge-address]:1935/liveedge/smil:livestream.smil/playlist.m3u8
Notes:
  • The Apple iPhone 3GS (and older) and iPod touch devices require that video be encoded using H.264 format (Baseline profile level 3 or lower) and AAC or MP3 stereo audio.
  • This stream can also be played using the Safari web browser or QuickTime 10.x on a computer running OS X Snow Leopard version 10.6 or later.
To play using Microsoft Silverlight (Smooth Streaming) on Wowza Media Server 3.5.0 and later, double-click [install-dir]/examples/LiveVideoStreaming/SilverlightPlayer/player.html, enter the information below, and then click the Connect button.
 
http://[wowza-edge-address]:1935/liveedge/smil:livestream.smil/Manifest
Notes:
  • The Microsoft Silverlight player requires that both audio and video be present for playback. For live streaming only, the keyframe frequency (which can be set directly in some encoders or is gop/fps) must be between 1 and 4 seconds (2 seconds is recommended). Anything greater than 4 seconds may cause playback to freeze.
  • To play the stream from a remote computer, copy the contents of the Silverlightplayer or clientSilverlight folders to a web server.