Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm building a Dynamic Adaptive Streaming over HTTP (DASH) service. Here is the .mpd file it publishes:

<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="dynamic" minBufferTime="PT0S">
  <ProgramInformation>
    <Title>My Stream</Title>
    <Source>Music Inc</Source>
  </ProgramInformation>
  <Period>
    <AdaptationSet id="3" mimeType="audio/mp4" segmentAlignment="true" audioSamplingRate="48000.0" codecs="mp4a.40.2" startWithSAP="1" lang="eng">
      <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" id="2"/>
      <BaseURL></BaseURL>
      <SegmentTemplate initialization="mystream-$RepresentationID$-IS.mp4" media="mystream-$RepresentationID$-$Number$.m4s" startNumber="163428046" timescale="1" duration="10"/>
      <Representation id="128kbps" bandwidth="128000"/>
    </AdaptationSet>
  </Period>

However, when I open this stream (in VLC), I see 404 errors in the logs:

adaptive error: Failed reading https://************:443/mystream-128kbps-326856092.m4s: HTTP/1.1 404 Not Found
adaptive error: Failed reading https://************:443/mystream-128kbps-326856093.m4s: HTTP/1.1 404 Not Found

Note that the first segment template number that VLC attempts to locate is 326856092, exactly 2X the expected number specified in the MPD by startNumber="163428046"

This doesn't exactly answer my question, but I've resolved the issue by adding availabilityStartTime="1970-01-01T00:00:00Z" to the MPD and start="PT420289H50S" to the Period. – Charney Kaye Oct 15, 2021 at 7:45 Error 404 indicates a file is not found. So it looks like the code is using files to playback MPEG. The filenames that are being used are based on the size and offset of the MPEG data. – jdweng Oct 15, 2021 at 9:26 Segment filenames are sequential from starting number, afaik. Please point me to the part of the DASH spec pertaining to computing based on the size and offset of the MPEG data. – Charney Kaye Oct 15, 2021 at 9:36

First of all you created a dynamic manifest which means it's for a live stream.

When playing a live stream the player will not start with the first segment, it will try to determine the live edge based on the information you provided in the manifest. The live edge advances with the wall clock.

Since you didn't provide any kind of information like the availabilityStartTime, Period start etc. it uses just the time when the manifest was published - in your case the time of the HTTP response - and the segment duration.

For example:

publishTime = 1634310000
currentSegmentNumber = startNumber + publishTime * timescale / duration
                     = 163428046 + 1634310000 * 1 / 10
                     = 326859046

If for some reason your startNumber corresponds to the current Epoch time when you generate the manifest it'll try to start exactly at 2x.

Maybe you need a static VoD playlist if you want to start at the beginning of the content.

Read more here: DASH-IF Timing Model

Actually, you've nailed it! This is a live stream numbered from epoch. Thanks for the tips. I'm going to continue working through this, and likely accept your answer. – Charney Kaye Oct 15, 2021 at 18:57 @CharneyKaye Then set the availabilityStartTime to the time the stream started, so 0 in the timeline corresponds to the first segment number. You should also include a UTCTiming element for clock synchronization. – aergistal Oct 15, 2021 at 19:25 sparing some implementation detailswhich are constrained by the nature of this project— is it okay to forever say that the stream started at 0 millis epoch, and the first segment number is nowEpochSeconds/10? So far, in my experiments this does seem to work. Please see my other question for context stackoverflow.com/questions/69590696/… – Charney Kaye Oct 15, 2021 at 22:21

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.