Create and play SMIL files with transcoded streams in Wowza Streaming Engine

The Wowza Streaming Engine™ media server software Transcoder enables live adaptive bitrate delivery over HTTP. It can ingest a single high-bitrate live stream and create multiple lower-bitrate renditions, which are keyframe-aligned, on the fly. Then you use Synchronized Multimedia Integration Language (SMIL) files to group the high-bitrate stream and the new renditions together in logical groups for delivery.

This article explains how to use a SMIL file with transcoded or transrated streams created by Transcoder.

About Stream Name Groups and SMIL files


The Transcoder templating system groups streams together in logical Stream Name Groups for delivery of live adaptive bitrate streams. Stream Name Groups and SMIL files serve the same purpose, and either method can be used for adaptive bitrate playback of live streams in most configurations. However, in some configurations, such as edge servers in a live stream repeater (origin/edge) configuration, Stream Name Groups can't be used. In a live stream repeater configuration, a Stream Name Group is automatically created by Transcoder on the origin server, but the Stream Name Group can't be propagated to the edge servers so a SMIL file must be used instead for adaptive bitrate delivery, as described in this article.
 
Notes:
  • For adaptive bitrate playback from a single instance of Wowza Streaming Engine or the origin server in a live stream repeater configuration, we recommend using Stream Name Groups because they are automatically created by Transcoder. For more information, see View adaptive bitrate Stream Name Groups.
     
  • For adaptive bitrate playback from an edge server in a live stream repeater configuration, you must use a SMIL file, as described in this article. For more information, see Configure a live stream repeater in Wowza Streaming Engine.

Create an application to transcode the stream


First, you must create a live application to receive and transcode the stream. If you're using a live stream repeater, do this on the origin server. See Set up and run Transcoder in Wowza Streaming Engine.

Create a SMIL file


Next, create the SMIL file for the live application. The easiest way is to create it in Wowza Streaming Engine Manager, but alternatively you can create a SMIL file manually in a text file, or you can generate one by using an HTTP provider and the Wowza Streaming Engine Java API.

Here's how to create a SMIL file in Wowza Streaming Engine Manager or manually in a text editor. For instructions on using an HTTP provider, which is recommended only for advanced users, see Generate a SMIL file with an HTTP provider using the Wowza Streaming Engine Java API.

Create a SMIL file in Wowza Streaming Engine Manager

The easiest way to create a SMIL file is using the SMIL Files feature in Wowza Streaming Engine Manager.
 
Notes:
  • You can also start the procedure to create a SMIL file in the Server contents panel.
     
  • If your stream name is myStream and you're using the sample template transrate.xml, the two new streams that are created by Transcoder are named myStream_360p and myStream_160p.
  1. Select your live application in the Applications contents panel, click SMIL Files, and then click Add SMIL File.


     
  2. In the Add SMIL File dialog box, enter a name for the SMIL file, for example, myStream, and then click Add.

Wowza Streaming Engine adds the SMIL file and appends the .smil file extension to the file name.

  1. On the myStream.smil page, click Add SMIL Stream.


     
  2. In the Add SMIL Stream dialog box, select the video stream type, and then click Add.
  3. On the new SMIL stream page, enter stream information using the names and values defined in transrate.xml. For example, enter the following for myStream_360p:


     
    • Source (src) – Enter myStream_360p. This must be the name of the encoded stream.
       
    • System Language – Enter eng (English per ISO 369.2). This is the encoded system language.
       
    • Video Bitrate – Enter 850000. This is the total encoded bitrate value for the video, in bits-per-second. To get this value, you must multiply the encoded bitrate value in kilobits per second by 1000. For this stream: 850kbps * 1000 = 850000bps.
       
    • Video Width and Video Height – Enter 640 and 360 into the respective fields. This is the encoded size of the video, in pixels.
       
    • Audio Bitrate – Enter the encoded bitrate for the audio that's included with the video.
  4. Click Add.
  5. Repeat steps 3 - 6 for the remaining video streams. Use the following table for information about bitrates and size of the streams.
     
    Source (src) Video Bitrate Video Width Video Height
    myStream_160p 200000 284 160
     
    Note: The transrate.xml template has two more <Encode> blocks, one defined for a 720p rendition and the other for a 240p rendition. By default, the <Enable> flag is set to false so that these two streams won't be generated. Change the <Enable> flag to true to enable these additional streams. Use the following details to add these streams to a SMIL file:
     
    Source (src) Video Bitrate Video Width Video Height
    myStream_240p 350000 320 240
    myStream_720p 700000 1272 720
  6. Configure a live application to deliver the SMIL file and media content to client players. You can use the preconfigured live application to stream adaptive bitrate content. For information about how the live application is configured and about how to create a live application for your purposes, see Set up live streaming using an RTMP-based encoder in Wowza Streaming Engine.

Create a SMIL file using a text editor

  1. Using a text editor, create file with a .smil file extension (for example, myStream.smil) and save it the [install-dir]/content folder. Make sure that your editor doesn't append a .txt file extension to the file name.
     
  2. Enter stream information using the names and values defined in your Transcoder template, such as transrate.xml. The following is a simple example:

    <smil>
    <head></head>
    <body>
        <switch>
            <video src="mp4:myStream_source" system-bitrate="2270208" width="1280" height="720">
                <param name="audioBitrate" value="196608" valuetype="data"/>
                <param name="videoBitrate" value="2073600" valuetype="data"/>
                <param name="videoCodecId" value="avc1.4d401f" valuetype="data"/>
                <param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
            </video>
            <video src="mp4:myStream_360p" system-bitrate="1046608" width="640" height="360">
                <param name="audioBitrate" value="196608" valuetype="data"/>
                <param name="videoBitrate" value="850000" valuetype="data"/>
                <param name="videoCodecId" value="avc1.4d401f" valuetype="data"/>
                <param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
            </video>
            <video src="mp4:myStream_160p" system-bitrate="396608" width="284" height="160">
                <param name="audioBitrate" value="196608" valuetype="data"/>
                <param name="videoBitrate" value="200000" valuetype="data"/>
                <param name="videoCodecId" value="avc1.428015" valuetype="data"/>
                <param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
            </video>
        </switch>
    </body>
    </smil>

    There's a <video> entry in the <switch> container for each stream rendition. The audioBitrate defines the total bitrate for that stream's audio, the videoBitrate defines the total bitrate for that stream's video, and the system-bitrate defines the total bitrate for that stream. All bitrate values are bits per second. The audioCodecId and videoCodecId entries are optional.

Note: The transrate.xml template has two more <Encode> blocks, one defined for a 720p rendition and the other for a 240p rendition. By default, the <Enable> flag is set to false so that these two streams won't be generated and won't be available to players. Change the <Enable> flag to true to enable these additional streams.

Configure edge servers


If you're streaming using a repeater configuration, after creating the SMIL file, you must copy it to all edge servers in your live stream repeater network.
 
  1. If you haven't done so already, configure the edge servers in your live repeater configuration. For more information about configuring live stream repeater applications, see the Wowza edge section in Configure a live stream repeater in Wowza Streaming Engine.
     
  2. Create the liveedge application.
    1. In the Applications contents panel, click Add Application, and then click the Live Edge application type.
       
    2. In the New Application dialog box, name the new application liveedge, and then click Add.
       
    3. The liveedge page is displayed. Configure the Playback Types and enter a Primary Origin URL.
  3. Copy the SMIL file created above to the edge server's [install-dir]/content folder.
     
  4. Repeat for each edge server.

Test playback


The following examples demonstrate how players use the SMIL file to play the multiple bitrate renditions. You can test playback using the test players built in to Wowza Streaming Engine, as described below, or you can use the Wowza Test Players.
 
Notes:
  • Adaptive bitrate playback is only supported for HTTP-based streams.
     
  • The Wowza Streaming Engine Manager examples are for edge servers only. For playback from an origin server, use NGRP and the examples in View adaptive bitrate Stream Name Groups.

Adobe Flash Player (Adobe HDS/San Jose)

In Wowza Streaming Engine Manager, click Test Players in the upper-right corner of the liveedge application page. The Test Players window that opens includes test players that are preconfigured to stream the live stream named myStream over various streaming formats. To use the Adobe HDS protocol to play myStream, click the Adobe HDS tab, enter the following URL information, and then click Start.

http://[wowza-edge-address]:1935/liveedge/smil:myStream.smil/manifest.f4m

Apple iOS device (Apple HLS/Cupertino)

In Wowza Streaming Engine Manager, click Test Players in the upper-right corner of the liveedge application page. The Test Players window that opens includes test players that are preconfigured to stream the live stream named myStream over various streaming formats. To use the Apple HLS protocol to play myStream, click the Apple HLS tab, and then enter the following URL that appears on the tab into the Safari web browser on the device.

http://[wowza-edge-address]:1935/liveedge/smil:myStream.smil/playlist.m3u8

Microsoft Silverlight (Smooth Streaming)

In Wowza Streaming Engine Manager, click Test Players in the upper-right corner of the liveedge application page. The Test Players window that opens includes test players that are preconfigured to stream the live stream named myStream over various streaming formats. To use the Microsoft Smooth Streaming protocol to play myStream, click the MS Smooth tab, enter the following URL information, and then click Start.

http://[wowza-edge-address]:1935/liveedge/smil:myStream.smil/Manifest

MPEG-DASH

In Wowza Streaming Engine Manager, click Test Players in the upper-right corner of the liveedge application page. The Test Players window that opens includes test players that are preconfigured to stream the live stream named myStream over various streaming formats. To use the MPEG DASH protocol to play myStream, click the MPEG DASH tab, enter the following URL information, and then click Start.

http://[wowza-edge-address]:1935/liveedge/smil:myStream.smil/manifest.mpd

Other considerations


  • Dynamic streaming for Adobe Flash requires a fair amount of work on the client side. The following Adobe articles provide details about how to achieve dynamic streaming in Flash:
  • Dynamic streaming in Flash (Part 1)
  • Dynamic streaming in Flash (Part 2)
  • Dynamic streaming in Flash (Part 3)
  • When streaming using Adobe HDS, it's best to turn on dynamic stream markers, which provide more accurate on-the-fly bitrate calculations (in most cases). To turn on dynamic stream markers, add the enableDynamicStreamMarkers property:
    • Wowza Streaming Engine Manager - In Wowza Streaming Engine Manager, add a custom property to the application with the following information. For details on how to configure custom properties, see Configure properties.
       
      Path
      Name
      Type
      Value
      /Root/Application/Streams enableDynamicStreamMarkers Boolean true
    • Text editor - Open [install-dir]/conf/[application]/Application.xml in a text editor and add the following property to the <Streams>/<Properties> container (be sure to get the correct <Properties> container - there are several in the Application.xml file):
      <Property>
          <Name>enableDynamicStreamMarkers</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
  • JW Player and Flowplayer use a client-side XML file to reference each stream rendition, not the server-side SMIL file that's shown in this article. They both also use the BWCheck module. For more information, see JW Player Dynamic RTMP Streaming and Flowplayer Dynamic Streaming.
  • Microsoft Smooth Streaming only switches between the video portion of the file. The audio track in the first stream listed in the <switch> container is used. If you want to use the audio track from a different stream than the one specified in the first <video> entry in the <switch> container, add an <audio> entry to the <switch> container for that item. For example:

    <smil>
    <head></head>
    <body>
        <switch>
            <video src="mp4:myStream_source" system-bitrate="2270208" width="1280" height="720">
                <param name="audioBitrate" value="196608" valuetype="data"/>
                <param name="videoBitrate" value="2073600" valuetype="data"/>
            </video>
            <video src="mp4:myStream_360p" system-bitrate="1046608" width="640" height="360">
                <param name="audioBitrate" value="196608" valuetype="data"/>
                <param name="videoBitrate" value="850000" valuetype="data"/>
            </video>
            <video src="mp4:myStream_160p" system-bitrate="396608" width="284" height="160">
                <param name="audioBitrate" value="196608" valuetype="data"/>
                <param name="videoBitrate" value="200000" valuetype="data"/>
            </video>
            <audio src="myStream_160p" system-bitrate="196608"/>
        </switch>
    </body>
    </smil>
    Note: The <audio> item is ignored when streaming using Adobe HDS (San Jose), Apple HLS (Cupertino), or MPEG-DASH streaming.
  • By default Microsoft Smooth Streaming calculates video and audio bitrates for the manifest data on-the-fly by inspecting the stream. If you want to configure your Wowza media server to use the bitrates in the SMIL file, add the smoothStreamingUseSMILBitrates property:
     
    • Wowza Streaming Engine Manager - In Wowza Streaming Engine Manager, add a custom property to the application with the following information. For details on how to configure custom properties, see Configure properties.
       
      Path
      Name
      Type
      Value
      /Root/Application/HTTPStreamer smoothStreamingUseSMILBitrates Boolean true
    • Text editor - Open [install-dir]/conf/[application]/Application.xml in a text editor and add the following property to the <HTTPStreamer>/<Properties> container (be sure to get the correct <Properties> container - there are several in the Application.xml file):
      <Property>
          <Name>smoothStreamingUseSMILBitrates</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
  • When streaming out using RTSP/RTP, you can force the output to MPEG-TS, which is required by many set-top boxes. For more information, see Generate and control MPEG-TS output for set-top boxes in Wowza Streaming Engine.
  • Wowza Streaming Engine can output AAC audio using the mpeg4-generic and mp4a-latm (3gpp) packetization methods. The default packetization method is mpeg4-generic. To switch to mp4a-latm (3gpp), add the audioPacketizerAAC property:
     
    • Wowza Streaming Engine Manager - In Wowza Streaming Engine Manager, add a custom property to the application with the following information. For details on how to configure custom properties, see Configure properties.
       
      Path
      Name
      Type
      Value
      /Root/Application/HTTPStreamer audioPacketizerAAC String com.wowza.wms.rtp.packetizer.RTPPacketizerMPEG4LATM
    • Text editor - Open [install-dir]/conf/[application]/Application.xml in a text editor and add the following property to the <RTP>/<Properties> container (be sure to get the correct <Properties> container - there are several in the Application.xml file):
      <Property>
          <Name>audioPacketizerAAC</Name>
          <Value>com.wowza.wms.rtp.packetizer.RTPPacketizerMPEG4LATM</Value>
      </Property>

More resources