April 29, 2014

Using SMIL for adaptive bitrate VOD via HLS

Since we've released MP4 to HLS VOD transmuxing, we were asked to add multi-bitrate (adaptive bitrate) support for VOD. Media industry has a proven way to implement this kind of interaction which is called Synchronized Multimedia Integration Language, or SMIL.

Now we have SMIL support for MP4 to HLS transmuxing in Nimble Streamer.

Let's see how it's set up and how a user may stream ABR VOD.

Nimble Streamer setup


First, you need to install Nimble Streamer if you haven't done it yet.

Now, with the content being located in some local directory - e.g. /var/www/video/ - you need to define a streaming route for Nimble Streamer so the user could access the content via HLS or progressive download with appropriate player. Read how to setup VOD streaming using WMSPanel.
You should try playing the uploaded files via HLS before going to the next step to avoid any permissions or other related problems on your server.

Creating SMIL file


Now when Nimble is able to stream your single-bitrate files, let's compose sample SMIL file. For this example we assume you have /var/www/video/ directory with bigbuckbunny_450.mp4 and bigbuckbunny_750.mp4 files.

The following SMIL file should be created to enable adaptive bitrate streaming:



<?xml version="1.0" encoding="UTF-8"?>
<smil title="">
<body>
<switch>
<video height="240" src="bigbuckbunny_450.mp4" system-bitrate="450000" systemLanguage="eng" width="424">
</video>
<video height="360" src="bigbuckbunny_750.mp4" system-bitrate="750000" systemLanguage="eng" width="640">
</video>
</switch>
</body>
</smil>
Let's name it bunny.smil.

You may also create SMIL file using the following format.
<?xml version="1.0" encoding="UTF-8"?>
<smil title="">
<body>
<switch>
<video height="240" src="bigbuckbunny_450.mp4" systemLanguage="eng" width="424">
<param name="videoBitrate" value="450000" valuetype="data"></param>
<param name="audioBitrate" value="44100" valuetype="data"></param>
</video>
<video height="360" src="bigbuckbunny_750.mp4" systemLanguage="eng" width="640">
<param name="videoBitrate" value="750000" valuetype="data"></param>
<param name="audioBitrate" value="44100" valuetype="data"></param>
</video>
</switch>
</body>
</smil>
If you'd like to have NAME parameter in #EXT-X-STREAM-INF header of your result playlist, you may use "title" parameter in video tag of SMIL.

Multiple tracks


If you have multiple tracks in MP4 files, and want to produce proper HLS with track IDs, you may add them as new parameters.



Codec attributes


You can also specify the exact codec used for each entry in SMIL. Use the following syntax:
<param name="videoCodec" value="avc1.42e00a" valuetype="data"></param>
<param name="audioCodec" value="mp4a.40.2" valuetype="data"></param>
or alternatively
<param name="codecs" value="avc1.42e00a,mp4a.40.2" valuetype="data"></param>
This will add attribute like 
CODECS="avc1.42e00a,mp4a.40.2"



Now, when the SMIL file is ready, try to perform streaming.

Using SMIL for HLS players and devices


You can access VOD stream via URL like this
http://127.0.0.1:8081/vod/smil:bunny.smil/playlist.m3u8
You may replace local host with your server's public IP address.

With this feature, Nimble is able to handle adaptive bitrates as origin for both video-on-demand and live streaming.

Let us know if you face any issues while deploying this or similar scenario to your streaming infrastructure.

Using SMIL with subtitles


SMIL format allows flexible control of subtitles for VOD streaming. Read this article to find our more about subtitles support in Nimble Streamer.


Also check audio-only and video-only transmuxing via SMIL.

Related documentation


Nimble Streamer, SMIL support for MPEG-DASHMP4 transmuxing to HLS VOD streamingStreaming MP3 via HLS, Subtitles support in Nimble Streamer, VOD Streaming in Nimble

No comments:

Post a Comment