HLS streaming
According to Apple's Best Practices for Creating and Deploying HTTP Live Streaming Media, the basic workflow to make HLS streaming is:
- Decide on your variants,
- Encode your media variants,
- Segment the media,
- Create a master playlist,
- Deploy the media,
- Validate the media.
With MFormats and MPlatform SDKs, you can prepare a content ready to deploy. It means, that steps 1-4 are covered with encoding tools of SDKs.
To start encoding, you should use a proper configuration for HLS encoding. Basic configuration looks like:
format='hls' video::codec='libopenh264' audio::codec='mp2'
As a target destination, you should use an M3U8 file that is the master playlist (step 4).
As a result of encoding, you have a set of TS segments (steps 2 and 3) and the master playlist that contains a playlist of the segments.
All the encoded files you should deploy to your web server and configure it for either VOD (video on demand) or live event streaming.
Adaptive bitrate option for HLS streaming
At the moment, we do not have a native feature to create ABR HLS streams, but you can do it manually using multiple Writers.
For example:
1. With first MWriter (and conversion to 1920x1080) encode 5 Mbits HLS stream and name it index1.m3u8.
2. With second MWriter (and conversion to 1280x720) encode HLS with the same source and the same configuration, but with 3 Mbits bitrate and name it index2.m3u8.
3. Manually create main m3u8 playlist file index.m3u8 (simply using Notepad) pointing to the files from previous steps:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=5000000
hls/index1.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3000000
hls/index2.m3u8
...
MPEG-DASH streaming
Similar to Apple's HTTP Live Streaming (HLS) solution, MPEG-DASH (Dynamic Adaptive Streaming over HTTP) works by breaking the content into a sequence of small segments, which are served over HTTP.
As with HLS streaming, you can only prepare deployment-ready content using the MFormats or MPlatform SDKs, for example, using configuration like this:
format='dash' video::codec='libopenh264' audio::codec='aac'
Before starting the encoding process, you have to select a name for the manifest file (MPD) that tells the player where all the necessary files are and how to read them. As a result of encoding, you get a set of stream chunks and a manifest file, which are used for deploying process.