Skip to content

SDavid33/youtube-subtitle-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Subtitle Fix

Improves how YouTube subtitles look and behave with smarter line wrapping, better readability, optional per-line background boxes, and cleaner handling of translator notes.

Files

  • tampermonkey.user.js - Tampermonkey userscript version
  • enhancer-for-youtube.js - script version for Enhancer for YouTube

What it does

  • Changes subtitle text color
  • Changes subtitle size in normal mode and fullscreen mode
  • Lets Tampermonkey users save subtitle size preferences through the userscript menu
  • Can automatically keep YouTube's default subtitle size in previews, mini player, and other small player contexts
  • Adjusts subtitle background color and opacity
  • Supports one shared background box or per-line background boxes
  • Keeps subtitles centered
  • Lets you move subtitles higher on the screen
  • Adds text shadow for better readability
  • Wraps long lines automatically
  • Tries to keep line breaks more natural and balanced
  • Prefers two-line subtitles when possible
  • Allows three lines only when needed
  • Keeps translator notes in square brackets together
  • Preserves a two-line layout when a translator note is already on its own line

Main settings

  • textColor - subtitle text color
  • backgroundColor - subtitle background color as RGB values
  • backgroundOpacity - background transparency from 0 to 1
  • fontSizeNormal - subtitle size in normal mode
  • fontSizeFullscreen - subtitle size in fullscreen mode
  • subtitleSizeMode - default, script, or custom subtitle size mode
  • preferYouTubeSizeInSmallPlayers - keeps previews and mini players on YouTube's default subtitle size
  • customFontSizeNormal / customFontSizeFullscreen - saved subtitle sizes for custom mode
  • lineHeight - spacing between subtitle lines
  • maxWidthPercent - maximum subtitle width relative to the video width
  • enableAutoLineBreaks - turns smart wrapping on or off
  • preserveAutoGeneratedCaptions - keeps YouTube auto-generated captions stable by not rewriting their text
  • maxCharsPerLine - target line length for smart wrapping
  • perLineBackground - separate background per line or one shared box
  • paddingY / paddingX - inner spacing inside the background box
  • borderRadius - roundness of subtitle background corners
  • offsetNormal / offsetFullscreen - subtitle height from the bottom
  • extraPerLine - extra upward offset for multi-line subtitles
  • textShadow - subtitle text shadow

Safe starter preset

lineHeight: 1.20,
maxWidthPercent: 78,
enableAutoLineBreaks: true,
preserveAutoGeneratedCaptions: true,
maxCharsPerLine: 44,
perLineBackground: true,

Install

Tampermonkey

  1. Install the Tampermonkey browser extension.
  2. Create a new script.
  3. Replace the template with the contents of tampermonkey.user.js.
  4. Save and open any YouTube video.
  5. Optional: use the Tampermonkey menu to switch between YouTube default subtitle size, the script's subtitle size, or your own saved custom size.
  6. Optional: keep YouTube's default subtitle size in previews and mini player while still using your preferred size in normal and fullscreen playback.

Enhancer for YouTube

  1. Open Enhancer for YouTube settings.
  2. Find the custom script section.
  3. Paste in the contents of enhancer-for-youtube.js.
  4. Save and reload YouTube.

Notes

  • This script only changes how subtitles are displayed.
  • It does not modify the subtitle file itself.
  • Final behavior can still depend on how YouTube renders captions internally.
  • Best results usually come from adjusting maxWidthPercent, maxCharsPerLine, and lineHeight together.

Changelog

1.2.4

  • Added YouTube header button: YT Sub Fix
  • Added in-page settings panel
  • Added text color picker
  • Added background color picker
  • Added background opacity slider
  • Added subtitle size mode controls
  • Added normal and fullscreen custom size controls
  • Added subtitle position controls
  • Added smart line wrapping controls
  • Added visible line length value on wrapping buttons
  • Removed Tampermonkey dropdown menu commands so only the script name appears
  • Settings are saved automatically

Live preview tip for line wrapping

The Line shorter and Line longer settings are saved immediately, but YouTube does not always refresh the visible subtitle layout in normal view right away. If the subtitle line wrapping does not visibly update while the video is playing, press F to switch between normal and fullscreen mode. This usually forces YouTube to redraw the subtitle layer, so the updated line wrapping becomes visible immediately.

1.2.0

  • Added saved Tampermonkey subtitle size settings.
  • Added subtitle size modes: YouTube default, script size, and custom size.
  • Added automatic YouTube default sizing for previews, mini player, and small player contexts.
  • Updated README with the new size settings.

1.0.4

  • Improved subtitle centering so captions are centered immediately when rendered.

1.0.2

  • Preserved auto-generated captions to avoid flickering and layout glitches.

Screenshots

YouTube Subtitle Fix settings panel

Greasy Fork

Greasy Fork script page

Sponsor

ko-fi

About

Improves YouTube subtitles with smarter line wrapping, better readability, per-line background support, and cleaner translator note handling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors