What is an SRT File?
An SRT file is a plain-text subtitle format containing sequentially numbered cues. Each cue provides a start time, an end time, and caption text, with blank lines separating entries.
How SRT Files work
SubRip subtitle data is organized as cue blocks: a counter line, a timing line in the form hours:minutes:seconds,milliseconds --> hours:minutes:seconds,milliseconds, one or more lines of text, and a blank line. The format comes from the SubRip subtitle-ripping program and has no formal specification, so in practice it is defined by what parsers accept. It carries timing and text but no layout model that players implement uniformly; many players accept informal styling such as HTML-like bold, italic, underline, and color tags, which can make the same file render differently across applications. SRT commonly appears as a sidecar during caption exchange, localization, quality review, and packaging into a streaming container.
Key facts
- Canonical SRT timing looks like
00:00:00,498 --> 00:00:02,827: a comma before the milliseconds and an arrow made of two hyphens and a greater-than sign. Parsers differ in tolerance. FFmpeg’s SRT demuxer (checked in release 8.0) accepts a comma or a period and does not check counter values or their order, although a counter line must start with a number. A stricter parser may accept less, so write the canonical form. - Browsers do not load SRT as a text track: MDN documents the
trackelement’s files as WebVTT. Converting is more than renaming the file. A WebVTT file must begin with the stringWEBVTT, uses a period before the milliseconds, and must be encoded as UTF-8. - SRT has no character encoding standard and no place to declare one, as the Library of Congress notes, so a reader has to be told or has to guess. Deliver UTF-8: Matroska stores SRT text as UTF-8 and WebVTT requires it. For legacy files, convert from the known source encoding; FFmpeg’s
sub_charencoption exists to state the input subtitle encoding. If the encoding is unknown, ask the sender; a detected encoding is a guess, so check accented and non-Latin text after converting. - Treat styling and positioning as non-portable. The Library of Congress describes the HTML-derived bold, italic, underline, and color tags as dependent on the reader. FFmpeg parses optional
X1,X2,Y1,Y2coordinates on the timing line, but its decoder rescales them assuming a 720×480 frame, and Matroska keeps only a cue’s text and timing when SRT is muxed in.
When SRT Files matter
Use SRT to exchange captions or translations with players, editors, and platforms that accept it, and convert to WebVTT for HTML video, where the track element loads WebVTT files. A malformed timing line, a missing blank line between cues, or the wrong text encoding can make captions disappear, run together, or show garbled characters.
How Transloadit helps with SRT Files
Transloadit’s /video/subtitle Robot accepts SRT and VTT subtitle files and either adds them to a video as a separate, switchable stream or burns them into the picture, and the /speech/transcribe Robot can output its transcription as an srt or webvtt file.
The Robot documentation does not say how SRT styling tags or non-UTF-8 files are handled, and it marks its text color, border color, bold, and italic parameters as applying only to burned subtitles. Test representative styled and non-UTF-8 files in the mode you plan to use.
Explore Transloadit’s file formats & compression capabilities
Sources
- Library of Congress format description fdd000569: SubRip Subtitle format (SRT)
- Matroska: Subtitles (SRT Subtitles section)
- FFmpeg 8.0 libavformat/srtdec.c, lines 34–93: SRT probe and timing-line parsing
- FFmpeg 8.0 libavcodec/srtdec.c, lines 33–56: SubRip coordinates and markup conversion
- FFmpeg Codecs Documentation:
sub_charenccodec option - MDN: The track element (embed text track)
- W3C: WebVTT, The Web Video Text Tracks Format (section 4, Syntax)
- MDN: WebVTT file format (header, cue timings, character encoding)