MPEG/DASH

UCDN
2019-11-04 11:47

INTRODUCTION

The usage of VOD service is available for CDN zones for big objects, which are such by default.

In order to use MPEG/DASH you need to create a zone for big objects (they are such by default) and generate mpd link for the mp4 file to be played. This is done by prefixing '/dash' to the path and appending /manifest.mpd at the end. Please note that you need to only upload your full mp4 files and segmentation is done by the CDN. 

Example:

mp4_file: /video/012345.mp4
manifest_path: /dash/video/012345.mp4/manifest.mpd

The returned manifest uses SegmentTemplate elements from the mpeg-dash specification. The mpd manifest list gives a template and how many fragments there are and the player can combine this info to build the absolute url for a given fragment. This makes the mpd significantly shorter for long videos.

You can change them by using parameters bsd (first segment) and sd(other segments) in the URL.

Example:

mp4_file: /video/012345.mp4
manifest_path: /dash/bsd/10000-10000-15000/sd/20000/video/012345.mp4/manifest.mpd

In the provided example we set the initial segment to be 10 seconds, the second again 10 seconds, the third is 15 seconds  and the rest to be 20 seconds. Please note that the values should be in milliseconds.

URLSET

Additionally there is functionality to build a manifest  from multiple files. This can be used when for a given video source there are multiple resolutions, and we would like the user to be able to change between them without changing the page.

For the example let's say that we have the previous file /video/012345.mp4 in 3 resolutions 240p, 360p and 480p and we have named them /012345_240p.mp4 , /012345_360p.mp4 and /012345_480p.mp4 accordingly.

The request will look like: 
/dash/video/012345_,24,36,48,0p.mp4/urlset/manifest.mpd
where you can see that the common parts are "012345_" and "0p.mp4" and we divide by commas the three different bitrates - 24,36,48

This will return a manifest once again using SegmentedTemplates, with all video streams from all the files present with additional info for the bitrates and codecs.

SECURITY TOKEN

Our MPEG/DASH functionallity supports the use of security token in order to block any hotlinking attemps. You can check for more information here:
https://help.ucdn.com/content/44/9/en/limit-access.html#token

Combining all features in order to generate security token you should include the following part:

/video/bsd/10000-10000-15000/sd/20000/012345_,24,36,48,0p.mp4

Note that the prefix /dash and suffixes urlset/manifest.mpd and /manifest.mpd are excluded

The fragment urls in the mpd are relative to the mpd url and also have the security token attached to them. 

There is no need to recalculate it for each of them before requesting them.

Because the security token is the same one (including all parameters) for the mpd file it's important to note that for longer videos it's possible that the security token can expire before a request for the given segment is made.