Buffer stalls with SRT + LLHLS #1564
Replies: 7 comments 4 replies
-
+1, I've seen this behaviour too. It helped a bit adding the secret |
Beta Was this translation helpful? Give feedback.
-
A couple other ideas - make sure HLS.js is up to date and check that your keyframe interval divides evenly into your segment duration. I usually use 2s keyframe interval. |
Beta Was this translation helpful? Give feedback.
-
I've tried multiple hls.js versions. But both the default segment duration of 6, and the other values I've tried divide evenly to 1/2 keyframe interval.... |
Beta Was this translation helpful? Give feedback.
-
As you said you have seen this before - do you now have a combination that works for you? |
Beta Was this translation helpful? Give feedback.
-
I looked at https://origin2.scenecity.net/origin2/hevctest/hevc-bypass_llhls.m3u8, which shows that no new chunks are being created. The input signal may no longer be coming in, or there may be another problem. Buffer stalls can have many causes.
There are many other possibilities, but I think the priority is to check whether the input signal is normal. Check whether the HEVC encoder is running fast enough in OBS. (And sorry, this is a public community, so please don't mention me specifically.) |
Beta Was this translation helpful? Give feedback.
-
Getroot: Sorry to have mentioned you. The stream was gone to due an OME crash, and now due to my tests. The test live stream is running again now. Thank you once more for the recommendations. I have now found TWO issues in my setup: 1.) In my ffmpeg based test, ffmpeg wasn't passing my parameters to libx265. Due to this x265's scenecut was enabled, which may generate random keyframes in wrong places. WIth 2.) It's a mistake I made again and again: With my OBS-based live stream test, I passed latency=1000 to libsrt. But the parameter is in MICROseconds, not miliseconds. Due to this there had been reordered/missing packets. Stupid me. What is weird: The buffer stalls happen both on the path-through stream AND the transcodes. I would assume that for the transcodes the original keyframes don't matter, as you will set these in the transcoder. So I wonder why the buffer stalls also happen with the transcodes.. Right now I am running with ChunkDuration=SegmentDuration and that appears to be stable. Can you give me a recommendation of LLHLS parameters that have a focus on stability instead of low-latency? I am happy with a latency of 10 seconds or so. |
Beta Was this translation helpful? Give feedback.
-
So, I have finally solved the problem: The missing magic ingredient for ffmpeg had been But it turns out that this also applies to SRT. I would recommend to update the documentation for SRT that if you want to feed a live stream via ffmpeg that In case anyone cares, here is an example that is randomly selecting videos from a folder (the videos must be in MPEG TS format!) and streaming them. Due to a pipe being used there is no reconnect between the different videos, so you get a continuous stream. (filename streamts.sh)
For the stream to recover in case ffmpeg quits with an error, I have a wrapper script that is calling the above script:
Once again thanks to all who have helped out here. |
Beta Was this translation helpful? Give feedback.
-
Hi getroot,
I think I need a helping hand here.
I have a HEVC stream coming in to the origin via SRT, and then getting published as LLHLS on an Edge. My Chrome browsers supports HEVC playback. In theory all works fine.
But no matter what I try, the LLHLS stream is getting buffer stalls all the time. It's not a matter of not having enough bandwidth or CPU on the Source, Origin, Edge or Client PC - it happens on all computers I have tried. Even on a 1 GBit/s connection with a 2 MBit/s stream it happens. I tried both OBS as a source, and by having ffmpeg deliver a TS as an alternative. And even if I still have a buffer of a full minute (!) ahead of me in the client, every couple of seconds there will be a buffer stall. I looked at it in detail in hls.js'es debugger, too. I don't get it.
I tried your recommended settings for Chunk Duration, Segment Duration, Segment Count and the mysterious Part Hold Back, and tried hundreds of other combinations. But even with Chunk Duration(10.00) Segment Duration(30) Segment Count(50): Buffer stalls.
If I play the stream in VLC, it works perfectly - but of course VLC does not do LLHLS. So I know HLS fallback works. Telling Ovenplayer or the server to treat this as HLS and not LLHLS however doesn't.
I get the feeling that somehow OME is delivering segments to the client that are there, but in some why not usable. Maybe chunks are marked Independent while they aren't, or they are re-ordered.
There is a warning in the log popping up every couple of seconds, and I find it plausible that it might be related:
[2024-03-23 10:22:10.413] W [AW-LLHLS0:1144] FMP4 Packager | fmp4_storage.cpp:341 | LLHLS stream (#default#origin2/hevctest) / track (1) - a longer-than-expected (8383.3 | expected : 6000) segment has created. Long or irregular intervals between keyframes might be the cause.
Of course I have 1 second keyframes.
So I tried increasing the segment size. When I increased to 10000 OME decided to now create 12000+ sized frames. I went all the way up to...
[2024-03-23 10:13:40.425] W [AW-LLHLS0:225167] FMP4 Packager | fmp4_storage.cpp:341 | LLHLS stream (#default#origin2/hevctest) / track (4) - a longer-than-expected (39808.0 | expected : 30000) segment has created. Long or irregular intervals between keyframes might be the cause.
...when it became very clear that no matter what size I choose, the generated ones will always be bigger.
The only thing that made things somewhat (but not perfectly) stable was to have ChunkDuration = SegmentDuration, so basically killing any option for the LLHLS client to try to range requests.
I have reset the config to your recommended values:
A test stream showing the problem is available here:
Origin:
HEVC + AAC Passthrough: https://origin2.scenecity.net/origin2/hevctest/hevc-bypass_llhls.m3u8
HEVC transcoded (QSV) + AAC Passthrough: https://origin2.scenecity.net/origin2/hevctest/hevc-hq_llhls.m3u8
HEVC rescaled, transcoded (QSV) + AAC Re-encoded: https://origin2.scenecity.net/origin2/hevctest/hevc-lq_llhls.m3u8
And the same on the Edge:
https://fsn1-edge3.scenecity.net/origin2/hevctest/hevc-bypass_llhls.m3u8
https://fsn1-edge3.scenecity.net/origin2/hevctest/hevc-hq_llhls.m3u8
https://fsn1-edge3.scenecity.net/origin2/hevctest/hevc-lq_llhls.m3u8
Again: All of these work fine when played in VLC, but none works without those buffer stalls with Ovenplayer or the llhls.js debugger.
Any help would be highly appreciated. It would also be no problem to send the srt test stream to an origin of yours, of course.
It's weird that you prefer LLHLS over HLS. Reading through the protocol during the last night made by brain bleed. What a complex monster of a stream transport protocol...
Thank you!
br,
scamp
Beta Was this translation helpful? Give feedback.
All reactions