October 13, 2016

Audio-only and video-only transmuxing for HLS and MPEG-DASH via SMIL files

Nimble Streamer handles VOD streaming in various ways, one of them is doing ABR VOD via HLS and MPEG-DASH streaming protocols using SMIL files.

You can use SMIL to specify separate tracks in MP4 files which will be used transmuxed specifically with only audio or video for both HLS and DASH. This allows lowering the bandwidth usage.

To illustrate this approach, let's take a look at audio-only use case. We have "bigbuckbunny_450.mp4" file with audio we want to use and video track. There are bunch of other files with different video renditions, without the audio.

Check the sample SMIL file below.



<?xml version="1.0" encoding="UTF-8"?>
<smil title="">
 <body>
  <switch>
   <audioOnly src="bigbuckbunny_450.mp4" systemLanguage="eng" groupId="aac" default="true" autoSelect="true"/>
   <video src="bigbuckbunny_450.mp4" systemLanguage="eng" system-bitrate="450000" hlsAudioGroupId="aac"/>
   <video src="bigbuckbunny_750.mp4" systemLanguage="eng" system-bitrate="750000" hlsAudioGroupId="aac"/>
   <video src="bigbuckbunny_1100.mp4" systemLanguage="eng" system-bitrate="1100000" hlsAudioGroupId="aac"/>
   <video src="bigbuckbunny_1500.mp4" systemLanguage="eng" system-bitrate="1500000" hlsAudioGroupId="aac"/>
  </switch>
 </body>
</smil>

Get it on github. You can find other SMILs examples at this github repo.

Notice the groupId="aac" parameter in audioOnly tag, along with hlsAudioGroupId="aac" parameter in each video tag. This virtual group combines them together to use same audio track.

The result playlist would be as follows:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",DEFAULT="YES",AUTOSELECT="YES",URI="bigbuckbunny__450.mp4_audiochunk.m3u8?nimblesessionid=96"
#EXT-X-STREAM-INF:BANDWIDTH=450000,AUDIO="aac",LANGUAGE="eng"
bigbuckbunny__450.mp4_videochunk.m3u8?nimblesessionid=96
#EXT-X-STREAM-INF:BANDWIDTH=750000,AUDIO="aac",LANGUAGE="eng"
bigbuckbunny__750.mp4_videochunk.m3u8?nimblesessionid=96
#EXT-X-STREAM-INF:BANDWIDTH=1100000,AUDIO="aac",LANGUAGE="eng"
bigbuckbunny__1100.mp4_videochunk.m3u8?nimblesessionid=96
#EXT-X-STREAM-INF:BANDWIDTH=1500000,AUDIO="aac",LANGUAGE="eng"
bigbuckbunny__1500.mp4_videochunk.m3u8?nimblesessionid=96

When the player gets the playlist it still shows multiple renditions and during playback it gives the audio track transmuxed from bigbuckbunny_450.mp4 file, while the video is taken from selected video file.

Multiple audio tracks from same file


You can add multiple audio tracks if you need, this is especially useful for multi-language videos. If you have single MP4 file with multiple audio tracks, you may use those tracks in your SMIL and resulting playlist via audioIndex parameter. You can use title parameter to set the name for the track - this is what will be shows in the player selection.
Here's a sample SMIL.
<?xml version="1.0" encoding="UTF-8"?>
<smil title="">
 <body>
  <switch>
   <audioOnly src="video.mp4" systemLanguage="eng" title="English" groupId="aac" audioIndex="0" default="true" autoSelect="true"/>
   <audioOnly src="video.mp4" systemLanguage="fra" title="French"  groupId="aac" audioIndex="1"/>
   <audioOnly src="video.mp4" systemLanguage="spa" title="Spanish" groupId="aac" audioIndex="2"/>
   <video src="video.mp4" systemLanguage="eng" system-bitrate="450000" hlsAudioGroupId="aac"/>
  </switch>
 </body>
</smil>
Notice the systemLanguage parameter - it's different for each language.

The result playlist will be as follows:
#EXTM3U 
#EXT-X-VERSION:3 
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="English",DEFAULT="YES",AUTOSELECT="YES",URI="video.mp4_audiochunk.m3u8?nimblesessionid=74" 
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="fra",NAME="French",URI="video.mp4_audiochunk.m3u8?nimblesessionid=74&nimble_audio_index=1" 
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="spa",NAME="Spanish",URI="video.mp4_audiochunk.m3u8?nimblesessionid=74&nimble_audio_index=2" 
#EXT-X-STREAM-INF:BANDWIDTH=450000,AUDIO="aac",LANGUAGE="eng" 
video.mp4_videochunk.m3u8?nimblesessionid=74


If you have any questions regarding this or related feature sets, please contact us.

Related documentation


Nimble StreamerVOD Streaming in NimbleSMIL support for MPEG-DASH, MP4 transmuxing to HLS VOD streaming, Subtitles support in Nimble StreamerUsing SMIL in Nimble Streamer,

No comments:

Post a Comment

If you face any specific issue or want to ask some question to our team,
PLEASE USE OUR HELPDESK

This will give much faster and precise response.
Thank you.