[Bug]: Custom .ytt subtitles centre placement issue
THIS ISSUE IS ONLY FOR THE POSITION OFFSET BUG!
Guidelines
- [x] I have encountered this bug in the latest release of FreeTube.
- [x] I have encountered this bug in the official downloads of FreeTube.
- [x] I have searched the issue tracker for open and closed issues that are similar to the bug report I want to file, without success.
- [x] I have searched the documentation for information that matches the description of the bug I want to file, without success.
- [x] This issue contains only one bug.
- [x] I have read and agree to follow the rules.
Describe the bug
- Go to this video (I am not promoting my own channel here, I'm using this video as it showcases this issue the best out of any others I know)
- The default captions (English Australia) will have subtitles that are longer than 26 characters be offset to the right. This offset gets worse depending on the length.
- Switching to the English (United States) subtitles will show a version of the previous subtitles in the EBU STL format, an officially supported format by YouTube. Notice how the subtitles don't ever get offset there.
Expected Behavior
Regardless of what format the video's subtitles are in, the subtitles should be right in the centre regardless of character count, if the alignment is set to be in the centre-bottom, centre-middle or centre-top.
Issue Labels
accessibility issue
FreeTube Version
v0.23.12
Operating System Version
Linux Mint 22.2 (24.04.1-Ubuntu)
Installation Method
.deb
Primary API used
Local API
Last Known Working FreeTube Version (If Any)
No response
Additional Information
I am very well aware that you guys won't support everything that's in YouTube's proprietary subtitle format, I know I wouldn't be able to get to the bottom of that myself, so why even bother asking a development team who works in their free time to do that, knowing that it'll be a MASSIVE undertaking.
That aside, I've got some additional information that I think would help tremendously with solving this specific issue. Unlike ArthurKun21, who originally brought this to light, I fully understand that this only happens with .ytt subtitles, and I understand the difference between the usual subtitles and these custom ones, which Arthur was confused on.
Like I said earlier, subtitles using the .ytt format will not go properly in the centre if it surpasses 26 characters, if it's lower than that, this doesn't happen. However I discovered an interesting thing today regarding this, if you created a second line made up of blank, invisible letters on any offending subtitle line, the issue is mitigated a bit. I have two comparison images showing this: Original:
Mitigated:
You can find this version of the subtitles by selecting the 'American Sign Language' captions.
That being said, I think a good workaround to this issue might be over-riding the position of the captions when at centre alignment (as this issue doesn't occur when the subtitle has its alignment set to the left or right) and making it go to the left depending on some math once a line goes past 26 characters.
Nightly Build
- [x] I have encountered this bug in the latest nightly build.
As you have created a bug report, I consider a valid fix to expand our deletion of the positioning information that we already do for YouTube's auto-generated subtitles, to all subtitles, so they are always displayed in the bottom center.
FreeTube doesn't support YouTube's custom subtitle format, so if you want that you will need to open a feature request.
That being said even if you open a feature request, we could add support for fonts and shadows etc, but the positioning and sizing will never match YouTube. YouTube uses a completely custom subtitle displayer that calculates everything in exact pixels then sizes and positions using those measurements (based on CEA-608 TV standard), whereas FreeTube uses the subtitle displayer provided by shaka-player which uses standard web layout techniques.
Yeah that sounds good, Invidious doesn't have this issue purely because they don't parse caption styling at all. Some styling is better than none!
Invidious uses YouTube's transcript endpoint and generates a basic WebVTT file rather than YouTube's subtitle endpoint, as it has higher rate limits, so their code never actually sees the styling information.
That makes sense! On the topic of supporting things other than alignment, the readme for YT Sub Converter's Github page has an exhaustive list of things YouTube's caption system supports, this includes supported fonts, other features and limitations on different platforms, so that's a good place to start I guess.