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

Ensure that each origin stream in a 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.

Configure the streams


  1. Configure an origin application named 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'll 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 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,mpegdashstreamingpacketizer</LiveStreamPacketizers>
  5. Assume that there are three live streams that are keyframe-aligned versions with different bitrates. We'll use 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. Follow the instructions in Create and play SMIL files with transcoded streams in Wowza Streaming Engine 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. If the liveorigin application is configured with Transcoder using the default transrate.xml template, the filenames will match the above steps. 
     
    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.

Test playback


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.

See About playing Wowza Streaming Engine streams for information about playing streams over other protocols.