Showing posts with label SMIL. Show all posts
Showing posts with label SMIL. Show all posts

April 25, 2018

fMP4 ABR HLS for VOD AVC and HEVC streaming in Nimble Streamer

Last year Apple announced their support for fragmented MP4, or fMP4, in HTTP Live Streaming protocol. This enables HLS carry the content without traditional MPEG-2 Transport Stream container, which allows reducing the traffic by removing MPEGTS overhead.
The traffic saving is more than 10%, with 15%-20% on average. The all-favorite Big Buck Bunny showed 13% saving on using fMP4 compared to MPEGTS.

Nimble Streamer already had fMP4 support for live streaming, now we introduce fragmented MP4 support for VOD HLS.

This container supports H.264/AVC and H.265/HEVC video, with AAC, MP3 and AC-3 audio.

Setup


The setup for Nimble Streamer VOD streaming routes is made the same way as before, you can read this article for all details. The only difference is in the playback URL. Instead of "playlist.m3u8" name you will use "playlist_fmp4.m3u8" like this:
http://127.0.0.1:8081/vod/sample.mp4/playlist_fmp4.m3u8
When accessing the stream using that type of URL, the content will be automatically re-packaged on-the-fly to provide it in fMP4 container and the playlist will be made using proper standard.

The same applies to ABR streaming with SMIL files. You can set up ABR VOD HLS using SMIL and then use "playlist_fmp4.m3u8" file name like this:
http://127.0.0.1:8081/vod/abr.smil/playlist_fmp4.m3u8
This URL will also generate proper playlist and chunklists.

Playlists


The fMP4-based playlist generated by Nimble Streamer will look as follows.

H.264/AVC playlist for fMP4:
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",AUTOSELECT=YES,URI="audio.m3u8?nimblesessionid=3"
#EXT-X-STREAM-INF:BANDWIDTH=1016419,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=424x240,AUDIO="audio"
video.m3u8?nimblesessionid=3
H.265/HEVC playlist for fMP4:
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",AUTOSELECT=YES,URI="audio.m3u8?nimblesessionid=4"
#EXT-X-STREAM-INF:BANDWIDTH=1284765,CODECS="hvc1.1.6.L93.80,mp4a.40.2",RESOLUTION=1280x720,AUDIO="audio"
video.m3u8?nimblesessionid=4

The chunks list will be made the same way.


All Nimble HLS fMP4 streams can be played in latest versions of Apple's operating systems as well as in ffplay and JWPlayer. If you know of any other players or platforms, please share your comment about it.

Troubleshooting


Nimble Streamer internal transmuxer buffer sometimes may not be enough to fit generated HLS chunk. This may lead to this error in Nimble Streamer logs:
[tmux1] E: buffer is too small to generate
By default the buffer is 40MB. You can increase it using "vod_transmuxing_buffer". Read Nimble Streamer configuration description for config setup details.


If you have any questions regarding this feature set, please contact our helpdesk.

Related documentation


fMP4 ABR HLS for live streaming, DVR for fMP4 ABR HLS in Nimble Streamer, Nimble Streamer, VOD streaming in Nimble StreamerABR VOD HLS using SMILMP3 and AAC to HLS transmuxing.

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,

August 23, 2016

Subtitles support for VOD HLS and VOD MPEG-DASH

Nimble Streamer has wide VOD streaming feature set which covers many HLS-related capabilities like ABR streaming or multiple tracks support and multiple MPEG-DASH features.

Now Nimble Streamer is capable of adding subtitles to VOD streams.

Supported formats for HLS include WebVTT, SRT and TTML.
Supported formats for MPEG-DASH are WebVTT and TTML.

Let's see how they can be used. Major scenarios for VOD subtitles usage can be split into those two categories:

  • Simple scenario - a VOD file with one rendition has one corresponding language subtitles file. This is most common use case and it's handled in a simple way.
  • Complex scenarios like multiple languages for multiple renditions or other versions of the content. It's based on SMIL files usage and it can cover various use cases.
Let's take a look at both of them.

One subtitles file and one rendition


If you have just 1 subtitles file, you need to name it the same way as the original MP4 file. Like this:

/home/user/content/mp4/sample_with_subtitles.srt
/home/user/content/mp4/sample_with_subtitles.webvtt
/home/user/content/mp4/sample_with_subtitles.ttml
/home/user/content/mp4/sample_with_subtitles.mp4

So when you have VOD route set, your playlist URL will look like
http://your.domain/mp4/sample_with_subtitles.mp4/playlist.m3u8 
http://your.domain/mp4/sample_with_subtitles.mp4/manifest.mpd
And the playlist itself will be formed like this:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="sub",NAME="English",URI="subtitle.m3u8?nimblesessionid=91",LANGUAGE="eng"
#EXT-X-STREAM-INF:BANDWIDTH=1049607,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=424x240,SUBTITLES="sub"
chunk.m3u8?nimblesessionid=91
Now the player will be able to get subtitles using the URI mentioned there.

Default language

Unlike TTML, the WebVTT and SRT formats have no language code in their structure so there's no way to determine it. This is why we added vod_subtitle_default_language_id parameter into Nimble configuration file. It's alpha3 language code and it's "eng" by default if nothing else is specified.
If you need to use combination of different languages on the same server, you should look at the next section.

Multiple subtitles and/or renditions


SMIL format is a way you can describe VOD content which has combination of video and audio, like aforementioned ABR streaming.

This format can also be used for subtitles. You can specify which subtitle files will be used for which video files. Having SMIL file, the result URL will look like this:
http://your.domain/path/smil:bunny.smil/playlist.m3u8
Let's take a look at some examples. All sample SMIL files and playlists mentioned below can be found on WMSPanel github page.

One WebVTT subtitles file for 4 renditions of same video


Simple use case when you have just 1 subtitles file and you need to apply it to multiple renditions.


Two SRT subtitle files for 4 different renditions


Check 2 "textstream" elements specifying applied English and Spanish SRT subtitles.


One TTML subtitles file with 5 languages for 4 renditions


Here one textstream file specifies a reference to TTML file containing 5 languages.

Please also check Subtitles digest page to see what else Nimble can do for you.


Mix of languages and renditions


You can see "first_group" of subtitles (see subgroup="first_group") containing one set of languages (English, German and Norwegian) and it's applied to bigbuckbunny_450_first.mp4 and bigbuckbunny_750_first.mp4 files.
The default group of subtitles contains English, French and Spanish and it's applied to bigbuckbunny_450.mp4 and bigbuckbunny_750.mp4 files that a basically same movies but have probably other audio tracks or logos etc.
So defining groups of subtitles and assigning them to each "video" tag will make Nimble Streamer produce corresponding playlist entries.
If you don't specify the groups then all languages will be used by the player to display to the user.

As you see simple SMIL syntax allows mixing various combinations of content and subtitles so it's up to you to define what is best for your case.

Contact us if you have any questions or suggestions regarding this feature set.

Related documentation


Nimble StreamerHLS feature setSubtitles in Nimble Streamer VOD streaming in NimbleTTML formatNimble Advertizer

August 11, 2015

Using SMIL for adaptive bitrate VOD via MPEG-DASH

Nimble Streamer has an excellent MP4 to MPEG-DASH VOD transmuxing feature set. As an addition to this scenario, our customers were asking if we plan supporting multi-bitrate (adaptive bitrate) support for VOD. The de-facto standard for this kind of tasks is the Synchronized Multimedia Integration Language, or SMIL.

Nimble now has SMIL support for MPEG-DASH VOD just as it has for VOD HLS. Let's see how it's set up and how a user may stream ABR VOD.

July 22, 2015

Streaming VOD from remote HTTP storage via Nimble Streamer

Many broadcasting companies use remote media storage as a convenient way of organizing video-on-demand (VOD) streaming infrastructure. The main advantage of dedicated storage is having all files located in single repository, instead of maintaining multiple copies across all edge servers, and save costs on multiple large hard disk drives. The second advantage is ability to organize centralized backup and failure recovery and convenience of managing content, such as adding, removing or replacing media files. This is why storages like Amazon S3 are extremely popular.

Remote storage support is now available in Nimble Streamer. It works with any server, that supports file access via HTTP protocol with HTTPS as an option. Nimble Streamer support HLS, and MPEG-DASH transmuxing as well as progressive download from remotely stored media content. Advanced caching techniques allows Nimble to effectively stream files, those size exceeds available file system capacity.

Any S3-compatible storage is supported, e.g. DigitalOcean where both v2 and v4 signature types are supported.

Install Nimble Streamer


Please, see how to install Nimble Streamer for your operating system. Or read this blog article to see the example of Nimble Streamer installation on Ubuntu virtual machine.

Set up streaming routes


For local files (available in file system), please check "Set up streaming routes" section of "How to stream VOD with Nimble Streamer" article from our blog.
For media files stored remotely, you can perform the following steps:

1. Check that your media is available from remote Storage via HTTP (just try to simply download any media file). In this step you should have a media URL like this http://s3-us-west-1.amazonaws.com/wmspanel/bunny.mp4 (you can use any available remote storage).

2. Navigate to "Nimble Streamer" -> "VOD & re-streaming routes" menu section of WMSPanel web interface and click "Add VOD streaming route" link.

3. In the appeared dialog specify path, that is requested by your viewers via public URL and path, that requested content is taken from. Select "http://" or "https://" in dropdown list and enter path to your remote files location.

4. Optionally, specify the AWS access key id and AWS secret access key if your media files are protected by Amazon.

5. Click "OK" button.




Your new route will appear in Nimble routes list.

Now if you request http://localhost:8081/s3/bunny.mp4/playlist.m3u8, then Nimble Streamer takes file http://s3-us-west-1.amazonaws.com/wmspanel/bunny.mp4, transmuxes it, and performs HLS streaming.
This works for HLS and MPEG-DASH by default. If you'd like to use this for progressive download, you need to explicitly enable it in Nimble configuration file.
Open nimble.conf file and add the following parameter.
enable_pd_for_remote_vod=true
Then re-start Nimble Streamer. You can read more about config file on this page.

Test VOD streaming


Now you can test VOD streaming on a desktop and on a mobile device using HTML5 player and JWPlayer. Check "Test streaming media via multiple devices" section of "How to stream VOD with Nimble Streamer" article.

That's it.


Now you've set up a media server that can stream MP4 video files stored on remote HTTP Storage via HLS and MPEG-DASH protocols.

Take a look at Nimble Streamer performance tuning basics to see examples of live streaming resources usage and also learn about basic approaches to best performance.

In addition to single unit efficiency, you may create robust delivery networks by using load balancing techniques for spreading the load between several Nimble instances.

You can use "vod_cache_timeout" and "vod_cache_min_storage_time" parameters available in Nimble Streamer settings to define maximum and minimum cache lifetime periods.

You can also take a look at the video where Jan Ozer of Streaming Learning Center and Yury Udovichenko of Softvelum discuss dynamic packetizing of live, VOD and DVR content. It gives more details about Nimble Streamer VOD streaming, especially about remove HTTP origin feature set, it's pros and cons.



SMIL files support


Nimble Streamer can process not only media files, but also SMIL files located in remote HTTP storage. This works for both HLS and MPEG-DASH. You can use this feature as a convenient way of providing your viewers with different bitrate options for video playback.

Server-side ads insertion for VOD


Nimble Advertizer allows dynamically insert ads into VOD streaming. It supports pre-roll, mid-rolls and custom business logic based on programmable handlers. VOD files from remote HTTP location are also supported for SSAI.

Troubleshooting


Nimble Streamer internal transmuxer buffer sometimes may not be enough to fit generated HLS chunk. This may lead to this error in Nimble Streamer logs:
[tmux1] E: buffer is too small to generate
By default the buffer is 40MB. You can increase it using "vod_transmuxing_buffer". Read Nimble Streamer configuration description for config setup details.


Related documentation



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: