Radiant Media Player

Working with MP4Box



Set up

This article describes how to produce MPEG-DASH (DASH264) streams that are compatible with Radiant Media Player through MP4Box and ffmpeg. More generally you can use the guidelines in this article to produce MPEG-DASH streams that are compatible with any dash.js based player.

MP4Box is a multimedia packager which is part of the GPAC Open Source multimedia framework. Visit GPAC site for more information.

Documentation sections:


Installing MP4Box

Refer to the GPAC documentation page to install MP4Box. We recommend you use GPAC version 0.5.2 and above. Note that depending on your Linux distribution installing the default GPAC package may only provide older version of GPAC that may or may not work with the following guide.

For this guide we used GPAC version 0.5.2-DEV-rev971-g61bef99-master


Multi-bitrate on-demand MPEG-DASH streams

Creating keyframe-aligned mp4 video files

Refer to our FFmpeg guide on how to achieve proper content transcoding for MPEG-DASH streaming.

Dashing with MP4Box

Now we can dash those files with MP4Box

MP4Box -dash-strict 4000 -rap -bs-switching no -profile dashavc264:live -out manifest.mpd out-low.mp4#audio out-low.mp4#video out-med.mp4#video out-high.mp4#video

Explanation:

  • -dash-strict 4000 enables DASH segmentation of input files with the given segment duration. DASH-IF recommends using -dash-strict over -dash (-dash-strict seems to produce for consistent results with dash.js). A 4000 ms segment duration is an often seen values when dashing for dash.js.
  • -rap forces segments to begin with random access points.
  • -bs-switching no sets the bitstream switching mode. Set this to no to create MPEG-DASH content compatible with a largest range of devices/browsers. Not using this option can cause MP4Box to generate avc3 formatted content which is not well supported in some browsers (IE11 and older version of Android).
  • -profile dashavc264:live DASH-IF recommends using dashavc264:live. Other profiles exist but the above provides compliance with the DASH264 specification.
  • -out manifest.mpd specifies output file name for MPD. May use relative path. All segments will be produced in the same directory as the MPD.
  • out-low.mp4#audio only uses the first audio track from the out-low.mp4 source file
  • out-low.mp4#video only uses the first video track from the out-low.mp4 source file (low rendition)
  • out-med.mp4#video only uses the first video track from the out-med.mp4 source file (medium rendition)
  • out-high.mp4#video only uses the first video track from the out-high.mp4 source file (high rendition)

An example of MPEG-DASH manifest generated with the above command line:

https://rmpsite-1479.kxcdn.com/media/dash264/abr/manifest.mpd

A complete list of options for MP4Box for MPEG-DASH streams is available here.


Multiple audios on-demand MPEG-DASH streams

In this section we assume to have one mp4 file with 1 video and 1 audio track (source.mp4 H.264/AAC) and two mp4 files with 1 audio track only (source2.mp4 and source3.mp4 both in AAC). It is also assumed that all mp4s files have the same duration and have been properly transcoded for this purpose.

Affecting language data to mp4 files (optional)

Follow this section if your mp4s do not have proper language information.

In order to create a proper MPEG-DASH manifest with multiple audio tracks data we need to have language information into each mp4 source files.

First we extract our default video and audio tracks:

MP4Box -add source.mp4#video video.mp4
MP4Box -add source.mp4#audio -lang 1=eng audio1.mp4

the -lang 1=eng allow us to add language information to our audio track. The language can be either ISO 639-1 2-char code, ISO 639-2 3-char code, or the full language name. To get the listing of supported languages, use MP4Box -languages

Then we add language information to our audio-only tracks

MP4Box -add source2.mp4#audio -lang 1=ita audio2.mp4
MP4Box -add source3.mp4#audio -lang 1=ger audio3.mp4

Creating our MPEG-DASH manifest with multiple audio tracks information

MP4Box -dash-strict 4000 -rap -bs-switching no -profile dashavc264:live -out manifest.mpd audio1.mp4 audio2.mp4 audio3.mp4 video.mp4

This is quite straight forward. You can of course have multi-bitrate video with multiple audio tracks using the information provided in the previous section.

For the above command line to work you must ensure that all mp4s source file have the same duration. You are likely to need to experiment with your own set up to get to a working example.

An example of MPEG-DASH manifest generated with the above command line:

https://rmpsite-1479.kxcdn.com/media/dash264/maudios/manifest.mpd

A live example can be found here.

A complete list of options for MP4Box for MPEG-DASH streams is available here.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.