SRT vs VTT: how to add subtitles to a video
The difference between SRT and WebVTT subtitle files, which one each platform wants, and three ways to add subtitles to a video.
What a subtitle file is
A subtitle file is a plain text file that lists what to show on screen and when. Each entry, called a cue, has a start time, an end time and one or two lines of text. Players read the file next to the video and draw the text at the right moment.
Because the text is separate from the picture, viewers can turn subtitles on and off, pick a language and change the size. These are often called closed captions or soft subtitles. Subtitles drawn into the picture itself are open or burned-in subtitles.
SRT and WebVTT are the two most common subtitle formats. They look almost the same, but they aren't interchangeable everywhere.
The SRT format
SRT comes from SubRip, a program for ripping subtitles from DVDs. Each cue starts with a number, followed by a timing line such as 00:00:01,000 --> 00:00:04,000, then the text, then a blank line. Note the comma before the milliseconds.
SRT is the format with the widest support. VLC and other desktop players, video editors such as Premiere Pro and DaVinci Resolve, and the upload forms of YouTube, Vimeo, Facebook and LinkedIn all accept it. Basic italic, bold and underline tags work in most players.
The WebVTT format
WebVTT, Web Video Text Tracks, is the W3C standard for captions on the web. A .vtt file starts with the line WEBVTT, uses a dot before the milliseconds, and doesn't need cue numbers. It also supports settings for where a cue appears, CSS styling with the ::cue selector, comments and speaker tags.
Browsers only accept WebVTT in the HTML5 track element. If you host video on your own site with a video tag, your subtitles must be .vtt. YouTube, Vimeo and many web players accept it too.
Which format does each platform want?
For your own website with a video element, use VTT. For YouTube and Vimeo, either works. For Facebook and LinkedIn uploads, use SRT. For video editors and desktop players, use SRT.
If you're not sure, keep both. Converting between them only changes the header, the timestamp punctuation and the cue numbers, so the conversion is fast and loses nothing but VTT-only styling.
Three ways to add subtitles to a video
Upload the subtitle file alongside the video. This is the usual way on YouTube, Vimeo and social networks, and on your own site with a track element. Viewers can switch the subtitles on or off, and you can fix a typo later without touching the video.
Add the subtitles as a track inside the video file. MKV files hold SRT and ASS tracks, and MP4 files hold a text track. Players such as VLC let viewers pick the track. Desktop tools such as MKVToolNix or HandBrake do this.
Burn the subtitles into the picture. The text becomes part of every frame, so it shows on every device, in every app and in autoplaying social feeds where viewers watch without sound. The trade-off is that it can't be turned off or translated afterwards.
Adding VTT captions to a web page
Place a track element inside your video element with kind set to subtitles or captions, src pointing to the .vtt file, srclang set to the language code and a label for the menu. Add the default attribute to show it when the video loads, and one track per language.
Two server details trip people up. The .vtt file must be served with the text/vtt content type, and if it lives on another domain, that server must allow cross-origin requests and the video element needs the crossorigin attribute.
Fixing timing and text
If every subtitle is early or late by the same amount, shift all the cues by that offset. If they drift further out of sync as the video plays, the subtitles were timed for a different frame rate, such as 23.976 instead of 25 frames per second, and need rescaling.
Keep lines short. Netflix's style guide caps English subtitles at 42 characters per line and two lines per cue, which is a good rule for any video. Save subtitle files as UTF-8 so accented letters and other scripts show correctly, which WebVTT requires.
Other subtitle formats you may meet
ASS and SSA, from the Advanced SubStation Alpha family, add fonts, colours, positions and karaoke effects. Anime releases and fan translations use them, and players such as VLC and mpv show the styling. Most upload forms don't accept ASS, so convert it to SRT, which keeps the text and timing and drops the styling.
MicroDVD .sub files time cues in frames instead of seconds, so converting them needs the video's frame rate. DVD and Blu-ray rips may carry VobSub or PGS subtitles, which are pictures of text and need OCR software before they can become SRT. Subtitles stored as a text track inside an MKV or MP4 can be saved as an SRT file directly.