
You have an .srt and a video, and something is off: lines missing, “jalapeño” showing up as “jalapeño”, every caption two seconds late, or an upload form that just says the file is invalid. This page is the checklist we now run before a caption file goes anywhere.
The short version from our tests: ffmpeg accepts almost anything you hand it. Period timestamps, duplicate numbers, missing blank lines, overlaps, even a cue whose end comes before its start all went through without a single warning. The one problem it complained about, a non-UTF-8 file, still finished with exit code 0 and quietly lost five of six cues. So “it converted fine” proves very little.
Test note: October 20, 2026, Asia/Shanghai. Debian GNU/Linux 13 (trixie), kernel 6.12.94, ffmpeg and ffprobe 7.1.5-0+deb13u1 (built with libass), GNU iconv from glibc 2.41. Sample: a 24-second 1280x720 test clip with a burned-in clock, plus a six-cue US-English SRT (430 bytes) and nine broken copies, each with one deliberate fault. Subtitle Edit did not launch on this machine, so there are no Subtitle Edit results here. The platforms named below were not uploaded to.
What a valid SRT cue looks like
This is cue 3 of our test file. Four parts, in this order, then a blank line:
3
00:00:07,000 --> 00:00:09,500
Order the jalapeño crêpe, Mr. Núñez.
- Index: a counter, starting at 1. Most tools ignore it; some validators don’t.
- Timing line:
HH:MM:SS,mmm --> HH:MM:SS,mmm. A comma before the milliseconds, not a period. That is the main visible difference from WebVTT. - Text: one or more lines. Plain text, with basic tags like
<i>tolerated by many players. - Blank line: ends the cue.
The format has no field for character encoding. Save it as UTF-8. Every encoding failure below goes back to that missing field.
Run a text check before anything else
We wrote a small shell script that catches every structural fault we planted. It needs only sh, iconv, grep, sed and awk. We ran it on Debian with GNU tools; on macOS the BSD sed may not understand the ï escapes in the BOM line, so install GNU sed or skip that line:
#!/bin/sh
# srtcheck.sh FILE.srt -- quick structural checks for an SRT file
f="$1"
printf 'first 3 bytes: '; head -c 3 "$f" | od -An -tx1
iconv -f UTF-8 -t UTF-8 "$f" >/dev/null 2>&1 && echo "utf-8: ok" || echo "utf-8: INVALID ($(iconv -f UTF-8 -t UTF-8 "$f" 2>&1 >/dev/null | tail -1))"
grep -nE '^[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3} -->' "$f" | sed 's/^/dot timestamp: line /'
grep -n '{\\' "$f" | sed 's/^/ASS tag: line /'
sed '1s/^\xEF\xBB\xBF//' "$f" | tr -d '\r' | awk -F' --> ' '
function t(x){gsub(/[,.]/,":",x); split(x,a,":"); return a[1]*3600+a[2]*60+a[3]+a[4]/1000}
/-->/ { if (NR>2 && p2!="") print "no blank line before cue at line " NR-1
s=t($1); e=t($2); n++
if (e<=s) print "end <= start: line " NR
if (n>1 && s<pe) print "overlap with previous cue: line " NR
if (p1 !~ /^[0-9]+$/) print "missing index: line " NR
else { if (p1+0 != n) print "index " p1 " where " n " expected: line " NR-1 }
pe=e }
{ p2=p1; p1=$0 }
END { print "cues: " n }'
Run it as sh srtcheck.sh captions.srt. On our broken set it reported:
| Planted fault | What the check printed |
|---|---|
| Period timestamps | 6 dot timestamp lines |
| Cue 3 runs into cue 4 | overlap with previous cue: line 14 |
| Indexes 1, 2, 2, 4, 7, 8 | index 2 where 3 expected, then 7 and 8 |
| Saved as Windows-1252 | utf-8: INVALID (iconv: illegal input sequence at position 117), the “é” in “Café” |
| UTF-8 with BOM | first bytes ef bb bf |
| No blank line before cue 4 | no blank line before cue at line 12 |
| Cue 4 end before start | end <= start: line 14 |
{\an8} on cue 1 | ASS tag: line 3 |
| All cues 2 s late | Nothing. Text checks can’t see sync. You need the picture. |
What ffmpeg does with each broken file
We ran every file three ways: ffmpeg -i x.srt x.vtt, a soft-subtitle mux into MP4 as mov_text, and a burn-in with the subtitles filter. The clean file gives 6 cues in WebVTT and 12 mov_text packets (6 cues plus 6 empty gap samples).
| Fault | Warning? | What actually came out |
|---|---|---|
| Period timestamps | None | All 6 cues, output identical in size to clean (390 bytes VTT) |
| Overlap | None | VTT keeps 00:07.000 --> 00:11.000 over the next cue; MP4 trims cue 3 to 3 s (11 packets) |
| Bad numbering | None | Ignored; 6 cues |
| Missing blank line | None | Parsed correctly; 6 cues, text intact |
| UTF-8 BOM | None | Handled; VTT starts 57 45 42 (“WEB”), no BOM |
| End before start | None | Cue 4 rewritten to 00:12.500 --> 00:13.000: wrong time, half a second long |
{\an8} tag | None | Stripped from VTT; honored in burn-in (line moves to the top) |
| +2 s offset | None | Converted faithfully, still late |
| Windows-1252 | Yes, 5 times | Exit 0. VTT is 70 bytes with 1 of 6 cues; MP4 has 2 packets. Burn-in fails outright (exit 183) |
The lenient parsing is good news for players built on ffmpeg. It is bad news if ffmpeg is your only check before a stricter destination like Vimeo, whose help center lists overlapping cues and end-before-start times as reasons for “Invalid Caption File.”
Accents turn into ñ, or whole lines disappear
What people report: Plex users see odd symbols around Spanish accents and ask how to force UTF-8 (r/PleX, another r/PleX thread). ffmpeg users paste the -sub_charenc warning into Stack Overflow.
Cause: the bytes were written in one encoding and read in another. There are two directions, and they look different:
- Legacy file read as UTF-8 (our Windows-1252 copy): ffmpeg drops every cue that contains a non-ASCII byte. Only cue 1, plain ASCII, survived. Cue 5 died over a single curly apostrophe.
- UTF-8 file read as Windows-1252 (forcing
charenc=CP1252on the clean file): you get classic mojibake on screen. Cue 4 was dropped with “Unable to recode subtitle event,” because its curly closing quote contains a byte Windows-1252 doesn’t define. The same mistake in a VTT conversion gave 5 cues out of 6, with “Café” and “you’re” in the text.

charenc=CP1252. Bottom: the Windows-1252 file burned with charenc=CP1252, which is correct. Crops of two real ffmpeg 7.1.5 frames, October 20, 2026.Check:
iconv -f UTF-8 -t UTF-8 captions.srt > /dev/null && echo "valid UTF-8"
# ours: iconv: illegal input sequence at position 117
Fix: convert once, keep the UTF-8 copy as the master. Guess the source encoding from the language: Windows-1252 for Western European text is the usual suspect.
iconv -f WINDOWS-1252 -t UTF-8 captions.srt > captions.utf8.srt
# or let ffmpeg decode it on the way in
ffmpeg -sub_charenc CP1252 -i captions.srt captions.vtt
Both worked here. The iconv output was byte-identical to our clean file (414 bytes in, 430 out, since accented letters take two bytes in UTF-8). The -sub_charenc route produced a VTT identical to the clean one, all 6 cues. Don’t add -sub_charenc to a file that is already UTF-8. That is exactly how the top line in the figure was made.
BOM: a UTF-8 BOM is three bytes (EF BB BF) at the start of the file. ffmpeg 7.1.5 handled ours cleanly. Not every tool does: one developer found the BOM stuck to the first cue number and broke their SRT-to-WebVTT conversion. To strip it:
sed '1s/^\xEF\xBB\xBF//' captions.srt > captions.nobom.srt # GNU sed
Ours went from 433 to 430 bytes, identical to the clean file. One Plex user reports the opposite: adding a BOM is what fixed their accents. Test the actual destination.
Captions show up early or late
What people report: a viewer fixes a two-second delay with the player’s offset, then watches it slide out again after 10 to 15 minutes (r/Stremio). Replies point at a frame-rate mismatch.
Tell the two cases apart before fixing anything. Check a line near the start and one near the end. Same error at both points means a constant offset, and one shift fixes it. A growing error is drift, and a shift won’t fix it. We only tested the constant case.


Fix a constant offset with ffmpeg:
# captions are 2 s late -> pull them 2 s earlier
ffmpeg -itsoffset -2 -i late.srt fixed.srt
Our first cue came back to 00:00:01,000 and every later cue lined up. For drift, you need a two-point or frame-rate retime in a subtitle editor. If the captions were made against an earlier cut, see fixing subtitle drift after audio edits.
Upload rejected: “Invalid caption file” and friends
What people report: Vimeo’s own troubleshooting page names three timing faults: a timing line split across lines, an end time earlier than the start, and a cue that starts at or before the previous cue’s end. Its file-type spec asks for a comma before milliseconds in SRT. We did not upload to Vimeo or YouTube. What follows is what the file looked like and how ffmpeg treated it.
Period timestamps (00:00:01.000, often pasted in from a VTT): ffmpeg read all 6 without comment. Fix:
sed -E 's/([0-9]{2}:[0-9]{2}:[0-9]{2})\.([0-9]{3})/\1,\2/g' in.srt > out.srt
Overlap (our cue 3 ended at 00:00:11,000, cue 4 started at 00:00:10,000): no warning. The VTT kept the overlap, and the MP4 track trimmed cue 3 from 4 s to 3 s. Two outputs from one input disagree, and nobody tells you. Fix by deciding where the line really ends; we set it back to 00:00:09,500.
End before start (00:00:12,500 --> 00:00:10,000): the nastiest one. ffmpeg turned it into a half-second cue from 12.500 to 13.000 in both VTT and MP4. In a burn-in frame at 11.000 s the screen was simply blank where the line should have been. Running the file through ffmpeg -i in.srt out.srt bakes that wrong timing in, and the result passes the structure check. Retime it by hand against the audio.
The subtitle track vanished after muxing into MP4
What people report: the standard VideoHelp answer is -c:s mov_text, and encode.wiki warns that default stream selection drops SRT quietly. We reproduced both failure modes with the clean file:
-map 0 -map 1 -c copy out.mp4: “Could not find tag for codec subrip in stream #2, codec not currently supported in container,” exit 234, and a 0-byte file left on disk.- No
-map,-c:v copy -c:a copy: exit 0, and the MP4 has only video and audio. The subtitle simply isn’t there.
What worked:
ffmpeg -i video.mp4 -i captions.srt -map 0 -map 1 \
-c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng out.mp4
# confirm the track exists
ffprobe -v error -count_packets -show_entries stream=index,codec_name,nb_read_packets out.mp4
Ours showed mov_text with 12 packets and language eng. If you need to keep the SRT exactly as-is, MKV takes it with plain -c copy (we got a subrip stream). Many players still need you to switch the track on.
The line jumps to the top, or the file won’t display at all
A Plex forum thread traced a non-displaying .srt to ASS override tags like {\an8} inside the text. These aren’t part of SRT. In our test, ffmpeg’s burn-in (libass) honored the tag and moved cue 1 to the top of the frame, while the VTT conversion silently threw it away. Same file, two different results.

{\an8} on cue 1, burned in with ffmpeg 7.1.5: the line renders at the top. The same tag was gone after ffmpeg -i x.srt x.vtt.If the destination is plain SRT or VTT, strip the tags: sed 's/{\\an[0-9]}//g' in.srt > out.srt. Our output matched the clean file byte for byte.
Numbering gaps and missing blank lines
ffmpeg didn’t care about either. Our 1, 2, 2, 4, 7, 8 file and our file with no blank line before cue 4 both came through as 6 correct cues. Stricter tools may merge or reject them, so clean them anyway. Either command works:
# renumber only
awk 'BEGIN{n=0} /^[0-9]+$/ && (NR==1 || prev=="") {print ++n; prev=$0; next} {print; prev=$0}' in.srt > out.srt
# or let ffmpeg rewrite it: renumbers, restores blank lines, commas in timestamps
ffmpeg -i in.srt out.srt
The awk version gave a byte-identical file. The ffmpeg rewrite added one trailing blank line, which is harmless. Just remember the earlier warning: the rewrite also carries overlaps through and locks in reversed timings.
Convert to WebVTT and verify it
ffmpeg -i captions.utf8.srt captions.vtt
head -1 captions.vtt # must be: WEBVTT
grep -c -- '-->' captions.srt captions.vtt # counts must match
grep -cE '^[0-9:]+\.[0-9]{3} --> [0-9:]+\.[0-9]{3}$' captions.vtt
ffprobe -v error -show_entries stream=codec_name -of csv=p=0 captions.vtt
On our fixed file: first line WEBVTT, 6 cues, 6 timing lines with dots, first bytes 57 45 42 (no BOM), and ffprobe reported webvtt. Two things surprised us. ffmpeg writes 00:01.000 with no hours field for times under an hour, which the WebVTT format allows. It also drops cue numbers. If a downstream tool insists on hours or IDs, check before you send.
The cue count is the line that matters most. It is the only thing that would have caught the Windows-1252 file, where ffmpeg “succeeded” with 1 cue out of 6.
For the timestamp-only version of this job, see fixing SRT timestamps before WebVTT.
Checklist download
SRT pre-upload checklist (Markdown) with the check script, the fix commands above, and the cue-count comparison.
FAQ
Why does ffmpeg finish without errors but my captions are missing?
On our Windows-1252 test file ffmpeg 7.1.5 printed the warning “Invalid UTF-8 in decoded subtitles text; maybe missing -sub_charenc option” five times, exited with code 0, and wrote a WebVTT file with 1 of 6 cues. Warnings scroll past easily. Count the arrows in the output file and compare with the source before you upload.
Does a UTF-8 BOM break an SRT file?
Not in ffmpeg 7.1.5: our BOM copy (433 bytes) produced all 6 cues, and the WebVTT it wrote started with the plain letters WEBVTT, no BOM. Other converters and players have tripped on it, so stripping the three bytes is cheap insurance. We did not test YouTube, Vimeo, Premiere or VLC.
Can I just run the SRT through ffmpeg to clean it up?
Partly. An SRT-to-SRT pass renumbered our 1, 2, 2, 4, 7, 8 file, switched period timestamps to commas, and restored a missing blank line. It kept an overlap as-is and turned a reversed cue into a half-second flash from 12.500 to 13.000, which then passed our structure check. Fix timing by ear, not by rewrite.
Should I convert SRT to VTT before uploading?
Only if the destination asks for WebVTT or rejects your SRT; Vimeo’s help center suggests it as a troubleshooting step. ffmpeg -i in.srt out.vtt gave us a WEBVTT header and dot timestamps, but it also silently dropped cue numbers and the {\an8} position tag, and it carried an overlap straight through.
Honest limits
- No uploads were made to YouTube, Vimeo, TikTok, Instagram or any other platform. The Vimeo rules above are quoted from its help center, not tested.
- Players not tested: VLC, Plex, QuickTime, browsers, Premiere Pro, DaVinci Resolve.
- Subtitle Edit 5.3.0 failed to launch on this headless box (exit 0, blank screen, two attempts). No GUI results.
- Only a constant +2 s offset was tested. Frame-rate drift was not reproduced.
- Not covered: CRLF line endings, UTF-16 files, non-Latin scripts beyond accented Latin, and files longer than our 24-second clip.
- All behavior is ffmpeg 7.1.5 on Debian. Other builds, or apps that embed their own parser, may be stricter or looser.
Test basis: commands, raw stderr, probe output and frames from October 20, 2026. Every test number on this page comes from those logs; the forum details are paraphrased from the linked threads. The cover and the frames inside the article are crops of those real ffmpeg frames.