0

How can I determine the $Number of segments of a DASH media if the MPD file doesn't have any segment URL's lists? It only has a segment template tag, so I don't know how many segments the media associated to this MPD has. Hereafter the MPD file:

<?xml version="1.0" encoding="UTF-8" ?>
<MPD profiles="urn:mpeg:dash:profile:isoff-live:2011" type="dynamic" availabilityStartTime="2017-09-24T02:32:58Z" minimumUpdatePeriod="PT2.0S" minBufferTime="PT1S" timeShiftBufferDepth="PT2M" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd">
  <Period start="PT0S">

    <AdaptationSet mimeType="video/mp4" startWithSAP="1" segmentAlignment="true">

      <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" />
      <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
        <mas:MarlinContentIds xmlns:mas="marlin:mas:1-0:services:schemas:mpd" >
          <mas:MarlinContentId>urn:marlin:kid:48e495a75aefaa2f22a8c15f8c564afa</mas:MarlinContentId>
        </mas:MarlinContentIds>
      </ContentProtection>

      <SegmentTemplate timescale="10000000" presentationTimeOffset="311133404" duration="20000000" startNumber="1" media="$RepresentationID$_Segment-$Number$.m4v" initialization="$RepresentationID$_init.m4i" />
      <Representation width="1920" height="1080" frameRate="25" codecs="avc1.640029" scanType="progressive" id="Stream_0_1600000" bandwidth="1600000" />
      <Representation width="1920" height="1080" frameRate="25" codecs="avc1.640029" scanType="progressive" id="Stream_1_2600000" bandwidth="2600000" />
      <Representation width="1920" height="1080" frameRate="25" codecs="avc1.640029" scanType="progressive" id="Stream_2_3900000" bandwidth="3900000" />
      <Representation width="1920" height="1080" frameRate="25" codecs="avc1.640029" scanType="progressive" id="Stream_3_4800000" bandwidth="4800000" />

    </AdaptationSet>

    <AdaptationSet mimeType="audio/mp4" startWithSAP="1" lang="ita" segmentAlignment="true">
      <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" />
      <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
        <mas:MarlinContentIds xmlns:mas="marlin:mas:1-0:services:schemas:mpd" >
          <mas:MarlinContentId>urn:marlin:kid:48e495a75aefaa2f22a8c15f8c564afa
          </mas:MarlinContentId>
        </mas:MarlinContentIds>
      </ContentProtection>
      <SegmentTemplate timescale="10000000" presentationTimeOffset="311133404" duration="20000000" startNumber="1" media="$RepresentationID$_Segment-$Number$.m4a" initialization="$RepresentationID$_init.m4i" />
      <Representation audioSamplingRate="48000" codecs="mp4a.40.5" id="Stream_4_96000" bandwidth="96000" />
    </AdaptationSet>
  </Period>
</MPD>

I have difficult to understand how the next segment $Number is calculated.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

For live manifests, you have to calculate the approximate segment number based on the start time of the event, i.e. calculate the elapsed duration (time since the beginning of the event) till now (wall clock time - start time). Divide that by the fixed duration of each segment.

Because the startNumber=1, we can get the most recent segment number by calculating startNumber + (elapsedDur/segmentDur).

IMHO, this is nice way of keeping small manifest size. But this expects the DASH client to have its clock synchronized. Otherwise you will end up requesting segment numbers that do not exist (either too early or late). You will also run into a lot of 404s if the segments are not advertised yet.

rama
  • 171
  • 3
  • thanks @Rama, I have already found out how to calculate the segment number, but as you wrote I'm facing the issue with synchronization. In fact I get at lof of 404s for audio and video requests. But it's not clear to me how I can synchronize my client with server – Giovanni Sorrentino Nov 19 '17 at 20:39