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>
</MPD>
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"
CodePudding user response:
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