Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replay stops after last segment created #5

Closed
josepowera opened this issue Oct 26, 2022 · 7 comments
Closed

replay stops after last segment created #5

josepowera opened this issue Oct 26, 2022 · 7 comments

Comments

@josepowera
Copy link
Contributor

josepowera commented Oct 26, 2022

When running x9k3 with "replay" x9k3 stops on last segment and does not anymore update index file, or write new segment .ts files.

If I fully understand --replay it should keep "faking" continous live stream with updated index.m3u8 and (?maybe) new created .ts files. Everything seems OK until last segment.


x9k3 started with:
x9k3 -i longb.ts --replay
No sidecar / scte35 injection or anything similar was used.

Used version:

x9k3 --version
0.1.57

After some time (approxy 150 seconds) last index.m3u8 was created:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:27
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXTINF:5.338,
seg27.ts
#EXTINF:5.339,
seg28.ts
#EXTINF:5.339,
seg29.ts
#EXTINF:5.338,
seg30.ts
#EXTINF:5.339,
seg31.ts

This fill remained static after that - no further changes occured to index.m3u8.

This are last moments of x9k3 (I waited until index.m3u8 stopped changing, then after a few seconds I pressed CTRL-C)

deleting ./seg22.ts
./seg28.ts	start: 140.238000	duration: 5.339000	stream diff: 3.712951
deleting ./seg23.ts
./seg29.ts	start: 145.577000	duration: 5.339000	stream diff: 3.65278
deleting ./seg24.ts
./seg30.ts	start: 150.916000	duration: 5.338000	stream diff: 3.595596
deleting ./seg25.ts
./seg31.ts	start: 156.254000	duration: 5.339000	stream diff: 3.549967
deleting ./seg26.ts
^CTraceback (most recent call last):
  File "/home/uporabnik/.local/bin/x9k3", line 5, in <module>
    cli()
  File "/home/uporabnik/.local/lib/python3.8/site-packages/x9k3.py", line 811, in cli
    stuff.run()
  File "/home/uporabnik/.local/lib/python3.8/site-packages/x9k3.py", line 795, in run
    self.loop()
  File "/home/uporabnik/.local/lib/python3.8/site-packages/x9k3.py", line 778, in loop
    if not self._find_start():
  File "/home/uporabnik/.local/lib/python3.8/site-packages/threefive/stream.py", line 154, in _find_start
    one = self._tsdata.read(1)
KeyboardInterrupt


input stream file used was taken from slo.me....

wget https://so.slo.me/longb.ts
ls -l longb.ts
-rw-rw-r-- 1 uporabnik uporabnik 59287492 Oct  4  2021 longb.ts

@futzu
Copy link
Owner

futzu commented Oct 26, 2022

I think I know what is causing that... give me a minute.

@futzu
Copy link
Owner

futzu commented Oct 26, 2022

This should fix it.

python3 -mpip install --upgrade x9k3

@josepowera
Copy link
Contributor Author

josepowera commented Oct 26, 2022

This fix solved issue above (replay stops after last segment created). THX!

However there must be another thing, since the play on segments with EXT-X-DISCONTINUITY does not continue smooth. Same source file as above. Same config, just updated x9k3 version to new. Problem detected with ~seg32.ts, ...seg134.ts, seg187.ts ...

When testing in browser using VideoJS 7 in Chrome on windows 10, I see some report in console of browser around segment with EXT-X_DISCONTINUITY (this is I believe where stream is restarted from beggining):
Segment with index 3 from playlist 0-https://edited.com/variant0/index.m3u8 has a duration of 10.431999999999988 when the reported duration is 5.339 and the target duration is 3. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details

and video player stops and browser is re-fetching same segments a few time (in should normally just move on) then stops.

@futzu
Copy link
Owner

futzu commented Oct 26, 2022

Is that with the longb.ts video?

@josepowera
Copy link
Contributor Author

yes, longb.ts

@futzu
Copy link
Owner

futzu commented Oct 26, 2022

Dude, that's just some random on my server, I would not use that for any kind of testing.
At least re-encode it, I don't even know what codec it uses to be honest with you.

When I get some time I will look at the discontinuity issue.

@futzu
Copy link
Owner

futzu commented Oct 26, 2022

I double reset the stream when I fixed the loop, wait 10 mins and run pip again.

If you are using something with a big GOP like that , you can adjust the seconds with the -t switch and
that will up the target duration.

target duration is hard to predict,
You cannot change the target duration on a playlist,
and the you cant just make it a big number because target duration *3 cannot exceed the total seconds of the playlist.

longb is a kick ass video though, I ride longboards.

@futzu futzu closed this as completed Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants