0%

What is DASH Video?

This is a reflection on a project about making a DASH video player with React in Computer Networking course. To view the whole project please go to github.


To start with, let's talk about what is the DASH first.


Dash


Dash is the short for Dynamic Adaptive Streaming over HTTP, it also calls MOEG-DASH. As the name suggests, this format of streaming allows users to watch video with dynamic byterate and changing the rate without any stall. But how does it get implemented?

In a word, DASH will generate a config/manifest file in XML to describe different byterates and file segments. In this context, the file segments are just a whole video and we cut them into small pieces with different byterates. But why do we need such a manifest file and segments?

It is a requirement of dynamic adaptive streaming. With pieces of small video clips in different byterates, the player can choose which one to load given the Internet condition and switch to another byterate painlessly since the clips are extremely small.

Wait! What should I do to generate the manifest file and different video clips with different byterate?

In this case, we usually use the ffmpeg with mp4Box to solve the problem.

Firstly we need to use ffmpeg to generate video files with different byterate by running


ffmpeg -i xxx.mp4 -nv -ac 2 -ab 128k audio.mp4 # to get the audio 
ffmpeg -i xxx.mp4 -vc libx264 -na -vf scale=-1:1080 xxx-1080.mp4 #to get video with certain framerate

Note: above code only generate one audio channel and a full video with 1080p, you should generate more different byterate videos depend on your need.

After that, you should use MP4Box to generate the dash manifest.


MP4Box -dash 2000 -rap -profile dashavc264:live -out dash.mpd

At last, since the document with DASH is so limited, I will leave a piece of code that is about how to generate DASH video in nodejs, hope that will help you out.



In addition, if you want to play the dash video via browser, the DASH.js may be a good reference.