Closed 0had0 closed 3 weeks ago
I should've mentioned that I tested with different content, and got same issue.
That the segment are gone indicate some sort of clock synchronisation issue. Make sure that the machine where your server is running is properly synced using ntp.
Livesim2 reports the mismatch in time in the 410 response body, you should see how late the segment requests are determined to be by inspecting the response in the browser.
One reason for the issue, may be that your segments are not regular. Livesim2 wants all video segments to have the same duration. However, I think that should be reported in the startup phase, so it is less likely than the synchronization issue.
Regarding the MPD conformance, livesim2 is a bit opinionated:
contentType and mimeType should be in the AdaptationSet since they must be the same for all representations. codecs should be in representation since it may vary slightly between representations. Don't put these fields on both levels.
In practice, at least one of contentType and mimeType must be set in the AdaptationSet for livesim2 to accept the asset.
A strange thing with your generated MPD is the minimumUpdatePeriod. It should be a segment duration, but it is huge and contain a strange character. A copy-and-paste artefact?
I would recommend you to try with an asset where all video segments have a fixed segment duration and contentType and mimeType is set in the AdaptationSet. If it doesn't work properly, please provide a small test asset that can be used to reproduce your problems.
I suspected a synchronization issue too, but I'm testing on the same host (running the server in WSL and accessing the live stream using gpac within WSL), correct me if I'm wrong.
I used another content, generated segment with fixed duration and added the contentType and mimeType only in the AdaptationSet, I'm now getting the following error:
[DASH] Client created
[DASH] Downloading http://localhost:8888/livesim2//manifest.mpd starting at UTC 1713794757578 ms
[DASH] Download http://localhost:8888/livesim2//manifest.mpd complete at UTC 1713794757578 ms
[DASH] parsing DASH-MPD manifest /tmp/gpac_cache/gpac_cache_147F7F45821797F38A76DB6CF697C8A971677E27.mpd
[DASH] DASH client initialized from MPD at UTC time 1713794757578 - availabilityStartTime 1
[DASH] Setting up period start 0 duration 0 xlink none ID P0
[DASH] AS#1 changed quality to bitrate 4899 kbps - Width 1920 Height 1080 FPS 60/1 (playback speed 1)
[DASH] No ROUTE entity on HTTP request
[DASH] No UTC diff between client and server (UTC fetch 1713794757579 - server UTC 1713794757000 - MPD AST 1 - MPD PublishTime 1
[DASH] AST at init 2
[DASH] At current time 1713794757577 ms: Initializing Timeline: startNumber=0 segmentNumber=1713794757 segmentDuration=1.000000 - 0.000 seconds in segment (start range 1.71379e+09)
[DASH] UTC time indicates first segment in period is 1713794757
[DASHDmx] setting up group 0 from http://localhost:8888/livesim2//input_dashinit.mp4
[DASH] removing segment http://localhost:8888/livesim2//input_dashinit.mp4 from list
[DASH] No ROUTE entity on HTTP request
[DASH] AST at init 2
[DASH] At current time 1713794757590 ms: Initializing Timeline: startNumber=0 segmentNumber=1713794757 segmentDuration=1.000000 - 0.000 seconds in segment (start range 1.71379e+09)
[DASH] UTC time indicates first segment in period is 1713794757
[DASH] Set #1 At 1740 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 410 ms
[DASHDmx] End of segment for group 0, updating stats and switching segment
[DASHDmx] Clearing EOS on pids from group 0
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 1824 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 326 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 1899 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 251 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 1966 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 184 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 2023 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 127 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 2070 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 80 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 2109 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 41 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 2137 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) is not yet available on server - requesting later in 13 ms
[DASHDmx] group 0 next segment name not known yet!
[DASHDmx] group 0 next segment name not known yet!
[DASH] Set #1 At 2156 Next segment 1713794757 (AST 1713794758002 - sec in period 1.71379e+09) should now be available on server since 6 ms - requesting it
[DASH] Queing next segment: input_dash1713794757.m4s
[DASH] Added file to cache (1/1 in cache): http://localhost:8888/livesim2//input_dash1713794757.m4s
[DASHDmx] group 0 queuing next media segment http://localhost:8888/livesim2//input_dash1713794757.m4s
[HTTP] Error parsing reply for URL http://localhost:8888/livesim2//input_dash1713794757.m4s: Dialog Failure with remote peer (code 425)
[DASHDmx] group 0 download setup error Dialog Failure with remote peer
[DASH] AS#1 group is done
session last process error Dialog Failure with remote peer
my new MPD
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 2.0-rev2.0.0+dfsg1-2 at 2024-04-22T12:11:44.207Z -->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.000S" type="static" mediaPresentationDuration="PT0H1M18.650S" maxSegmentDuration="PT0H0M5.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple">
<Period duration="PT0H1M18.650S">
<AdaptationSet mimeType="video/mp4" contentType="video" segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="60" par="16:9" lang="und" startWithSAP="1">
<SegmentTemplate media="input_dash$Number$.m4s" initialization="input_dashinit.mp4" timescale="15360" startNumber="1" duration="15360"/>
<Representation id="1" codecs="avc1.64002A" width="1920" height="1080" frameRate="60" sar="1:1" bandwidth="4899606">
</Representation>
</AdaptationSet>
</Period>
</MPD>
livesim2 modified for live
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple" type="dynamic" availabilityStartTime="1970-01-01T00:00:00Z" publishTime="1970-01-01T00:00:00Z" minimumUpdatePeriod="PT4.915S" minBufferTime="PT1S" timeShiftBufferDepth="PT1M" maxSegmentDuration="PT5S">
<Period id="P0" start="PT0S">
<AdaptationSet lang="und" contentType="video" par="16:9" maxWidth="1920" maxHeight="1080" maxFrameRate="60" segmentAlignment="true" mimeType="video/mp4" startWithSAP="1">
<SegmentTemplate media="input_dash$Number$.m4s" initialization="input_dashinit.mp4" duration="15360" startNumber="0" timescale="15360"></SegmentTemplate>
<Representation id="1" bandwidth="4899606" width="1920" height="1080" sar="1:1" frameRate="60" codecs="avc1.64002A"></Representation>
</AdaptationSet>
</Period>
<UTCTiming schemeIdUri="urn:mpeg:dash:utc:http-xsdate:2014" value="https://time.akamai.com/?iso&ms"></UTCTiming>
</MPD>
this is in case of live only, VoD works fine. I inspected the requests send to the livesim2 server, saw "too early by 6710565305379ms" when fetching segments.
I can't upload the whole content, so I'll provide you a link to my drive https://drive.google.com/file/d/1n7kgTVhDSlAB2U-u9DzzRG-9WPM-I30E/view?usp=sharing
it contains the original content and the generated mpd + segments using the following command gpac -i input.mp4 -o ./dash-files/manifest.mpd
, I modified the MPD as required for livedsim2 to work.
Not sure if this help, I tried to comment out the error @ cmd/livesim2/app/livesegment.go line 99
return newErrTooEarly(int(math.Round((availTimeS - nowS) * 1000.0)))
it works, but since this content is not infinite, the streaming start to hang after some iteration.
I checked your MPD and segments. There are two issues with them:
timescale="15360"
and duration="15360"
, indicating that the segments are 1s long, although they are 5s long. The duration should be 76800 in that timescale.Here is fixed MPD. If you remove input_dash16.m4s from the asset, the other 15 should loop nicely with this MPD.
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 2.0-rev2.0.0+dfsg1-2 at 2024-04-22T12:11:44.207Z -->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.000S" type="static" mediaPresentationDuration="PT0H1M15S" maxSegmentDuration="PT0H0M5.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple">
<Period duration="PT0H1M15S">
<AdaptationSet mimeType="video/mp4" contentType="video" segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="60" par="16:9" lang="und" startWithSAP="1">
<SegmentTemplate media="input_dash$Number$.m4s" initialization="input_dashinit.mp4" timescale="15360" startNumber="1" duration="76800"/>
<Representation id="1" codecs="avc1.64002A" width="1920" height="1080" frameRate="60" sar="1:1" bandwidth="4899606">
</Representation>
</AdaptationSet>
</Period>
</MPD>
H @0had0, I've just added automatic insertion of contentType, so that issue should now be gone. For the rest, you need to prepare your content to be very regular as I explained above.
Since there is no new input from you for almost 2 months, I close this issue.
What?
I have set of m4s segments + init mp4 and the following MPD
However this is a modified version of the GPAC generated MPD, I had to add
contentType="video" codecs="hvc1.2.4.H183.90"
to theAdaptationSet
of the video andcontentType="audio" codecs="mp4a.40.2"
of the audio in order to be detected by livesim2 (after some debugging time I found that the as.ContentType="" if not specified in theAdaptationSet
same for the codec). I tested the MPD with https://[conformance.dashif.org](https://conformance.dashif.org/)/ and got the following JSONAfter making this content detectable by livesim2 I ran into another problem, the VoD is playable using the reference DASH player, however streaming the content live is not.
How?
When watching the content in live, the client is fetching a segment that is not present
theObserver00000000_dash_track1_1713193963.m4s
, I only have 5 segments, the following is the MPD modified by livesim2 when streaming in liveI'm testing in MS Edge and running the last version of master livesim2, I also tried to play from GPAC and got same error; output of
gpac -log -play http://localhost:8888/livesim2//video.mpd
: