• How to do scheduled, adaptive bitrate streaming using Stream class streams

    How to setup scheduled multi-bitrate stream

    For the example you can download these 3 versions of bigbuckbunny and put them in the Wowza content folder:
    http://www.wowzamedia.com/_h264/bigbuckbunny_450.mp4
    http://www.wowzamedia.com/_h264/bigbuckbunny_750.mp4
    http://www.wowzamedia.com/_h264/bigbuckbunny_1100.mp4

    Each item must be key frame aligned for switching to work (at present). For encoding suggestions to achieve this, see this article.

    Make sure the Stream Class Scheduler is setup
    1. Get the Module Collection jar,
    2. Add the ServerListener to /conf/Server.xml, then restart Wowza.
      Code:
      <ServerListener>
      	<BaseClass>com.wowza.wms.plugin.collection.serverlistener.ServerListenerStreamPublisher</BaseClass>
      </ServerListener>
    3. Create the streamschedule.smil file in the /content folder:

      Code:
      <smil>
          <head>
          </head>
          <body>
           	 <stream name="Stream1"></stream>
           	 <stream name="Stream2"></stream>
      	 <stream name="Stream3"></stream>
      
              <playlist name="pl1" playOnStream="Stream1" repeat="true" scheduled="2009-12-11 16:26:00">
                  <video src="mp4:bigbuckbunny_450.mp4" start="0" length="-1"/>
              </playlist>
      	<playlist name="pl2" playOnStream="Stream2" repeat="true" scheduled="2009-12-11 16:26:00">
                  <video src="mp4:bigbuckbunny_750.mp4" start="0" length="-1"/>
              </playlist>    
              <playlist name="pl3" playOnStream="Stream3" repeat="true" scheduled="2009-12-11 16:26:00">
                  <video src="mp4:bigbuckbunny_1100.mp4" start="0" length="-1"/>
              </playlist>
      
          </body>
      </smil>
    4. Then create the switching smil file also in the content folder, name it "switch.smil"

      Code:
      <smil>
      	<head>
      	</head>
      	<body>
      		<switch>
      			<video src="Stream1" system-bitrate="450000"/>
      			<video src="Stream2" system-bitrate="750000"/>
      			<video src="Stream3" system-bitrate="1100000"/>
      		</switch>
      	</body>
      </smil>
    5. Restart Wowza to load the Scheduler.


    Playback in iOS:
    Code:
    http://[wowza-address]:1935/live/smil:switch.smil/playlist.m3u8
    Playback in Silverlight player:
    Code:
    http://[wowza-address]:1935/live/smil:switch.smil/Manifest
    Playback Flash HTTP (Sanjose) stream:
    Code:
    http://[wowza-address]:1935/live/smil:switch.smil/manifest.f4m
    Richard
    Comments 31 Comments
    1. pskarthikps -
      What will be the smil file contents in case of live stream? assuming FMLE is pushing using
      [CODE]rtmp://[wowza ip]/live/livestream%i[CODE]

      Thanks
    1. rrlanham -
      If you have multiple streams setup in FMLE with a stream named "livestream%i", FMLE will publish streams named "livestream1", "livestream2", etc for however many streams you have defined. You will see publish events in the logs for each one, and you can play each one using Wowza LiveVideoStreaming example player:

      Server: rtmp://[wowza-address]:1935/live
      Stream: livestream1

      If you are using the scheduler, you have to enter "-2" as the start value when the source is a published live stream.

      To do multi-bitrate streaming with FMLE setup in this way, you don't need the scheduler involved in this example, you can just follow the mulit-bitrate section of the live tutorial:
      http://www.wowzamedia.com/forums/con...-based-encoder)

      Richard
    1. hdnetmidia -
      May I use the same file name for all 3 versions, posted inside different folders, instead of naming them differently?;

      <smil>
      <head>
      </head>
      <body>
      <stream name="Stream1"></stream>
      <stream name="Stream2"></stream>
      <stream name="Stream3"></stream>

      <playlist name="pl1" playOnStream="Stream1" repeat="true" scheduled="2009-12-11 16:26:00">
      <video src="mp4:sd\bigbuckbunny.mp4" start="0" length="-1"/>
      </playlist>
      <playlist name="pl2" playOnStream="Stream2" repeat="true" scheduled="2009-12-11 16:26:00">
      <video src="mp4:md\bigbuckbunny.mp4" start="0" length="-1"/>
      </playlist>
      <playlist name="pl3" playOnStream="Stream3" repeat="true" scheduled="2009-12-11 16:26:00">
      <video src="mp4:hd\bigbuckbunny.mp4" start="0" length="-1"/>
      </playlist>

      </body>
      </smil>

      Thanks

      Ricardo
    1. rrlanham -
      What are you trying to do?

      This one schedule.smil file could be used to define and schedule many sets of streams to be used in any number of multi-bitrate smil files. The scheduler is limited to one application, but as many streams as you want to schedule.

      Richard
    1. hdnetmidia -
      In this case I was just trying to separate the videos, instead of putting them all together with different names like xpto_400.mp4, xpto_700.mp4 ..., post them with the same name but in different folders.
      For example the file xpto. mp4 generated at 400kbps inside sd's folder, the file xpto.mp4 generated at 700kbps inside hd's folder....

      But either way I try, or that way explained in your tutorial or suggesting by me, I am not succeeding.
      Actually what I wanted to use that kind of live transmition "like a tv station" explained in http://www.wowza.com/forums/content....t-in-smil-file but using adaptive bitrates, is it possible?

      Ricardo
    1. rrlanham -
      It will work if the sd, md and hd folders are sub-folders of the application's content folder (StorageDir), by default the /content folder where Wowza is installed.

      Richard
    1. aynajus -
      thank
      nui
    1. rrlanham -
      This is a duplicate, answered previously
    1. aynajus -
      if I stream 3 bitrate from FM.
      stream%i and create s.smil.
      call : http://&#91;wowza-address]:1935/live/smi.../playlist.m3u8


      What are the conditions that make changing the bitrate.
    1. rrlanham -
      Some clients only measure bandwidth, for example iOS devices. Other clients also take screen size into account. I think Silverlight does. I know that JW Player implementation of Dynamic Streaming does that. One easy way to see if switching is working is set framesize larger than the player and toggle fullscreen mode using JW Player Dynamic Streaming. If it is working you will see the switch if you have the qualitymonitor plugin enabled.

      The Wowza Silverlight example, and one of the Expression 4 templates will show switching in the UI.

      Richard
    1. ckarpovich -
      Is it possible to use the transcoder add-on (and a single high quality file) with the stream scheduler instead of encoding the multiple quality mp4's ahead of time? Craig--
    1. rrlanham -
      Yes, it should work

      Richard
    1. Alex Silva -
      we have to always use streamschedule.smil and switch.smil or we can create diferent files names and multilpe files names. Thanks!
    1. rrlanham -
      "schedule.smil" is built-in to the Scheduler example. If you want to use a different name you will have to re-compile the example. "switch.smil" is arbitrary, you can make it whatever you want and have as many as you want.

      Richard
    1. Alex Silva -
      Thanks!
    1. amykaroline -
      Hello, I followed this example to set up a live stream of videos with adaptive bitrates and the stream switching is not working. I have checked and double checked the streamschedule.smil file I created and the switch.smil file I created and both look good.
      When I try to play the streams separately in the Live Video Streaming example player, only one of the streams actually plays - the 1200 bitrate one. When I try to play the switch in the Live Smooth Streaming example player, I receive the following error message: "Streaming error: Failed to download manifest: d"

      Any help is much appreciated! Thanks

      Update: checking the access logs I am getting the message for the streams that are not working that smoothstreamingpacketizer cannot be found. I have checked the live/Application.xml file and smoothstreamingpacketizer is in the list of livestreampacketizers.
    1. amykaroline -
      Quote Originally Posted by rrlanham View Post
      Yes, it should work

      Richard
      Hi richard, I was told that this was not possible - can you explain?
    1. rrlanham -
      Key frame alignment is required. So each of the files that is the source of this multi-bitrate live stream has to be key frame aligned. You can check this for a live stream by adding this debug property and looking at the output in the access log
      http://www.wowza.com/forums/content....rame-alignment

      To be clear, you will be looking at the alignment of the "live" streams that the scheduler outputs.

      The best way I know to create key frame aligned files is with Expression 4 Encoder. Take a look at this guide which includes Expression 4 Encoder presets
      http://www.wowza.com/forums/content....demand-content

      Richard
    1. amykaroline -
      Quote Originally Posted by rrlanham View Post
      Key frame alignment is required. So each of the files that is the source of this multi-bitrate live stream has to be key frame aligned. You can check this for a live stream by adding this debug property and looking at the output in the access log
      http://www.wowza.com/forums/content....rame-alignment

      To be clear, you will be looking at the alignment of the "live" streams that the scheduler outputs.

      The best way I know to create key frame aligned files is with Expression 4 Encoder. Take a look at this guide which includes Expression 4 Encoder presets
      http://www.wowza.com/forums/content....demand-content

      Richard
      Aha! Okay, I just read another long back and forth between you and someone named bobmane who was very angry about the whole encoding situation. I tried downloading the free version of Microsoft Encoder, but it looks like this will require the paid version, which is totally okay by me. Thanks for pointing out to me that the Handbrake-encoding I did was not enough! Good thing I only encoded two videos so far... lol
    1. rrlanham -
      Cool, thanks for the update. Good luck. Expression 4 Encoder is nice and not expensive.

      Richard