Wejn s.r.o.

Solving complicated IT problems is our hobby.

Setting Up Multi-bitrate Streaming With FMLE and Wowza

Intro

The subject of adaptive (multi-bitrate) streaming through Wowza Media Server is a pretty straightforward one, yet it trips up many people. This post explains how to do it with FMLE.

I assume you’re already familiar with basic live streaming using Flash Media Live Encoder. That is, you can publish single live stream to Wowza and have it play in a flash/html5 player.

Having said all that, let’s set it up.

Part 1: Flash Media Live Encoder

The key to setting up FMLE is two-fold:

First you have to enable multiple bitrates (upto three) in the left pane:

(of course, you can vary the output resolution and bitrate any way you like; I just happen to have only low resolution iSight cam on my 5+ yo MBP)

Then you have to change the stream name to publish each stream under different name using the %i shortcode:

By using the settings depicted in images above, three streams will be published; named output_1, output_2, and output_3.

Part 2: Wowza Media Server

Let’s assume I’m running Wowza Media Server with application live on 10.0.0.9.

To support adaptive streaming of those three streams outlined above under one common name, you’ll have to create an output.smil file under the content directory of your application with following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<smil>
  <head>
  </head>
  <body>
      <switch>
          <video src="output_1" width="320" height="240"
              system-bitrate="512000" />
          <video src="output_2" width="320" height="240"
              system-bitrate="204800" />
          <video src="output_3" width="320" height="240"
              system-bitrate="51200" />
      </switch>
  </body>
</smil>

Please observe that the field values closely match parameters of the streams set up in FMLE (in particular, the system-bitrate reflects video bitrate but should be in 1024 base, therefore 500*1024 = 512000).

Playing the adaptive multi-bitrate stream

Assuming you have setup everything correctly, you can now automagically use the smil:output.smil (or even just smil:output) as a stream name for most of the supported protocols.

url description
http://10.0.0.9:1935/live/smil:output/playlist.m3u8 Apple iOS (HLS)
http://10.0.0.9:1935/live/smil:output/jwplayer.smil JWPlayer6 (playlist)
http://10.0.0.9:1935/live/smil:output/jwplayer.rss JWPlayer5 (old playlist)
http://10.0.0.9:1935/live/smil:output/medialist.smil generic RTMP with SMIL
http://10.0.0.9:1935/live/smil:output/Manifest Silverlight streaming
http://10.0.0.9:1935/live/smil:output/manifest-rtmp.f4m Flash HTTP

If you’re feeling adventurous and want to write your own adaptive bitrate support in your custom player, you can either parse the medialist.smil or create Wowza module that will generate playlist in appropriate format for your player.