A tool for creating styled YouTube subtitles.
YouTube's built-in subtitle editor doesn't support styling of any kind. If you want formatting such as bold, italic and coloring, you need to upload a subtitle file instead. The site accepts a number of file formats such as RealText, WebVTT and TTML, but all of these come with their own limitations - and most importantly, none of them give access to the full array of features offered by the YouTube player. For that, you need to use a YouTube-specific format called SRV3 (also referred to as YTT for "YouTube Timed Text"). It supports the following:
YTSubConverter can produce this file format for you.
The current version is 1.6.3 and is available for Windows, macOS and Linux (the Linux version requires Mono).
YTSubConverter is primarily an .ass → .ytt converter. You can create .ass subtitles using Aegisub.
Conversion is straightforward: launch the program, open your .ass file and click Convert. Alternatively, drag the .ass straight onto the .exe (Windows only). In both cases, you'll get a .ytt file that's ready for upload.
The program tries to approximate the look of the Aegisub subtitles as closely as possible on YouTube:
You'll notice that each .ass shadow can turn into one of four different YouTube shadow types: glow (same as outline), bevel, soft shadow and hard shadow. You can even combine multiple shadow types if you want - just choose from the checkboxes in the conversion UI. This is also where you can configure current word highlighting for karaoke.
Apart from converting from .ass to .ytt, the tool can also convert from .sbv (the format you get when downloading subs from YouTube's built-in editor) to .srt. This allows you to download existing, unstyled subs and add styling to them. Simply open the .sbv file, click Convert, and open the resulting .srt file in Aegisub.
Conversion between .ttml and .ytt is also possible. YouTube already supports uploading TTML files directly, but this support is rather limited - if you convert to .ytt and upload that instead, you get access to more features, not to mention workarounds for YouTube bugs. That being said, certain features like karaoke and transitions are still only available through .ass.
YTSubConverter supports the following .ass style features:
(Roboto is the YouTube default; the tool will automatically pick this if the specified font is not allowed)
It also supports the following override tags:
{\b}
- bold{\i}
- italic{\u}
- underline{\fn}
- font. (See above for list of allowed fonts){\fs}
- font size. This tag is relative to the size of the "Default" style (or the first style if there is no "Default"). For example, if the "Default" style has size 15 and you put {\fs30}
, the YouTube subtitle will be twice the standard size. Note that you can't go lower than 75% and that the Android app always uses the same size no matter what you specify.{\c}
or {\1c}
- regular text color{\2c}
- unsung karaoke text color{\3c}
- outline color{\4c}
- shadow color{\1a}
- regular text transparency{\2a}
- unsung karaoke text transparency{\3a}
- background transparency{\4a}
- shadow transparency. Due to YouTube limitations, this only works if the shadow color is &H222222& and the shadow transparency equals the text transparency.{\alpha}
- set all transparencies at the same time{\pos}
- position{\an}
- alignment. The same rules for subtitle movement on mouseover apply as described above.{\k}
- karaoke segment duration{\r}
- reset to current or specified style{\fad}
- simple fade. Due to YouTube limitations, shadows don't fade along unless their color is &H222222&.{\fade}
- complex fade. Due to YouTube limitations, shadows don't fade along unless their color is &H222222&.{\move}
- move from one point to another{\t}
- animate colors, transparencies and font sizes.{\ytsub}
- start using subscript (only works on PC){\ytsup}
- start using superscript (only works on PC){\ytsur}
- switch back to regular script{\ytruby}
- enable ruby text. {\ytruby}これは[漢/かん][字/じ]です
will result in a 漢 with a かん above it, followed by a 字 with a じ above it. You can change the position of the ruby text: {\ytruby8}
will display it above the line (default), while {\ytruby2}
will display it below. This tag only works on PC; mobile apps will display これは漢(かん)字(じ)です instead.{\ytvert}
- enable vertical text (only works on PC):
{\ytvert9}
- characters are placed vertically in columns, with those columns going from right to left.{\ytvert7}
- characters are placed vertically in columns, with those columns going from left to right.{\ytvert1}
- the whole subtitle is rotated 90° counter-clockwise so that the lines that used to go from top to bottom now go from left to right.{\ytvert3}
- the whole subtitle is rotated 90° counter-clockwise and the order of the lines is inverted so they go from right to left.{\ytdir4}
- mark subtitle as right-to-left. This tag is only needed if you want to include right-to-left sentences (such as Arabic) in subtitles for a left-to-right language (such as English). If you're uploading to a right-to-left language, YouTube will set the text direction automatically. Note that, while {\ytdir6}
theoretically allows you to set the direction to left-to-right, in practice it's not possible to include left-to-right sentences in subtitles for a right-to-left language (YouTube bug).{\ytpack}
- start ({\ytpack1}
) or stop ({\ytpack0}
) packing text into the space of a single full-width character. Only works on PC in vertical text.{\ytshake}
- make the subtitle randomly jump around.
{\ytshake}
- shake for the duration of the subtitle, staying within 20px of the original position.{\ytshake(radius)}
- stay within radius
pixels of the original position.\ytshake(radiusX, radiusY)
- stay within radiusX
pixels of the original position on the X axis and radiusY
pixels on the Y axis.{\ytshake(radius, t1, t2)}
- start shaking at t1
and stop at t2
(both numbers are in milliseconds relative to the subtitle start time).{\ytshake(radiusX, radiusY, t1, t2)}
{\ytchroma}
- adds a chromatic abberation effect. At the start, a red, a green and a blue copy of the subtitle come together and merge into the regular subtitle. At the end, the subtitle splits up into its three copies again which then disperse.
{\ytchroma}
- copies start at a distance of 20px and converge/disperse over 270ms.{\ytchroma(intime, outtime)}
- copies converge over intime
milliseconds at the start and disperse over outtime
milliseconds at the end.{\ytchroma(offsetX, offsetY, intime, outtime)}
- the first copy starts at offsetX
pixels to the left of and offsetY
pixels above the subtitle position. (The last copy starts at the same distance in the opposite direction.) Both offsets can be negative.{\ytchroma(color1, color2..., alpha, offsetX, offsetY, intime, outtime)}
- replace the default red/green/blue by any number of custom colors. Both the colors and the alpha value should be specified in hexadecimal (&H...&
).{\ytkt}
- enables advanced Karaoke Types.
{\ytktFade}
- Configure the line to use fading karaoke.{\ytktGlitch}
- Configure the line to use karaoke with glitching text. Looks for Latin, Chinese, Japanese and Korean characters in each syllable and generates random ones accordingly. Works best with left-aligned text and invisible unsung lyrics (= fully transparent secondary color).{\ytkt(Cursor,text)}
- Places the specified text after the word that's currently being sung.{\ytkt(Cursor,formatting tags,text)}
- Like the above, but you can customize the look of the cursor with override tags (similar to \t
).{\ytkt(Cursor,interval,tags1,text1,tags2,text2,...)}
- Defines an animated cursor where each "frame" lasts interval
milliseconds.{\ytkt(LCursor,text)}
and other variants - Like Cursor
, except the cursor is placed before (to the Left of) the word that's currently being sung.Tags that are not in the above list are not supported. You can use them, but they won't do anything.
The repository contains two sample .ass files:
After you upload a subtitle file, YouTube gives you a preview so you can try it out before submitting. This is nice, except that the preview only shows the file's text; it doesn't show the styling. This complicates testing: each time you make a change and want to see the result, you'd have to actually publish the subtitles so you can see them in the "real" player. This is especially bothersome if you're contributing to someone else's channel, as you'd have to get the subtitles approved each time (or make a copy of the video on your own channel).
Fortunately, there's an easier way to test your subtitles - one that doesn't require you to upload them at all. It works by using Fiddler, a program that can intercept web requests from your browser and send back a file from your hard drive (rather than one from YouTube's servers). By redirecting your browser's request for subtitles to your local .ytt file, you can see those local subtitles in your browser as though you uploaded them. Since you're not actually uploading them, you can test your changes much more quickly.
While this approach can save you a lot of time, it does require some initial setup:
regex:^https://www\.youtube\.com/api/timedtext
Once this initial setup is done, you only need to do the following whenever you want to test subtitles:
As long as Fiddler is running (and the rule is enabled), any YouTube video you view will have the specified .ytt file as its subtitles. If you make a change to the file, you don't even need to refresh the page in your browser to see it: simply disable and re-enable CCs in the video to make the YouTube player "redownload" them.
To save even more time while testing and tweaking, you can click the "Autoconvert" button in the converter GUI. As long as this button is enabled, YTSubConverter will automatically convert the currently selected .ass file whenever it detects a change. This means you can make a change in Aegisub, save the .ass, and reload the subtitles in YouTube to see the result without ever having to pass by the converter.
For your own videos, you can add styled subtitles as follows:
Note that after uploading the file, you won't see the styling in the editor's preview pane. This is normal; as long as you don't change anything in the editor, the styling will show up in the "real" video player afterwards. If you make any change, no matter how small, all styling information will be lost and you'll have to upload the file again.
For videos on someone else's channel, things are a bit trickier. YouTube used to have a community subtitling feature that allowed anyone to submit captions for videos; channel owners could then review the submission and publish it with the click of a button. On September 28 2020, however, the feature was deprecated and later removed. This means users have to follow the more primitive route of contacting the channel owner, sending them the subtitle file, and asking them to upload it on their behalf.
YouTube has some bugs and limitations when it comes to styled subtitles. Please be aware of the following:
YTSubConverter can be run from the command line. There are two ways of calling it:
YTSubConverter <infile>
- converts the given input file, automatically selecting the output format and file name. An .ass file will be converted to .ytt, a .ytt or .srv3 to .ass, and an .sbv to .srt.YTSubConverter <infile> <outfile>
- converts the given input file to a user-specified output format and file name. The output format is determined through the file extension. You can freely convert between any of the supported formats (.ass/.sbv/.srt/.srv3/.ytt).In addition, you can specify the --visual
option for visually accurate .ytt/.srv3 → .ass conversion (see following section).
On macOS, you can run YTSubConverter.app/Contents/MacOS/YTSubConverter
from the terminal. While it's also possible to run YTSubConverter.app itself using the open
command, you won't get any console output in this case.
Apart from the usual .ass → .ytt, YTSubConverter can also convert in the opposite direction: from .ytt (or .srv3, which is the same) to .ass. What's more, it can do this for two different purposes: editing and archiving.
--visual
option. While the resulting .ass can't be converted back to .ytt, it does give you (almost) the same visual experience in a local media player as on YouTube. Example use case: archiving videos so you can keep watching them, with visually accurate subtitles, even if they get taken down.You can download a video along with its published .ytt/.srv3 subtitles by using youtube-dl with the following options: --write-sub --all-subs --sub-format=srv3
Alternatively, you can download just the subtitles by browsing to https://www.youtube.com/api/timedtext?v=<video ID>&lang=<language code>&fmt=srv3
(you can refer to this language code table).
Subtitles for a certain channel will often have recurring looks. For example, Kizuna AI's gaming channel has pink subtitles for talking, red for screaming and yellow for explanations. To avoid having to put tags everywhere, you should of course define these recurring looks as Aegisub styles. Assigning these styles to the individual subtitles can be quite a hassle, however. This section offers a quicker way.
First do some initial setup:
Then do the following for each video:
*Hello, Darling!
)time/align
command name.Thanks to the following people for providing the UI translations: