-
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
WebVTT multi-line subtitles overlapping #10980
Comments
@icbaker Can you take a look at this one to see if this is a known issue or feature gap? |
I can reproduce the problem. When handling concurrent subtitles, we currently assume each one is only one line high (the Lines 81 to 88 in f72ca83
Unfortunately that logic is executing when we're parsing the cues, rather than showing them on screen - so we have no idea how big the viewport is, and therefore can't make allowances for long cues wrapping onto additional lines. Now that I read this logic again, and the spec it's based off - I actually don't think we've quite correctly implemented the spec (but not in a way that would fix this problem, unfortunately). The spec says:
But our code actually sets 'n' to be the number of cues that are currently showing in the current (only) text track. To strictly follow the spec, we should remove the incrementing completely (since we only have one text track). That will actually make the problem described here worse, because all simultaneous cues will now overlap at the bottom of the screen, not just multiline ones. The WebVTT spec describes how overlapping cues should be handled when rendering in 7.2 step 10.14 (and onwards). Unfortunatley ExoPlayer's rendering logic is completely general, and not specific to different subtitle implementations. We could change our rendering logic to detect and avoid overlapping cue boxes. This would handle both 'explicitly multiline' cues (i.e. with newline characters) and 'implicitly multiline' cues (i.e. because of wrapping long cues with no explicit newline characters). We would need to put this logic into |
In general, TTML does permit overlapping regions, where different text can be in different regions; it even defines z-order for this case. However the IMSC profiles and the EBU-TT-D profile explicitly prohibit such overlaps so they're unlikely to be commonplace in subtitle and caption TTML documents. |
Changing ExoPlayer's rendering logic is quite involved and we don't have plans to look at this soon. If we 'fix' the WebVTT logic to precisely match the spec without changing the rendering logic then the problem described here will occur in many more cases - so I don't think we should do that. |
The conclusion(s) I came to when I last looked into this:
One way I thought to solve this was to either plumb more of the raw WebVTT source data somewhere inside the
Separate concern, touched on above: ExoPlayer's subtitle layout logic which does know the screen size etc is currently completely format-agnostic, it just deals in Maybe (total guess), it would be "good enough" to make the ' |
@icbaker in our case, there are no unset properties. We have two cues at the same time, both have the
Does this change anything? We would need the simplest solution to implement in our forked repo. |
This means you don't need to know whether a property was originally 'unset' or not. But it still requires changes to ExoPlayer's subtitle rendering to implement some form of collision avoidance, whether the WebVTT algorithm or something else. |
@icbaker we came up with a solution in our forked repo, seems to be working fine! thank you! |
ExoPlayer Version
2.18.2
Devices that reproduce the issue
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Play any video using a WebVTT subtitle track that contains two (or more) cues with overlapping time codes, the first of them also spanning multiple lines of text.
The multiple lines can result from explicit newline characters or text that is too long to fit in a single line (or a combination of both).
Can also be reproduced by using my sample WebVTT file in the demo app:
Expected result
The subtitle cues should not visually overlap.
Actual result
The subtitle cues overlap visually, with each simultaneously displayed cue only moving up one line, instead of however many line the previous cues already take up.
Media
I do not have an easily shareable sample video, so I created a sample WebVTT file that should demonstrate the issue.
sample-multi-line-overlap.zip
Bug Report
adb bugreport
to dev.exoplayer@gmail.com after filing this issue.The text was updated successfully, but these errors were encountered: