dash.jsmp4box

Playing audio.mpd and video.mpd together in dash.js


For MPEG DASH streaming, I have audio.mpd and video.mpd separately for a video.mp4 file generated using following command.

MP4Box -dash 5000 -frag 5000 -rap -bs-switching no -profile dashavc264:live -segment-name ./video/$2_segment_ -out ./mpds/$2_video.mpd $2.mp4#video

MP4Box -dash 5000 -frag 5000 -rap -bs-switching no -profile dashavc264:live -segment-name ./audio/$2_segment_ -out ./mpds/$2_audio.mpd $2.mp4#audio 

Each mpd plays separately in dash.js. Is it possible to play them together using dash.js?

Or is there any way to merge both using MP4Box?


Solution

  • 2 options:

    1. MPD are XML. So you can easily post-process them to merge. Practically the MPD should be nearly identical. Insert both <AdaptationSet>s in a new MPD under <Period>.

    2. Alternately execute the following command-line to make it in one pass: MP4Box -dash 5000 -frag 5000 -rap -bs-switching no -profile dashavc264:live -segment-name $2_segment_ -out ./mpds/$2_video.mpd $2.mp4#video:baseURL=video $2.mp4#audio:baseURL=audio