Menu

Sequential Playback of MPDs

Help
Nastooh
2015-04-22
2015-04-24
  • Nastooh

    Nastooh - 2015-04-22

    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,

     
  • Romain Bouqueau

    Romain Bouqueau - 2015-04-23

    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>

     
  • Nastooh

    Nastooh - 2015-04-23

    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-->
    <MPD xmlns="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">
     <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
      <Title>20_40/mpd.mpd generated by GPAC</Title>
     </ProgramInformation>
    
     <Period id="" duration="PT0H0M20.00S">
      <AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="25" par="16:9">
       <Representation id="1" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="999140">
        <SegmentTemplate timescale="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-->
    <MPD xmlns="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">
     <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
      <Title>40_60/mpd.mpd generated by GPAC</Title>
     </ProgramInformation>
    
     <Period id="" duration="PT0H0M20.00S">
      <AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="25" par="16:9">
       <Representation id="1" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="949985">
        <SegmentTemplate timescale="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>
    

    which were generated by:

    export DASH_SEG=4000
    OUT_FILE_DIR=20_40; MP4Box -dash $DASH_SEG  -rap -profile dashavc264:live   -segment-name seg_%s -out $OUT_FILE_DIR/mpd.mpd $OUT_FILE_DIR/Prometheus_1280x720_1000k_20_40.mp4 
    and 
    OUT_FILE_DIR=40_60; MP4Box -dash $DASH_SEG  -rap -profile dashavc264:live   -segment-name seg_%s -out $OUT_FILE_DIR/mpd.mpd $OUT_FILE_DIR/Prometheus_1280x720_1000k_40_60.mp4
    

    ,respectively.

    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-->
    <MPD xmlns="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">
     <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
      <Title>mpd.mpd generated by GPAC</Title>
     </ProgramInformation>
    
     <Period id="20_40" duration="PT0H0M20.00S">
      <AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="25" par="16:9">
       <Representation id="1" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="999140">
        <SegmentTemplate timescale="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>
    
    <Period id="40_60" duration="PT0H0M20.00S">
      <AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="25" par="16:9">
       <Representation id="1" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="949985">
        <SegmentTemplate timescale="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.

    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:

    10.0.100.204 - - [23/Apr/2015 19:20:51] "GET /videojs.html HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:20:51] "GET /video-js/video-js.css HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:20:51] "GET /video-js/video.dev.js HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:20:51] "GET /video-js/videojs-tech-dashjs.js HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:20:56] "GET /mpd.mpd HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:20:56] "GET /video-js/font/vjs.woff HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:20:56] "GET /20_40/seg_Prometheus_1280x720_1000k_20_40init.mp4 HTTP/1.1" 200 -
    
    -->
    10.0.100.204 - - [23/Apr/2015 19:20:56] "GET /40_60/seg_Prometheus_1280x720_1000k_40_60init.mp4 HTTP/1.1" 200 -
    <--
    
    10.0.100.204 - - [23/Apr/2015 19:20:56] "GET /20_40/seg_Prometheus_1280x720_1000k_20_401.m4s HTTP/1.1" 200 -
    
    -->
    10.0.100.204 - - [23/Apr/2015 19:20:56] "GET /40_60/seg_Prometheus_1280x720_1000k_40_601.m4s HTTP/1.1" 200 -
    <--
    
    10.0.100.204 - - [23/Apr/2015 19:20:58] "GET /20_40/seg_Prometheus_1280x720_1000k_20_402.m4s HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:21:00] "GET /20_40/seg_Prometheus_1280x720_1000k_20_403.m4s HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:21:02] "GET /20_40/seg_Prometheus_1280x720_1000k_20_404.m4s HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:21:02] "GET /20_40/seg_Prometheus_1280x720_1000k_20_405.m4s HTTP/1.1" 200 -
    10.0.100.204 - - [23/Apr/2015 19:21:02] "GET /20_40/seg_Prometheus_1280x720_1000k_20_406.m4s HTTP/1.1" 200 -
    

    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,

     
  • Jean Le Feuvre

    Jean Le Feuvre - 2015-04-24

    try changing mediaPresentationDuration="PT0H0M20.00S" to 40 seconds

     
    • Nastooh

      Nastooh - 2015-04-24

      Thank you for your suggestion, but as noted above, had tried it to no avail.
      Cheers,

       
  • Romain Bouqueau

    Romain Bouqueau - 2015-04-24

    Jean is right: your above example is wrong in this perspective.

     
    • Nastooh

      Nastooh - 2015-04-24

      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.