SRT File: What It Is, How to Edit It, and How to Add Subtitles to Video
What Is an SRT File?
An SRT file is a plain-text subtitle file. It lists each subtitle as a numbered block with a start time, an end time and the text, and a video player reads it alongside the video to show captions at the right moments. The name comes from SubRip, a free Windows program from around 2000 that ripped subtitles off DVDs. It's now the most widely supported subtitle format: VLC, IINA, YouTube, Vimeo, Premiere Pro, DaVinci Resolve and Plex all read it.
Three things to know up front:
- An SRT file contains no video. The player has to load it next to the video, or you put it inside the video file.
- The format is strict about a few details. A comma before the milliseconds, an arrow made of two hyphens and
>, and a blank line between subtitles. - There's no official specification. Players differ on encoding, formatting tags and positioning. This guide notes where.
Every FFmpeg command below was run on a generated test video and SRT file.
SRT File Format: The Exact Structure
Here's a valid SRT file with three subtitles (cues):
1
00:00:01,000 --> 00:00:03,500
Hello, this is the <i>first</i> subtitle.
2
00:00:04,000 --> 00:00:06,000
<b>Bold line</b>
Second line of cue two.
3
00:00:07,000 --> 00:00:09,500
Café, naïve, 日本語 test
| Part | Example | Rules |
|---|---|---|
| Index | 2 | A counter starting at 1, in order. |
| Timing line | 00:00:04,000 --> 00:00:06,000 | HH:MM:SS,mmm with a comma before the milliseconds, then space, -->, space. |
| Text | Second line of cue two. | One or more lines; two is the practical limit. |
| Blank line | Ends the cue. Without it, two cues merge. |
The mistakes that break SRT files:
- A dot instead of a comma (
00:00:04.000). That's WebVTT syntax. FFmpeg accepted our dotted test file, but stricter software may not. - A long dash in the arrow. Some guides print the arrow as
-–>, and word processors turn--into—. Use two plain hyphens and>. - Missing hours (
00:04,000). Also VTT syntax. SRT needsHH:. - Saving as rich text. An
.srtthat's secretly RTF starts with formatting codes instead of1.
Netflix's timed-text guides allow 42 characters per line and two lines per subtitle for most Latin-alphabet languages. That's a readability guideline; the format itself has no limit.
Formatting tags: which ones work where
SRT borrowed a few unofficial HTML-style tags:
| Tag | VLC / IINA | MP4 track (mov_text) | Converted to VTT | YouTube |
|---|---|---|---|---|
<i>, <b>, <u> | Usually shown | Kept | Kept | Ignored |
<font color="#ffff00"> | Often shown | Dropped | Dropped | Ignored |
{\an8} (move to top) | Shown in many players | Dropped | Dropped | Ignored |
The MP4 and VTT columns come from converting our test file with FFmpeg 9.1. YouTube's supported-formats page says it handles only basic SRT and recognizes no style markup, despite guides that suggest <b> for YouTube captions. If styling must survive everywhere, burn the subtitles in.
SRT File Encoding: UTF-8, BOM and Garbled Characters
An SRT file doesn't declare its character encoding, so the player guesses. Old SubRip files were usually Windows-1252, newer tools write UTF-8, and a wrong guess looks like this:
| What you see | What happened | Fix |
|---|---|---|
Café instead of Café | UTF-8 file read as Windows-1252 | Set the player's subtitle encoding to UTF-8 |
Caf? or boxes | Legacy-encoded file read as UTF-8 | Convert the file to UTF-8 |
Stray  before the first 1 | A UTF-8 BOM the software didn't expect | Save as UTF-8 without BOM |
Use UTF-8. YouTube requires it, FFmpeg expects it, and every modern player reads it. Check a file with file:
file subs.srt
# subs.srt: Unicode text, UTF-8 text
# latin1.srt: ISO-8859 text <- legacy encoding, convert it
# bom.srt: Unicode text, UTF-8 (with BOM) text
Convert with the iconv tool built into macOS (use CP1251 for Cyrillic, GB18030 for Chinese, SHIFT_JIS for Japanese):
iconv -f WINDOWS-1252 -t UTF-8 latin1.srt > fixed.srt
FFmpeg refuses non-UTF-8 subtitles. Our Windows-1252 test file failed with "Invalid UTF-8 in decoded subtitles text; maybe missing -sub_charenc option". Naming the encoding fixed it:
ffmpeg -sub_charenc CP1252 -i latin1.srt fixed.srt
FFmpeg read a BOM without trouble. If an older TV or editor shows , strip it:
sed $'1s/^\xEF\xBB\xBF//' bom.srt > nobom.srt
How to Open, Create and Edit an SRT File on a Mac
Double-clicking won't open a text editor
macOS doesn't register a file type for .srt. On our test Mac, Finder sent SRT files to VLC, which tries to play them; without a player that claims the extension, Finder asks you to pick an app. To edit the text, Control-click the file, choose Open With > Other… and pick TextEdit or a code editor.
TextEdit: three traps
- New documents are rich text. Choose Format > Make Plain Text (Shift-Command-T) first, or set TextEdit > Settings > New Document to Plain text.
- Saving can add
.txt. Type the full name, such asmovie.srt. If the save dialog shows If no extension is provided, use ".txt", untick it, and choose Use .srt if asked. Set Plain Text Encoding to Unicode (UTF-8). - Smart Dashes can break the arrow. If Edit > Substitutions > Smart Dashes is on, typing
-->can become a long dash. Turn it off.
A code editor for bigger edits
VS Code, BBEdit, Sublime Text and Zed save plain UTF-8, show the encoding in the status bar and support regex find-and-replace, which helps with bulk fixes like dots in timestamps.
A subtitle editor for timing
A subtitle editor shows the video and an audio waveform, sets in and out points from playback, flags overlaps and long lines, and always saves valid SRT:
- Subtitle Edit (free). Version 5 runs on macOS 12 and later, bundles FFmpeg and mpv, and adds sync tools, spell check and Whisper-based transcription.
- Aegisub (free). Built around the ASS format, but imports SRT and exports it via File > Export Subtitles. Mac builds are on the TypesettingTools GitHub page.
How to Play a Video With an SRT File
| Player | Load external SRT | Auto-loads same-name file | Notes |
|---|---|---|---|
| VLC (free) | Subtitles > Add Subtitle File… | Yes | Also checks Subs and Subtitles folders next to the video |
| IINA (free) | Subtitles > Load External Subtitle…, or drag it onto the window | Yes (Auto Load in Settings > Subtitle) | Two subtitle tracks at once; Find Online Subtitles… |
| QuickTime Player | No | No | Shows only subtitle tracks inside an MP4 or MOV |
Checked on VLC 3.0.24 and IINA 1.5.0. Name the SRT like the video (holiday.mp4, holiday.srt); suffixes like holiday.en.srt also work in VLC, IINA, Plex and Jellyfin.
QuickTime Player can't open an SRT file or an MKV, but it shows text subtitle tracks inside MP4 and MOV files under View > Subtitles. When we added our SRT to an MP4 as a mov_text track (command below), Apple's AVFoundation framework, which QuickTime Player uses, listed it as an English subtitle option. The MKV and the bare SRT wouldn't open. For QuickTime viewers, put the subtitles in an MP4.
How to Add Subtitles to a Video: Soft vs Burned-In
| Soft subtitles (a track in the file) | Burned-in (hardcoded) subtitles | |
|---|---|---|
| Viewer can turn them off | Yes | No |
| Several languages in one file | Yes | One per video |
| Re-encodes the video | No, takes seconds | Yes |
| Quality loss | None | One generation |
| Style controlled by | The player | You |
| Shows on social apps and every player | No | Yes |
Use soft subtitles for films, courses and archives. Burn them in for Instagram, TikTok, ads and anywhere subtitle support is uncertain.
Add an SRT file to an MKV
MKV stores SRT as-is. This copies the video and audio untouched:
ffmpeg -i video.mp4 -i subs.srt -map 0 -map 1 -c copy -c:s srt \
-metadata:s:s:0 language=eng output.mkv
-map 0 -map 1 keeps every track from both inputs; without it, FFmpeg picks streams itself and can leave the subtitles out. Not sure which container you need? See MKV vs MP4.
Add an SRT file to an MP4
MP4 can't hold SRT. Its text subtitle format is mov_text (3GPP Timed Text, or tx3g), so convert on the way in:
ffmpeg -i video.mp4 -i subs.srt -map 0 -map 1 -c copy -c:s mov_text \
-metadata:s:s:0 language=eng output.mp4
With plain -c copy, FFmpeg fails with "Could not find tag for codec subrip in stream #2, codec not currently supported in container" and leaves a 0-byte file, the most common SRT-to-MP4 error. The same option works for MOV. mov_text keeps bold, italic and underline but drops colors and positions.
Several languages
One input and one -map per SRT file:
ffmpeg -i video.mp4 -i subs.en.srt -i subs.es.srt \
-map 0 -map 1 -map 2 -c copy -c:s srt \
-metadata:s:s:0 language=eng -metadata:s:s:1 language=spa \
-disposition:s:0 default output.mkv
-disposition:s:0 default makes English the track players turn on. Use -c:s mov_text for MP4. Both versions produced correctly tagged tracks in our test.
Burn subtitles into the video
FFmpeg's subtitles filter draws the text onto the frames and re-encodes the video:
ffmpeg -i video.mp4 -vf "subtitles=subs.srt:force_style='FontSize=24'" \
-c:v libx264 -crf 20 -c:a copy burned.mp4
Check your FFmpeg first. The filter exists only in builds with libass:
ffmpeg -hide_banner -filters | grep subtitles
No output means no filter. That's the case with Homebrew's standard ffmpeg formula, which we tested at version 9.1, so we couldn't run the burn-in command. On that build it fails with a confusing "No option name near 'subs.srt'"; writing subtitles=filename=subs.srt gives the clearer "No such filter: 'subtitles'". Guides that present the filter as standard assume a fuller build. Homebrew's ffmpeg-full formula includes libass; it's keg-only, so run it as $(brew --prefix ffmpeg-full)/bin/ffmpeg (not installed or tested here).
Without Terminal, use HandBrake: in the Subtitles tab, import the SRT and tick Burn In (not tested here). Our HandBrake guide covers the other settings, and the usual video encoding trade-offs apply because it's a full re-encode.
Extract an SRT from a video
ffmpeg -i input.mkv -map 0:s:0 subs.srt
This works for MKV text tracks and MP4 mov_text tracks. Image-based subtitles (Blu-ray PGS, DVD VobSub) are pictures and need OCR in Subtitle Edit. For whole-file conversions, see MKV to MP4 and TS to MP4.
How to Upload an SRT File to YouTube
YouTube takes the SRT as a separate file, so viewers can switch captions on and off:
- In YouTube Studio, click Subtitles in the left menu and select the video.
- Click Add language and choose the language.
- Under Subtitles, click Add, then Upload file.
- Choose With timing, click Continue, select the
.srtfile and click Save.
For a transcript without timestamps, choose Without timing or use Auto-sync, which YouTube doesn't recommend for videos over an hour or with poor audio. Upload plain UTF-8 without tags. For Shorts or Instagram copies, burn the subtitles in. For the video itself, see how to compress video for YouTube and the best video format for YouTube.
SRT vs VTT
WebVTT began as "WebSRT" for the HTML5 <track> element, so the formats look nearly identical:
| SRT | WebVTT (.vtt) | |
|---|---|---|
| Header | None | WEBVTT on the first line |
| Timestamp | 00:00:01,000 (comma, hours required) | 00:01.000 (dot, hours optional) |
| Cue numbers | Required | Optional |
| Styling | Unofficial <b>, <i>, <u>, <font> | <b>, <i>, <u>, classes, CSS via ::cue |
| Positioning | Unofficial | Cue settings (line, position, align) |
Browser <track> | Not supported | Required |
| Desktop players, TVs, editors | Near-universal | Wide, but behind SRT |
Use SRT for files, players and editors. Use VTT for HTML5 video on a website, HLS streams (see M3U8 to MP4) and alongside WebM video. Converting is one command each way:
ffmpeg -i subs.srt subs.vtt
ffmpeg -i subs.vtt subs.srt
In our test FFmpeg added the header, switched to dots, dropped cue numbers and left out the hours on this short file. It kept bold and italic but removed <font color> and {\an8}, and converting back didn't restore them.
How to Fix Out-of-Sync SRT Timing
- Every subtitle is off by the same amount: the SRT was timed for a different cut or the video was trimmed. A constant shift fixes it.
- Subtitles drift further off over time: usually a frame-rate mismatch, such as a 25 fps SRT on a 23.976 fps video. A shift won't fix it.
While watching
In VLC on a Mac, J shows subtitles later and H earlier, in 50 ms steps (VLC's default subtitle delay hotkeys). IINA has a subtitle delay control in its quick settings sidebar, plus key bindings listed under Settings > Key Bindings. Note the offset, then fix the file.
Shift the whole file with FFmpeg
Make every subtitle appear 2 seconds later:
ffmpeg -itsoffset 2 -i subs.srt -c copy fixed.srt
In our test every cue moved by exactly 2 seconds. You can also shift while adding the subtitles to a video:
ffmpeg -i video.mp4 -itsoffset 1.5 -i subs.srt -map 0 -map 1 -c copy -c:s srt output.mkv
Shifting earlier has a catch most guides miss. A negative offset only works if it's smaller than the first cue's start time. With -itsoffset -0.5, our first cue moved from 1.0 s to 0.5 s and the rest followed. With -itsoffset -1.5, FFmpeg clamped the first cue to zero and shifted the whole file by only 1 second, so the 4.0 s cue landed at 3.0 s instead of 2.5 s. For bigger shifts earlier, use a subtitle editor, or delete or retime the first cue before shifting.
Drift: use a subtitle editor
Subtitle Edit can shift all or selected cues, change the frame rate, and point-sync: match a cue near the start and one near the end, and it stretches everything between them.
Does Compresto Keep Subtitles?
No, and it's worth being clear about it. Compresto compresses video with FFmpeg and maps the video and audio tracks explicitly, so with default settings an MP4, MOV or MKV comes out with video and audio only. Embedded subtitle tracks aren't carried over. Compresto can't add an SRT file or burn subtitles in, and it doesn't open .srt files.
Because SRT files are small and separate, the workaround is simple:
- Sidecar SRT: compress the video with Compresto and give the SRT the same name as the compressed file.
- Embedded subtitles: compress, then copy the subtitle tracks back from the original without re-encoding anything:
ffmpeg -i compressed.mp4 -i original.mkv -map 0:v -map 0:a -map 1:s \
-c copy -c:s mov_text final.mp4
On our two-language test MKV, both tracks came back with their language tags. Use -c:s srt and an .mkv output to keep SRT.
- Burned-in subtitles: burn them in first, then compress. The text is part of the picture, so it survives compression.
Compresto handles the size step: H.264 or HEVC re-encoding, batch processing and a target file size for upload limits, all locally on your Mac. Prefer the command line? See how to compress video with FFmpeg.
Frequently Asked Questions
What is an SRT file?
An SRT file is a plain-text subtitle file in the SubRip format. Each subtitle is a numbered block with a start and end time written as HH:MM:SS,mmm --> HH:MM:SS,mmm, the text, and a blank line. It contains no video or audio, so a player loads it alongside the video, or you add it to the video file.
How do I open an SRT file on a Mac?
To edit it, Control-click the file, choose Open With > Other and pick TextEdit or a code editor. macOS has no built-in file type for .srt, so double-clicking opens a player that claims it, such as VLC, or asks you to choose an app. To watch it with a video, use VLC or IINA, which load a same-name SRT automatically. QuickTime Player can't load an external SRT file.
How do I add an SRT file to a video permanently?
Either add it as a soft subtitle track that viewers can turn off, with FFmpeg's -c copy -c:s srt for MKV or -c copy -c:s mov_text for MP4, which takes seconds and doesn't re-encode the video. Or burn it into the picture with FFmpeg's subtitles filter or HandBrake's Burn In option, which re-encodes the video and can't be turned off.
Why does my SRT file show strange characters like é instead of é?
The file and the player disagree about the text encoding. é is a UTF-8 é read as Windows-1252; question marks or boxes usually mean a Windows-1252 file read as UTF-8. Convert the file to UTF-8, for example with iconv -f WINDOWS-1252 -t UTF-8 old.srt > new.srt in Terminal, or save it as UTF-8 from a subtitle editor.
What is the difference between SRT and VTT?
WebVTT (.vtt) is the web's subtitle format: it starts with a WEBVTT header, uses a dot before the milliseconds instead of a comma, makes cue numbers optional and supports positioning and CSS styling. SRT is simpler and better supported by desktop players, TVs and editors, while browsers' HTML5 <track> element needs VTT. FFmpeg converts with ffmpeg -i subs.srt subs.vtt.
How do I fix SRT subtitles that are out of sync?
While watching, change the subtitle delay: J and H in VLC on a Mac, or the subtitle delay control in IINA. To fix the file, run ffmpeg -itsoffset 2 -i subs.srt -c copy fixed.srt to make every cue 2 seconds later, or use Subtitle Edit's sync tools. Subtitles that drift further off over time need a frame-rate or point-sync fix in a subtitle editor.
The Short Version
An SRT file is plain text: an index, a HH:MM:SS,mmm --> HH:MM:SS,mmm timing line with a comma, the text and a blank line. Save it as plain UTF-8. Play it in VLC or IINA with the same name as the video; QuickTime can't load it. Add it as a soft track with -c:s srt (MKV) or -c:s mov_text (MP4), and burn it in only when it must show everywhere, after checking your FFmpeg has the subtitles filter. Upload SRT to YouTube separately, convert to VTT for the web, and use -itsoffset for delays but a subtitle editor for big shifts earlier or drift.