Package media file for play

In order to generate the dash segments using mg you should have available one or more MP4 files. All this files should be gop aligned.

Read here to know how to produce your files in case you do not have them.

In order to verify that your files are gop aligned you can use this command:

mg -k:gop -i:<mp4 file>

Running the same command on all file should result in the same gop list.

Once you have verified the input file are correct you can use mg to produce the mpeg dash segments:

mg -k:adaptive -o:<output directory> \
-i:<first file> -b:<first bitrate> -s:0 -e:0 \
-j:<second file> -b:<second bitrate> \
-j:<third file> -b:<therd bitrate> \
-j:<nth file> -b<nth bitrate>

For instance if you followed the explanation to encode a media file you could have the following files:

So your command line should be:


mkdir adaptive
mg -k:adaptive -o:./dash \
-i:./test_1024x576_h264-750Kb_aac-lc.mp4 -b:750 -s:0 -e:0 \
-j:./test_1280x720_h264-1200Kb_aac-lc.mp4 -b:1200 \
-j:./test_1280x720_h264-2000Kb_aac-lc.mp4 -b:2000 \
-j:./test_1280x720_h264-3500Kb_aac-lc.mp4 -b:3500 \
-j:./test_256x144_h264-120Kb_aac-lc.mp4 -b:120 \
-j:./test_512x288_h264-320Kb_aac-lc.mp4 -b:320


$dir=[path to the output directory] 

mkdir $dir
mg -k:adaptive "-o:$dir" `
"-i:./$($name)_1024x576_h264-750Kb_aac-lc.mp4" -b:750 -s:0 -e:0 `
"-j:./$($name)_256x144_h264-120Kb_aac-lc.mp4" -b:120 `
"-j:./$($name)_512x288_h264-320Kb_aac-lc.mp4" -b:320 `
"-j:./$($name)_1280x720_h264-1200Kb_aac-lc.mp4" -b:1200 `
"-j:./$($name)_1280x720_h264-2000Kb_aac-lc.mp4" -b:2000 `
"-j:./$($name)_1280x720_h264-3500Kb_aac-lc.mp4" -b:3500 

Once you have your directory with mpeg-dash segment you can publish then in a Web Server.