Developer Center

DASH Packaging

This tutorial guides you through the process of packaging DASH content for distribution using the Bento4 packaging tools.

Requirements

  • Bento4 Packaging Tools (www.bento4.com)
  • An Encoding.com account (Free Trial)
  • A storage solution (S3, CF, Azure, Aspera or FTP Server)
  • High quality MP4 Content

Bento4 is compatible with the three major OS and allows users to encrypt both MPEG and MP4 media types. This tutorial focuses on packaging DASH content in a Mac environment to use with ExpressPlay. To that end, this tutorial assumes you have unencrypted HD MP4 content ready for transcoding.

For the purposes of this tutorial we are using Big Buck Bunny as the source material. 1920×1080 is recommended to provide as many different bit rates as possible although there are several resolutions available at this link. 

http://www.bigbuckbunny.org/download/


STEP 1

Encoding Content for DASH

Encoding.com provides a free usage tier that makes it ideal for this tutorial. Open an account and upload a small piece of content (HD content is recommended). After your content is uploaded, for the first output format, select Adaptive Streaming Formats from the pull-down menu and MS Smooth Streaming all devices from the second pull-down.

Set your output location, for this tutorial we use S3. Outputting to S3 requires you to provide a set of access credentials and a destination bucket.

The AWS key and AWS Secret Key are access credentials produced from S3 that function as username and password for upload rights to the bucket. Buckets act as root folders within the S3 system and must be uniquely named. With the output destination set, click Process video to start the encoding process.

Note: MS Smooth Streaming is not a dash format; however, it is the proper flavor of MP4 to use with Bento4.


STEP 2

Encrypting and Segmenting Content with mp4-dash.py

Download the Bento4 for your environment (here). Currently there are versions for Windows, OS X, and Linux. Once you have downloaded the *.zip file and opened it, you will see several command line executable files within the extracted folder, one of which is “mp4-dash.py”.

Mp4-dash.py is a python script capable of encrypting and segmenting multiple fragmented mp4s into playable encrypted DASH content.

You must supply the script with a content ID, encryption key, the files being packaged, and the marlin flag. The content ID and encryption key are each 32 byte hexadecimal values. Do NOT use the same value for content ID and encryption key as the content ID is made public in the .mpd file. The Content ID and Encryption Key are specified by including the “–encryption-key=:” parameter. Note that the ContentID and Encryption Key are separated by a colon.

Example:

key=43215678123412341234123412341234:12341234123412341234123412341234

The marlin flag is declared by including the –marlin option after the encryption key values. Lastly, add the input files, each separated by a space.

Example:

python mp4-dash.py --encryption-key=43215678123412341234123412341234:12341234123412341234123412341234 -–marlin /Users//Downloads/helloworldProperEncoded/c28986f802a1aa833338196d6922f26a_87311_49406922_300k.ismv /Users//Downloads/helloworldProperEncoded/c28986f802a1aa833338196d6922f26a_87311_49406922_600k.ismv /Users//Downloads/helloworldProperEncoded/c28986f802a1aa833338196d6922f26a_87311_49406922_1200k.ismv /Users//Downloads/helloworldProperEncoded/c28986f802a1aa833338196d6922f26a_87311_49406922_2400k.ismv

This content is then output into the default directory output. Mp4-dash.py does not overwrite existing files unless forced to using the –f option. It is also possible to specify a new output directory using the –o if you wish to store the output elsewhere. The output folder will contain two folders and a .mpd file similar to the example below.

/output /Audio /Video stream.mpd

This entire file structure can then be placed on a web server and served to video players.

Note:When generating MS3 Tokens with DASH content it is important to note that the content ID used when encrypting the content is not the full content ID. The full content ID can be found in the mas:MarlinContentId element of the .mpd manifest generated by MP4-dash.py.