cv.cm

Video · Subtitles

What is an SRT file, and how is it different from VTT?

9 min read

Short answer

An SRT file is a plain text subtitle file from the SubRip program: numbered blocks, each with a start and end time written as 00:00:01,000 --> 00:00:03,500, one or more lines of text and a blank line. WebVTT (.vtt) grew out of SRT and is the W3C format browsers use; it starts with the line WEBVTT, uses a period before the milliseconds and can carry position and style settings. Both can be written by hand in any text editor and saved as UTF-8.

Open Subtitle converter

What an SRT file is

SRT stands for SubRip Subtitle. SubRip was a program that pulled subtitles and their timings off DVDs and saved them as text, and its simple output format became the subtitle file almost every editor, player and upload page can read. An SRT file holds no video and no fonts, only text and timings, so it is tens of kilobytes even for a feature film. A video player, editor or upload page reads it next to the video and shows each line at its time.

SRT has no formal specification. The Library of Congress format description calls it "not well standardized" and notes that SRT files have no character encoding standard. In practice the rules below are the ones every program agrees on, and UTF-8 is the encoding to use. The W3C WebVTT specification credits SubRip's SRT format as the basis for WebVTT.

SRT format, line by line

This is the bilingual subtitle file for our short video 隆江猪脚饭 (Longjiang pork knuckle rice). The Chinese lines and timings are from the SRT we published; the English line under each one is from our English subtitle file. The video is 16.8 seconds long; the last subtitle ends at 15.8 seconds.

1
00:00:00,066 --> 00:00:02,400
老板 来四份隆江猪脚饭
Boss, four pork trotter rice, please

2
00:00:10,333 --> 00:00:12,666
哎 你们都不用餐具的吗
Wait — none of you use utensils?

3
00:00:14,533 --> 00:00:15,800
嗯 十分熟
Uh… make mine well-done
PartExampleRule
Sequence number1A counter on its own line: 1, 2, 3 in order, one per subtitle.
Timing line00:00:00,066 --> 00:00:02,400Start and end as hours:minutes:seconds,milliseconds, always two digits for hours and three for milliseconds, with a comma before the milliseconds. The arrow is two hyphens and a greater-than sign with a space on each side.
Text老板 来四份隆江猪脚饭One or more lines shown together. Here line one is Chinese and line two is English, so both appear at once.
Blank line(empty)Ends the subtitle. Without it, the next number is read as more text.

The lines say: "Boss, four portions of Longjiang pork knuckle rice", "Hey, don't any of you use cutlery?" and "Mm, well done". Note the gaps: nothing is on screen between 2.4 and 10.333 seconds, because nobody speaks there. A subtitle file only needs an entry while there is something to read.

How to create an SRT file by hand

Any plain text editor works: Notepad on Windows, TextEdit on a Mac (switch it to plain text first), or an online notepad. A word processor such as Word adds formatting and is the wrong tool.

  1. Play the video and note when each line starts and ends. A video player that shows milliseconds, or an editor timeline, makes this easier.
  2. Type 1, then the timing line, then the text, then press Enter twice. Repeat for each subtitle, counting up.
  3. Check that every timing line has a comma before the milliseconds and that each end time is later than its start time.
  4. Save the file as UTF-8 with the extension .srt, for example video.srt. Another encoding can turn Chinese, Japanese, Vietnamese or accented letters into garbage.
  5. Give the file the same name as the video (video.mp4 and video.srt) and many desktop players load it automatically.

Typing timings by hand is slow beyond a minute or two of speech. The faster route is to let speech recognition produce a timed draft and correct the text and timings. If you have the script but no recording yet, cv.cm's script timer turns it into an SRT draft, one subtitle per line or sentence, timed at the speaking pace you choose; correct the timings against the audio once it is recorded.

Formatting tags in SRT

Because there is no standard, formatting in SRT is whatever players choose to support. The Library of Congress description says SubRip allows limited formatting derived from HTML tags: bold, italic, underline and colour. These are usually written as <b>…</b>, <i>…</i>, <u>…</u> and <font color="#ffff00">…</font>.

  • Italics are the most common use, for example a voice on the phone or a narrator.
  • Whether a tag is shown, ignored or printed as raw text depends on the player or site.
  • YouTube supports only basic SRT: its help page says style markup in SRT is not recognized.
  • If position or styling matters, use WebVTT or burn the subtitles into the picture.

WebVTT (.vtt): the web version of SRT

WebVTT, Web Video Text Tracks, is the subtitle format defined by the W3C Timed Text Working Group. Browsers use it: the HTML <track> element that adds subtitles to a <video> expects a WebVTT file. Here is the same subtitle file as WebVTT, with a few optional features added to show them.

WEBVTT

STYLE
::cue {
  color: yellow;
}

NOTE Longjiang pork trotter rice, Chinese and English lines

order
00:00.066 --> 00:02.400
老板 来四份隆江猪脚饭
Boss, four pork trotter rice, please

00:10.333 --> 00:12.666 line:10% align:center
哎 你们都不用餐具的吗
Wait — none of you use utensils?

00:14.533 --> 00:15.800
<i>嗯 十分熟</i>
<i>Uh… make mine well-done</i>
FeatureIn the sampleWhat the W3C spec says
HeaderWEBVTTRequired as the first line of the file. The file must be UTF-8 and is served as text/vtt.
Timestamps00:10.333Period before the milliseconds, exactly three digits. The hours are optional and needed only when they are not zero.
Cue identifierorderOptional, one line above the timing, unique in the file. It can be a number or a name.
Cue settingsline:10% align:centerAfter the end time: line (vertical position), position and size (horizontal), align, vertical and region. Here the second cue moves to the top of the frame.
CommentNOTEA block that starts with NOTE; players ignore it.
StylingSTYLE and <i>CSS in a STYLE block after the header and before the first cue, plus tags such as <i>, <b>, <u>, <c> (class), <v> (speaker) and <ruby>.

How much of the styling and positioning is honoured depends on the player. A plain WebVTT file with only the header and timed cues works everywhere WebVTT is accepted.

SRT vs VTT: differences at a glance

SRT (.srt)WebVTT (.vtt)
Defined byNo formal standard; the SubRip program's outputW3C specification (WebVTT: The Web Video Text Tracks Format)
First lineThe number 1WEBVTT
Millisecond separatorComma: 00:00:02,400Period: 00:00:02.400
Hours in timestampsAlways writtenOptional when zero
Cue numbersRequiredOptional identifiers, any unique text
Position on screenNot part of the formatCue settings line, position, align
StylingHTML-like tags, support variesSTYLE blocks with CSS and cue tags
CommentsNoneNOTE blocks
EncodingNot defined; use UTF-8UTF-8 required
Where it is usedVideo editors, desktop players, most upload pagesHTML5 video in browsers, web players, upload pages that accept it

Choose SRT when a file has to work in as many programs as possible. Choose WebVTT for subtitles on your own website, or when you need positions and styles.

Converting SRT to VTT and VTT to SRT

The two formats are close enough to convert in a text editor. The one trap is the comma: replace it only on timing lines, never in the text. Our English line Boss, four pork trotter rice, please has two commas that must stay.

  1. SRT to VTT: add WEBVTT and an empty line at the top of the file.
  2. SRT to VTT: on every line that contains -->, change the comma before the milliseconds to a period, so 00:00:02,400 becomes 00:00:02.400. The sequence numbers can stay; WebVTT reads them as cue identifiers.
  3. SRT to VTT: save as UTF-8 with the extension .vtt.
  4. VTT to SRT: delete the WEBVTT line and any STYLE, NOTE and REGION blocks, and delete cue settings after the end time.
  5. VTT to SRT: write hours on every timestamp (00:10.333 becomes 00:00:10,333), use a comma before the milliseconds and number the subtitles 1, 2, 3 above each timing line.
  6. VTT to SRT: remove tags SRT players do not know, such as <v>, <c> and <ruby>, then save as UTF-8 with the extension .srt.

Open the converted file in a player before you publish it. A single missing blank line or a stray comma in a timing line can hide every subtitle after it. cv.cm's subtitle converter does these steps for you: it converts SRT to VTT and back, moves every subtitle earlier or later by the same amount (a subtitle moved to before 0:00 is dropped), and merges two subtitle files, SRT or VTT, into one bilingual file. The files are processed in the browser and not uploaded.

Which subtitle files YouTube accepts

YouTube's help page "Supported subtitle and closed caption files" lists these formats for uploading subtitles to a video:

Group on the help pageFormats
BasicSubRip (.srt), SubViewer (.sbv or .sub), MPsub (.mpsub), LRC (.lrc), Videotron Lambda (.cap)
AdvancedSAMI (.smi or .sami), RealText (.rt), WebVTT (.vtt), TTML (.ttml), DFXP (.ttml or .dfxp)
BroadcastScenarist Closed Caption (.scc), EBU-STL (.stl), Caption Center (.tds), Captions Inc. (.cin), Cheetah ASCII (.asc), Cheetah binary (.cap), NCI binary (.cap)

For SRT, YouTube supports only the basic version: style markup is not recognized and the file must be plain UTF-8. For WebVTT, the page says positioning is supported and styling is limited to bold, italic and underline, and it marks WebVTT support as being in initial implementation.

FAQ

How do I open an SRT file?

Open it in any text editor to read or edit it; it is plain text. To watch it with the video, give it the same file name as the video and open the video in a desktop player, or load it from the player's subtitle menu.

Can I put two languages in one SRT file?

Yes. Put both lines under the same timing line, as in our example with a Chinese line and an English line. Both are shown together as a two-line subtitle. cv.cm's subtitle converter can merge two single-language files into one this way. The other option is one file per language, which lets the viewer switch.

Why does my SRT file show strange characters?

It was saved in an encoding other than the one the player expected, usually an old Windows code page instead of UTF-8. Open it in a text editor, save it again as UTF-8, and reload it.

Is VTT better than SRT?

Neither is better in general. WebVTT has a written W3C specification and supports position, comments and styling, and it is what browsers use for HTML video. SRT is simpler and is accepted by more editors and players.

Does an SRT file change the video?

No. It sits next to the video as a separate track that viewers can switch on or off. To make subtitles part of the picture, they have to be burned in, which means re-encoding the video.

All video creation tutorials