从MPD文件确定$ DASH媒体的段数

问题描述 投票:0回答:1

如果MPD文件没有任何段URL列表,如何确定$ DASH介质的段数?它只有一个段模板标签,所以我不知道与这个MPD相关的媒体有多少段。此后MPD文件:

<?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>

我很难理解下一个段$Number是如何计算的。

php numbers mpeg-dash mpd
1个回答
0
投票

对于实时清单,您必须根据事件的开始时间计算近似的段数,即计算经过的持续时间(自事件开始以来的时间)到现在(挂钟时间 - 开始时间)。除以每个段的固定持续时间。

因为startNumber = 1,我们可以通过计算startNumber +(elapsedDur / segmentDur)来获取最新的段号。

恕我直言,这是保持小清单大小的好方法。但是这要求DASH客户端使其时钟同步。否则,您将最终请求不存在的段号(太早或太晚)。如果尚未公布细分,您还会遇到很多404。

© www.soinside.com 2019 - 2024. All rights reserved.