Introduction
SRT is the most widely supported subtitle format. It is named after SubRip, a Windows program that read the subtitles from DVD video and saved them as text. The format is so simple that almost every video player, editor and streaming service can read it.
An SRT file is plain text. Newer files are usually UTF-8, but older files are often saved in a regional code page, which is why accented letters sometimes show wrongly. The format has no formal standard, and it supports only simple styling.
Structure
The full reference is in Cues and timing and Text formatting.
The file is a list of cues separated by blank lines. Each cue has three parts: a
counter that numbers the cues from 1, a line with the start and end times, and one or
more lines of text. Times are written hours:minutes:seconds,milliseconds,
with a comma before the milliseconds, and the two times are separated by
-->.
Many players accept a few HTML-like tags in the text: <i>,
<b>, <u> and <font color="…">.
1
00:00:01,000 --> 00:00:03,500
Where are we going?
2
00:00:04,000 --> 00:00:06,250
<i>Somewhere we have never been.</i>
Not described
SubRip has no formal specification; the pages follow what SubRip wrote and what FFmpeg and the Python srt library read.
Known, not yet covered
- Reference: how players other than FFmpeg and the Python
srtlibrary (VLC, libass, browsers) treat blank lines in the text, odd time formats,\Nand\h, and plain braces. The cues and text pages describe those two readers only. - Reference: (NEW) coordinates: FFmpeg’s demuxer keeps a partly written box too (its scan format succeeds with only
X1:present, and the other three values stay −1), so “only when all four values follow” is wrong; the page does not give FFmpeg’s decoder reading (libavcodec/srtdec.c: values taken as pixels of an assumed 720×480 picture, a rectangle becomes{\an5}{\pos(centre)}, a lone corner{\an1}{\pos(X1,Y1)}) or the ale5000 comparison (“subtitle box pixel coordinates”, X1 left, X2 right, Y1 up, Y2 down, and a KMPlayer bug where the box makes the timing line show as text); “do not read them as pixels” contradicts both. - Reference: (NEW) time format: the
srtlibrary accepts, . :and the full-width forms,.。:between all fields, and the milliseconds delimiter and digits may be missing (RGX_TIMESTAMP_MAGNITUDE_DELIM,RGX_TIMESTAMP); not stated: fields above 59 are added up (FFmpeg andsrt), FFmpeg’s%dalso takes a sign (its probe allows a leading −) whilesrttakes digits only, FFmpeg needs no spaces around-->when reading (its probe needs-->), hours above 99 (pysubs2’s writer clamps at 99:59:59,999). - Reference: (NEW) file layout: FFmpeg’s byte order marks are not listed (EF BB BF skipped, FF FE UTF-16 LE and FE FF UTF-16 BE converted to UTF-8, otherwise UTF-8 assumed;
libavformat/subtitles.c); line ends are CR LF, LF or a lone CR there, not “CR LF or LF”; also not stated: FFmpeg ignores lines before the first timing line and reads lines in pieces of 4095 bytes, and thesrtlibrary skips a leading U+FEFF and (when it renumbers) drops cues with empty text, a negative start or a start not before the end. The Windows-1252 default rests only on Wikipedia’s wikitext (secondary); SubRip’s own documentation was not obtained. - Reference: (NEW) text formatting: the opening sentence says text a reader does not recognise as a tag is shown as it stands, but FFmpeg (
htmlsubtitles.c), as the page itself says below, removes unknown tag-like names, and pysubs2 strips them by default (< */? *[a-zA-Z][^>]*>); the<<rule is imprecise (only the earlier<of a run is literal, the last one can still start a tag, so<<i>gives a<and italics); the font stack allows 15 nested<font>tags (16 entries including the base), not 16, and a stray</font>is ignored;<b foo>-style attributes on b, i, u, s and spaces after<are accepted for known tags. - Reference: (NEW) brace blocks: after a second
{\anN}every later{\…}block is stripped again (the page says only that blocks between the first and second are kept); after one stripped-type block lacks its}, FFmpeg stops stripping every later block in that cue, not just that one; plain braces such as{normal text}are kept as text by FFmpeg (the ale5000 comparison lists this per player), which the page does not say. - Reference: (NEW) per-reader differences for tags,
\N,\h, dots, trimmed spaces, unclosed tags and braces are given only for FFmpeg and thesrtlibrary; the raw ale5000 comparison (MPC, VLC, KMPlayer, DirectVobSub, ffdshow) shows them differing (for example VLC 1.0.3 does not support\Nor\h, MPC-HC does), and none of that is on the pages. The earlier\N/\hwording matches the raw ale5000 headings and FFmpeg code and is correct as far as it goes. - Viewer: there is no SRT viewer plugin yet; the explorer shows the file as text.
Unknown
- Reference: how HTML character references such as
&should be treated and which colour names players accept; programs differ and no specification decides.
Links
Software
- Subtitle Edit – free subtitle editor that opens, syncs and converts SRT (Windows, Linux)
- Aegisub – free subtitle editor with timing tools (Windows, macOS, Linux)
- VLC media player – free media player that loads SRT next to the video (Windows, macOS, Linux, mobile)
- mpv – free, minimal media player that loads SRT automatically (Windows, macOS, Linux)
- HandBrake – free video converter that adds or burns in SRT subtitles (Windows, macOS, Linux)
- FFmpeg – command-line tools that convert SRT and burn it into video (Windows, macOS, Linux)
- MKVToolNix – adds SRT tracks to MKV files (Windows, macOS, Linux)