SRT
37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0SubRip (.srt) is the lowest common denominator of subtitle formats: plain text with timestamps. Almost every player, editor and platform reads it, so it is the format of choice for sharing dialogue-only subtitles. It has no formal specification; behaviour beyond the basics varies between players.
Format
Section titled “Format”A file is a list of cues separated by blank lines. Each cue is a counter, a time range, and one or more lines of text:
100:00:01,000 --> 00:00:03,500The test begins here.
200:00:04,000 --> 00:00:07,000<i>[A steady tone sounds]</i>Check the picture and the sound together.Timestamps are HH:MM:SS,mmm with a comma before the milliseconds (WebVTT uses a period). Save as UTF-8, which is what modern tools write and expect.
Basic HTML-style tags are widely accepted: <i>, <b>, <u>, and <font color="#ffff00">. Players that do not understand a tag print it literally. Positioning ({\an8} for top-centre) is an ASS override that mpv, VLC and most desktop players honour inside SRT; players that do not know it show it as text. There is no way to set fonts, outlines or animation, so use ASS for typesetting and WebVTT for web players.
Because SRT times are in seconds, not frames, it is independent of the video’s frame rate. Fixing a constant offset is a one-liner; the delay is applied by FFmpeg as an input timestamp offset:
ffmpeg -itsoffset 2 -i subs.srt -c copy delayed.srtFor a drifting subtitle (a different cut or frame rate), use an editor such as Subtitle Edit or Aegisub, or an automatic aligner like ffsubsync.
Fix garbled characters
Section titled “Fix garbled characters”If accents or non-Latin letters show as é or ?, the file is in a legacy encoding. Find out which (file -i subs.srt guesses; the language usually tells you: CP1252 for Western European, CP1251 for Russian, CP1250 for Central European), then convert:
ffmpeg -sub_charenc CP1252 -i legacy.srt utf8.srticonv -f CP1252 -t UTF-8 legacy.srt > utf8.srt-sub_charenc is an input option, so it goes before -i.
Use SRT in containers
Section titled “Use SRT in containers”ffmpeg -i video.mkv -i subs.srt -map 0 -map 1 -c copy -metadata:s:s:0 language=eng output.mkvmkvmerge -o output.mkv video.mkv --language 0:eng subs.srtffmpeg -i video.mkv -i subs.srt -map 0 -map 1 -c copy -c:s mov_text output.mp4In Matroska SRT is stored as S_TEXT/UTF8 and round-trips cleanly. MP4 stores it as mov_text, which keeps basic italics, bold and underline but not much else. WebM takes only WebVTT, so convert first: ffmpeg -i subs.srt subs.vtt.
Extract a track back out with ffmpeg -i input.mkv -map 0:s:0 subs.srt.
Conversions
Section titled “Conversions”SRT to ASS or WebVTT keeps everything SRT has: text, italics and bold carry over. Going the other way, from a styled ASS file, loses everything ASS does and leaves FFmpeg’s leftovers (<font size="…"> wrappers, stray {\an8}); expect to clean up by hand. See the subtitle formats overview for the rest, including how to burn SRT into the picture.