How to create a MPD file of MPEG-DASH to play a webm video?

13,668

indexRange contains Segment Index Box (sidx). It is basically metadata fragment that contains information about the fragments the player should request when downloading the file. This is a quote from the spec:

"indexRange specifies the byte range that contains the Segment Index in all Media Segments of the Representation. The byte range shall be expressed and formatted as a byte-range-spec as defined in RFC 2616, Clause 14.35.1. It is restricted to a single expression identifying a contiguous range of bytes."

sidx box is described in HERE and a parser can be found HERE and HERE(from dash.js project)

Initialization - According to spec:

"specifies the URL including a possible byte range for the Initialization Segment."

Hope it helped!

Share:
13,668
Silvia
Author by

Silvia

Updated on June 17, 2022

Comments

  • Silvia
    Silvia almost 2 years

    I'm following this demo which uses mediaSource API and MPEG DASH standard to play a .webm video. This is the MPD file used:

    <?xml version="1.0" encoding="UTF-8"?>
    <MPD
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="urn:mpeg:DASH:schema:MPD:2011"
      xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011"
      type="static"
      mediaPresentationDuration="PT888.05S"
      minBufferTime="PT1S"
      profiles="urn:webm:dash:profile:webm-on-demand:2012">
      <Period id="0" start="PT0S" duration="PT888.05S" >
      <AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" width="720"      height="306" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
      <Representation id="1" bandwidth="534144">
        <BaseURL>mevq_logo_720x306_0250k_int-150-150.webm</BaseURL>
        <SegmentBase indexRange="29052226-29054708">
          <Initialization range="0-229" />
        </SegmentBase>
      </Representation>
      <Representation id="2" bandwidth="1078766">
        <BaseURL>mevq_logo_720x306_0500k_int-150-150.webm</BaseURL>
        <SegmentBase indexRange="56003676-56006200">
          <Initialization range="0-229" />
        </SegmentBase>
      </Representation>
      <Representation id="3" bandwidth="1745140">
        <BaseURL>mevq_logo_720x306_0750k_int-150-150.webm</BaseURL>
        <SegmentBase indexRange="83686040-83688577">
          <Initialization range="0-229" />
        </SegmentBase>
      </Representation>
      <Representation id="4" bandwidth="2295403">
        <BaseURL>mevq_logo_720x306_1000k_int-150-150.webm</BaseURL>
        <SegmentBase indexRange="111588024-111590567">
          <Initialization range="0-229" />
        </SegmentBase>
      </Representation>
      <Representation id="5" bandwidth="3797938">
        <BaseURL>mevq_logo_720x306_1500k_int-150-150.webm</BaseURL>
        <SegmentBase indexRange="166960740-166963291">
          <Initialization range="0-229" />
        </SegmentBase>
      </Representation>
      <Representation id="6" bandwidth="6418657">
        <BaseURL>mevq_logo_720x306_2000k_int-150-150.webm</BaseURL>
        <SegmentBase indexRange="222165200-222167753">
          <Initialization range="0-229" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="41000" subsegmentStartsWithSAP="1">
      <Representation id="7" bandwidth="115479">
        <BaseURL>evq_vorbis_128kbps_cues-5sec_tracks-2.webm</BaseURL>
        <SegmentBase indexRange="11944509-11947524">
          <Initialization range="0-4501" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    

    Does anybody know how to obtain/calculate the numbers 'SegmentBase indexRange' and 'Initialization range' for any video?

  • Stefan Vasiljevic
    Stefan Vasiljevic about 7 years
    After following those links I still could not find how Initialization.range and SegmentBase.rangeIndex are calculated. Can you explain or give a link to an example? THX!
  • inbaly
    inbaly about 7 years
    Start with downloading the SegmentBase.rangeIndex, and view its binary data: curl -o <fileName> -r <1500-8000(SegmentBase.rangeIndex)> <url_of_mp4.mp4> You can use You can download/clone the dash.js project, there is an example in the code itself.
  • Stefan Vasiljevic
    Stefan Vasiljevic about 7 years
    So you are saying that I should download the first chuck and read it and see where it ends and then populate the MPD with those values?
  • inbaly
    inbaly over 4 years
    @StefanVasiljevic Yes.you will need to analize the sidx metadata.