-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Closed-captions (WebVTT) subtitles won't show up for HLS live-stream #10969
Comments
I had a look at the provided live stream just now, but all the WebVTT files are empty (just contain the Would you be able to download one of the If you can provide a stream where this repros 100% of the time then I can investigate further. I'm not able to investigate on a stream where the content only sometimes has subtitles. |
@icbaker
I'm using this HLS player online https://www.hlsplayer.net/ and there I can see that the CC subtitles works when selected. |
Thanks, looking at the audio and video segments you sent through I see that they both have a Assuming this is in a standard 90kHz clock, that gives us:
i.e. they're very similar (100ms different to each other), and it looks suspiciously like a unix timestamp:
ISO 14496-12:2012 defines
So this suggests that this stream started on 1st Jan 1970 (which I would argue seems a little unlikely :)). Meanwhile the WebVTT file you provided has cues with timestamps in the range of The
That means the WebVTT timestamps are way in the past compared to the audio and video segments (over 53 years ago), which might explain why they're not being shown. What happens if you keep the audio/video timestamps the same, but you change the WebVTT timestamps to be 'current' (i.e. something like (for 2023-02-21 15:19 UTC when I'm writing this) |
@icbaker Modifying the timestamps like you suggested is unfortunately not an alternative right now. Questions:
|
We haven't received any reports of valid HLS live streams having problems with WebVTT subtitles. I'm afraid I don't have an open example stream to share with though.
No, I think the stream you've provided is not valid due to the timestamp mismatches I've described above - so it's reasonable for ExoPlayer not to play it correctly. The fact that other players are able to work around this invalidity is not evidence that the stream is valid.
I'd suggest fixing the media so the timestamps are aligned between the WebVTT files and the audio/video segments. |
Hi, I'm working togheter with @dgewe . https://www.rfc-editor.org/rfc/rfc8216#section-3.5 last section states: The values that our origin puts into the webvtt files are calculated like this. Using a fresh example gives me: Given the above the calculations should then be: 150991810346560 mod 8589934592 = 6530022976 / 90000 = 72555,810844444444444 The webvtt subtitle looks like this: 20:09:15.810 --> 20:09:17.010 20:09:17.010 --> 20:09:19.650 Is this way for timing subtitles unsupported by ExoPlayer ? (edit: removing actual subtitle text) |
The RFC you quoted says (emphasis mine) "WebVTT cue times have not [wrapped]" But in the working lower down you are deriving the WebVTT cue time from the wrapped PES timestamp. This doesn't match my interpretation of the RFC. There's no need to wrap a WebVTT cue timestamp, because it's just a string - it can hold a theoretically arbitrarily large number of hours. ExoPlayer does actually impose a practical limit here, because we parse it into a signed 64-bit This is why I don't think you should be deriving the WebVTT timestamps from the post-wrapped media time, and instead they should match the pre-wrapped time. |
You are correct, the cue times doesn't wrap, however they mark an "offset" from when to be displayed. The origin should keep the "offset" between PES and WebVTT "strict" and my interpretation of the quoted section is that the client SHOULD cover a sort of misbehaving origin that does not properly keep the offset between PES and WebVTT cue times strict (i.e. the PES header has rolled over, but the cue times have just continued) I should have mentioned the reason for having it like this and that is that the same WebVTT files are used for HLS TS, HLS CMAF and DASH streams where in particular the MPEG-2 PES header is constantly rolling over. This is to improve the cache hit ratio. |
I'm not sure I understand this bit - don't WebVTT cue timestamps represent a time since the 'start of the stream' (an offset if you like)? Since this stream declares it starts on 1st Jan 1970 (aiui), the WebVTT cue times should be equal to the time since that date.
HLS + WebVTT is designed to handle this constant roll-over, that's what the spec section you linked is about - and so in all the HLS cases I think the WebVTT timestamps should not be wrapped. For DASH, my understanding is that timestamps in standalone WebVTT files need to be relative to the start of the period: https://dashif-documents.azurewebsites.net/DASH-IF-IOP/master/DASH-IF-IOP.html#standalone-text-timing There's no mention of expecting WebVTT timestamps to wrap either. |
Sorry for a delayed answer.
Isn't that a "Dash interpretation". As far as I know, there is no "tracker" in MPEG-2 that tracks the number of times the PES (the clock) header has wrapped, there by its not possible to deduce the exact start time of the stream (the time "0" can mean anything that has an even modulus)? It gets a bit more complicated when introducing HLS CMAF were you have some extra timing information in the fmp4 containers (like the one you mentioned "baseMediaDecodeTime"). However I haven't found any addendum or similar that specifies that the players should use the extra timing info in the fmp4:s or that the mpeg2 behaviour is not valid anymore? As mentioned previously, it works in Apples AVPlayer (iOS/tvOS/Safari) and Shaka
You are right here, I hadn't read that section of the DASH standard so we won't be able to reuse it for DASH however we still want to use it for HLS TS and HLS CMAF. |
Hi again, We're still not getting good results and are stuck on this issue, I would again appreciate any help to nail it down. Link to a test stream has been sent by e-mail. We're now running WebVTT timestamps that are not wrapped and they currently look like this: I'm still having problems making sense of this, specifically on this line: Line 63 in 3a654c1
Here I can see that the values are: Questions:
Also, we dug into the code a bit more ExoPlayer/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/WebvttExtractor.java Line 185 in 67991cb
Thanks for any help. |
After investigating this issue even more, it seems that there is no support for non-wrapped webvtt subs for HLS live streams (cmaf). I got around this issue by changing the below code in the WebvttExtractor.
to
|
Hello!
I'm investigating a issue where a HLS live-stream closed-captions subtitle (WebVTT) track is selectable and available, but won't show any subs. It seems to be the same problem with both HLS + DAI and HLS without DAI.
Same stream with subtitles works OK for Shaka Player (Web).
I've sent a link to a HLS (DAI) live-stream privately by email where there are CC subtitles available, but only for certain content.
When trying to find the root cause I found something of interest where the Cues are filtered out in step 3. of this flow:
subtitle.getCues(positionUs), presentationTimeUs)
TextRenderer.java#L260
Assertions.checkNotNull(subtitle).getCues(timeUs - subsampleOffsetUs)
SubtitleOutputBuffer.java#L63
if ((cueTimesUs[i * 2] <= timeUs) && (timeUs < cueTimesUs[i * 2 + 1]))
WebvttSubtitle.java#L72
I noticed that in step 2. of the flow, the subsampleOffsetUs might be wrong.
Example:
timeUs = 1000084419695
subsampleOffsetUs = -1638780233473066
This leading to step 3. will give values like:
if ((cueTimesUs[i * 2] <= timeUs) && (timeUs < cueTimesUs[i * 2 + 1]))
if ((57244202000 <= 1639780317892761) && (1639780317892761< 57245002000))
My questions are:
Thanks for the help.
The text was updated successfully, but these errors were encountered: