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

Should hls.js be able to play corrupt streams? #6912

Open
SebastianSchoeps opened this issue Dec 13, 2024 · 3 comments
Open

Should hls.js be able to play corrupt streams? #6912

SebastianSchoeps opened this issue Dec 13, 2024 · 3 comments
Labels
GAP segments #EXT-X-GAP support and Fragment.gap usage Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question Stream Issue Transport Stream

Comments

@SebastianSchoeps
Copy link

SebastianSchoeps commented Dec 13, 2024

We use a Reolink Duo 3 PoE to record soccer games. To play the camera's HEVC stream hls.js is a great option with the upcoming support for this video format. However, the source seems to be corrupt from time to time and we didn't manage to get this fixed on FFmpeg recording level yet.

Should hls.js be able to ignore/manage corrupt data? E.g. the following stream has this issue after 9 seconds:
Demo

After 9 seconds the player totally crashes and the player needs to be reloaded. VLC "survives" the corrupt data; reencoding with FFmpeg also creates a valid stream.
It would be great if playing would just continue instead of the crash! Anything we can do here?

Thanks,
Sebastian

@SebastianSchoeps SebastianSchoeps added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Dec 13, 2024
@robwalch
Copy link
Collaborator

HEVC in M2TS is a community contributed feature made up of these PRs (CC @devoldemar):

Provide more information about the asset encoding and packaging, including any identifiable out-of-spec features. There are warnings that segments have overlapping samples, but is the issue related to that, or a specific segment?

Configuring HLS.js to only buffer "sn: 3" reproduces the issue with no warnings or error from hls.js directly. The decode error comes from the browser. Consider adding a GAP tag to that segment to skip it.

  "maxMaxBufferLength": 1,
  "startPosition": 10

@SebastianSchoeps
Copy link
Author

Thank you!

The segment in question (and the error) is:

% ffplay https://cdn4.taggy.cam/videos/VR94dbf0100aedd7f1a5b2da4dd138ebfba158786272636865/F5uz/video-00113.ts
[...]
[hevc @ 0x13e21b3b0] Could not find ref with POC 2sq=    0B 
[hevc @ 0x13e2644a0] Ignoring POC change between slices: 2 -> 1
    Last message repeated 1 times

Adding a gap tag in deed works and would be a good workaround! HLS.js with gap

a) it would be nicer if we don't have to check every single segment if it works (hls.js just skips segments with errors)
b) shouldn't the placeholder image be shown? Currently hls.js just skips the segment.

#EXTINF:3.009844,
video-00112.ts
#EXT-X-GAP
#EXTINF:3.010133,
placeholder-reolink-duo-3.png
#EXTINF:2.939889,
video-00114.ts

@robwalch
Copy link
Collaborator

b) shouldn't the placeholder image be shown? Currently hls.js just skips the segment.

Initial support for #EXT-X-GAP tags was added in v1.4 which involved skipping loading of segments marked as gaps (required by the HLS spec). Patching audio/video source-buffers or trick-playing over the gaps is more involved and will have to wait for a future release (v1.7 is a good candidate as that aligns with I-FRAME segment support which has similar requirements).

Work on GAP tags:

Issue tracking this as a feature request:

@robwalch robwalch added the GAP segments #EXT-X-GAP support and Fragment.gap usage label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GAP segments #EXT-X-GAP support and Fragment.gap usage Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question Stream Issue Transport Stream
Projects
None yet
Development

No branches or pull requests

2 participants