syncsub is a small command-line tool to fix .srt subtitles that start in sync and slowly drift out of sync later in the movie.
You give it two reference points:
- the real video timestamp when a specific line is spoken, and
- the current timestamp of that same line in the
.srt
(one pair near the start, one pair near the end)
syncsub calculates both the global delay and the playback speed drift, then rewrites the entire .srt so subtitles stay aligned from start to finish.
The original file is backed up automatically as yourfile.srt.bak.
A simple delay (for example “shift everything by +16 seconds”) only fixes the beginning.
But often the subtitle file was synced to a slightly different encode or source (different intro, different frame pacing, etc.), so by 1h20m the lines are several seconds off. That’s drift.
syncsub fixes that by applying a linear correction:
new_time = A + B * old_time
where:
Ais the offsetBis the speed factor
A and B are computed from the two sync points you give it.
- macOS or Linux shell
- Python 3 available as
python3 - A plain
.srtsubtitle file
No pip install needed.
No extra modules.
This does not edit subs embedded inside .mkv or .mp4 containers — it edits standalone .srt files.
Clone the repo and make the script executable:
git clone https://github.com/nu-vi/syncsub
cd syncsub
chmod +x syncsubOptionally put the syncsub on your PATH so you can call syncsub from anywhere.
syncsub -h
syncsub --helpsyncsub -v
syncsub --versionsyncsub SUBFILE V1 S1 V2 S2Where:
-
SUBFILE
Path to the.srtyou want to fix.
The script will:- create
SUBFILE.bak - then overwrite
SUBFILEin-place with corrected timestamps
- create
-
V1
Correct video timestamp (what you see in the player) for a line near the start.
Example:00:01:14,777
This is when the actor actually says the line in the movie. -
S1
Current subtitle timestamp for that exact same spoken line, taken from the.srtbefore fixing.
Example:00:00:58,777 -
V2
Correct video timestamp of a line near the end of the movie.
Example:01:25:30,500 -
S2
Current subtitle timestamp for that same late line in the.srt.
Example:01:25:20,214
Timestamps can use comma or dot for milliseconds (00:01:14,777 or 00:01:14.777).
Hour can be 0X: or X: — both work.
syncsub "example.srt" 00:01:14,777 00:00:58,777 01:25:30,500 01:25:20,214What happens:
syncsubcalculates a linear correction so that:S1→V1S2→V2
- It rewrites every timestamp in the
.srtusing that mapping. - It saves a backup
...srt.bakbefore writing.
You only need to collect these four timestamps once per movie:
-
Play the movie in your player.
-
Pick a clear spoken line near the start.
- Pause exactly when the actor says it.
- Note the movie time on screen → this is
V1.
-
Open the
.srtin a text editor, find that exact line, and note its timestamp → this isS1. -
Do the same thing again for a line near the end of the movie.
- Movie time →
V2 - Subtitle time in the file →
S2
- Movie time →
Then pass those four timestamps to syncsub.
If the subtitle file is from the same cut (no missing scenes or extra scenes), this usually makes the whole movie sync properly from start to end.
-
This assumes linear drift.
If your subtitle is actually from a different cut with added/removed scenes, then the drift is not smooth — there’s a jump.
One single transform can’t fix a jump in the middle. In that case you’d split the.srtaround that jump and runsyncsubtwice (start→jump, jump→end). -
Only
.srt.
Formats like ASS/SSA aren’t supported yet. Embedded subs inside .mkv are not processed directly. -
It overwrites the file in place.
It does createfile.srt.bak, but after that, you’re responsible for keeping backups.
Version: 1.0.0
syncsub is a tiny CLI utility meant for personal use.
Pull requests are welcome if they keep it simple and keep the zero-dependency approach.