FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

[Bug]: Custom .ytt subtitles centre placement issue

Open PostScriptReal opened this issue 3 weeks ago • 4 comments

THIS ISSUE IS ONLY FOR THE POSITION OFFSET BUG!

Guidelines

Describe the bug

  1. 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)
  2. 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.
  3. 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:

Original Subtitles

Mitigated:

Original Subtitles with an extra bandaid "fix"

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

PostScriptReal avatar Dec 11 '25 04:12 PostScriptReal

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.

absidue avatar Dec 11 '25 08:12 absidue

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!

PostScriptReal avatar Dec 11 '25 08:12 PostScriptReal

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.

absidue avatar Dec 11 '25 08:12 absidue

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.

PostScriptReal avatar Dec 11 '25 08:12 PostScriptReal