Hi,
Have a number of mpd and their associated init and m4s files, generated by MP4Box, and would like to merge these, such that I can have a playback in a given order. Is there a tool that can accomplish this, and if not, what is the proper way to do so manually?
Cheers,
You can do it manually. Your XML MPD file has the following structure: <MPD><XXX/><Period/></MPD>
The <MPD> and <XXX/> should be similar to all you file. Then concatenate the periods from your different MPDs:
<MPD><XXX/><Period/><Period/><Period/></MPD>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your reply. Unfortunately, I haven't been able to concatenate the mpds, as suggested. Here are my original mpds:
20_40:
<?xml version="1.0"?><!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5194 on 2015-04-23T16:43:23Z--><MPDxmlns="urn:mpeg:dash:schema:mpd:2011"minBufferTime="PT1.500000S"type="static"mediaPresentationDuration="PT0H0M20.00S"profiles="urn:mpeg:dash:profile:isoff-live:2011, http://dashif.org/guildelines/dash264"><ProgramInformationmoreInformationURL="http://gpac.sourceforge.net"><Title>20_40/mpd.mpd generated by GPAC</Title></ProgramInformation><Periodid=""duration="PT0H0M20.00S"><AdaptationSetsegmentAlignment="true"maxWidth="1280"maxHeight="720"maxFrameRate="25"par="16:9"><Representationid="1"mimeType="video/mp4"codecs="avc1.64001f"width="1280"height="720"frameRate="25"sar="1:1"startWithSAP="1"bandwidth="999140"><SegmentTemplatetimescale="12800"duration="46080"media="seg_Prometheus_1280x720_1000k_20_40$Number$.m4s"startNumber="1"initialization="seg_Prometheus_1280x720_1000k_20_40init.mp4"/></Representation></AdaptationSet></Period></MPD>
40_60:
<?xml version="1.0"?>
\<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5194 on 2015-04-23T16:43:33Z--><MPDxmlns="urn:mpeg:dash:schema:mpd:2011"minBufferTime="PT1.500000S"type="static"mediaPresentationDuration="PT0H0M20.00S"profiles="urn:mpeg:dash:profile:isoff-live:2011, http://dashif.org/guildelines/dash264"><ProgramInformationmoreInformationURL="http://gpac.sourceforge.net"><Title>40_60/mpd.mpd generated by GPAC</Title></ProgramInformation><Periodid=""duration="PT0H0M20.00S"><AdaptationSetsegmentAlignment="true"maxWidth="1280"maxHeight="720"maxFrameRate="25"par="16:9"><Representationid="1"mimeType="video/mp4"codecs="avc1.64001f"width="1280"height="720"frameRate="25"sar="1:1"startWithSAP="1"bandwidth="949985"><SegmentTemplatetimescale="12800"duration="46080"media="seg_Prometheus_1280x720_1000k_40_60$Number$.m4s"startNumber="1"initialization="seg_Prometheus_1280x720_1000k_40_60init.mp4"/></Representation></AdaptationSet></Period></MPD>
To concatenate these, I tried a few things:
1- Left the directory structure as is and generated the following:
<?xml version="1.0"?><!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5194 on 2015-04-23T16:43:33Z--><MPDxmlns="urn:mpeg:dash:schema:mpd:2011"minBufferTime="PT1.500000S"type="static"mediaPresentationDuration="PT0H0M20.00S"profiles="urn:mpeg:dash:profile:isoff-live:2011, http://dashif.org/guildelines/dash264"><ProgramInformationmoreInformationURL="http://gpac.sourceforge.net"><Title>mpd.mpd generated by GPAC</Title></ProgramInformation><Periodid="20_40"duration="PT0H0M20.00S"><AdaptationSetsegmentAlignment="true"maxWidth="1280"maxHeight="720"maxFrameRate="25"par="16:9"><Representationid="1"mimeType="video/mp4"codecs="avc1.64001f"width="1280"height="720"frameRate="25"sar="1:1"startWithSAP="1"bandwidth="999140"><SegmentTemplatetimescale="12800"duration="46080"media="20_40/seg_Prometheus_1280x720_1000k_20_40$Number$.m4s"startNumber="1"initialization="20_40/seg_Prometheus_1280x720_1000k_20_40init.mp4"/></Representation></AdaptationSet></Period><Periodid="40_60"duration="PT0H0M20.00S"><AdaptationSetsegmentAlignment="true"maxWidth="1280"maxHeight="720"maxFrameRate="25"par="16:9"><Representationid="1"mimeType="video/mp4"codecs="avc1.64001f"width="1280"height="720"frameRate="25"sar="1:1"startWithSAP="1"bandwidth="949985"><SegmentTemplatetimescale="12800"duration="46080"media="40_60/seg_Prometheus_1280x720_1000k_40_60$Number$.m4s"startNumber="1"initialization="40_60/seg_Prometheus_1280x720_1000k_40_60init.mp4"/></Representation></AdaptationSet></Period></MPD>
The main difference between this and the original ones are the following:
a- Had to give a unique id to each Period section
b- Added relative directory path to SegmentTemple, i.e., 20_40 and 40_60.
2- Also tried dumping all the files in one directory, and concatenated the mpds as above, without sub-directory referencing. The results are similar, i.e., only the 1 video plays. Also changed mediaPresentationDuration="PT0H0M20.00S" to mediaPresentationDuration="PT0H0M40.00S" to no avail.
Any thoughts?
Cheers,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your reply. As mentioned did change mediaPresentationDuration to 40, as well. I believe problem has to do with dashjs, e.g., https://github.com/Dash-Industry-Forum/dash.js/issues/285. My "ugly" workaround is to upload new mpd, upon termination of the current one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Have a number of mpd and their associated init and m4s files, generated by MP4Box, and would like to merge these, such that I can have a playback in a given order. Is there a tool that can accomplish this, and if not, what is the proper way to do so manually?
Cheers,
You can do it manually. Your XML MPD file has the following structure: <MPD><XXX/><Period/></MPD>
The <MPD> and <XXX/> should be similar to all you file. Then concatenate the periods from your different MPDs:
<MPD><XXX/><Period/><Period/><Period/></MPD>
Thank you. Messed up on Reply, kindly, see https://sourceforge.net/p/gpac/discussion/287547/thread/c638bfdd/#6b69
Thank you for your reply. Unfortunately, I haven't been able to concatenate the mpds, as suggested. Here are my original mpds:
20_40:
40_60:
which were generated by:
,respectively.
To concatenate these, I tried a few things:
1- Left the directory structure as is and generated the following:
The main difference between this and the original ones are the following:
a- Had to give a unique id to each Period section
b- Added relative directory path to SegmentTemple, i.e., 20_40 and 40_60.
http://dashif.org/conformance.html does not report any problem with mpd; however, I am only able to playback the video contained in the 1st Period section. Tried both MP4Client and video-js, similar to https://gist.github.com/ddennedy/16b7d0c15843829b4dc4#file-videojs-html. Interestingly, during web playback, http server serves the 1st chunk of the 2nd video:
2- Also tried dumping all the files in one directory, and concatenated the mpds as above, without sub-directory referencing. The results are similar, i.e., only the 1 video plays. Also changed mediaPresentationDuration="PT0H0M20.00S" to mediaPresentationDuration="PT0H0M40.00S" to no avail.
Any thoughts?
Cheers,
try changing mediaPresentationDuration="PT0H0M20.00S" to 40 seconds
Thank you for your suggestion, but as noted above, had tried it to no avail.
Cheers,
Jean is right: your above example is wrong in this perspective.
Thank you for your reply. As mentioned did change mediaPresentationDuration to 40, as well. I believe problem has to do with dashjs, e.g., https://github.com/Dash-Industry-Forum/dash.js/issues/285. My "ugly" workaround is to upload new mpd, upon termination of the current one.