ffmpeg
documentation says that we can use dash muxer to create dash segments and manifest file with just a single command, like:
ffmpeg -re -i
Ok, so this is how I resolved my problem. Following commands are useful for implementing pseudo-live dash content (it's when you want to stream existing video file as if it were a live video) but also the same approach could be used for on-demand video. First, we transform an input video file (sample.divx) into another, well prepared for dash streaming video file - sample_dash.mp4:
ffmpeg -y -i sample.divx ^
-c:v libx264 -x264opts "keyint=24:min-keyint=24:no-scenecut" -r 24 ^
-c:a aac -b:a 128k ^
-bf 1 -b_strategy 0 -sc_threshold 0 -pix_fmt yuv420p ^
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 ^
-b:v:0 250k -filter:v:0 "scale=-2:240" -profile:v:0 baseline ^
-b:v:1 750k -filter:v:1 "scale=-2:480" -profile:v:1 main ^
-b:v:2 1500k -filter:v:2 "scale=-2:720" -profile:v:2 high ^
sample_dash.mp4
I'm saying sample_dash.mp4 is well prepared because it's encoded in a good for dash format - H264/ACC and it's containing multiple (3) video streams with different qualities (baseline, main, high). ffmpeg dash muxer will translate these 3 video streams into relevant alternative video quality deash segment files. Here is how:
ffmpeg -y -re -i sample_dash.mp4 ^
-map 0 ^
-use_timeline 1 -use_template 1 -window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a" ^
-f dash sample.mpd
-re
flags tells ffmpeg to process the input video in a realtime manner, which is useful for pseudo-live streaming.