To fix SRT subtitle drift on Mac, measure the correct video time for one cue near the beginning and another near the end. Use those two correspondences to scale and shift every original timestamp into a new SRT file. Check an independent middle cue against the video before relying on the correction. One adjustment is suitable when the timing error changes smoothly throughout the same edit.
Determine whether the subtitles drift or simply start late
Use the final video and a copy of the original caption file. Choose two spoken phrases or events you can identify both in the SRT and by replaying the audio. A distinct sentence onset sounds easier to recheck than a long passage spoken at one level. A known title change can provide a useful visual landmark if it genuinely corresponds to the cue. Record the supplied cue start and the playback time where that same cue should start.
Compare the two errors separately. Suppose a cue currently at ten seconds should start at twelve seconds, and a later cue currently at seventy seconds should start at seventy-five. The correction grows from two to five seconds. A constant shift of two seconds would align the first cue and leave the later cue three seconds early. A proportional correction can align both when the mismatch grows evenly.
If both cues need nearly the same shift, a simple offset may fit. If many cues align on one side of a cut and suddenly jump on the other side, the video edits may differ. Use captions regenerated from the exact cut, or repair sections independently where you can establish the proper mapping. A model connecting two points can always make those two anchors line up. The independent third check tells you whether it works between them.
Measure two anchors and reserve a third
Pick start times far enough apart to make the timing change visible. In a short clip, choose the first and last clear phrases you actually need covered. In a long recording, avoid using two points just a few seconds apart when you intend to correct the whole recording. Use the same timestamp scale for the source and the player. Write the four measured numbers next to their corresponding words.
For a worked example, use 00:00:10,000 → 00:00:12,000 and 00:01:10,000 → 00:01:15,000. Each pair describes the same phrase before and after correction. The source anchors are sixty seconds apart. The video anchors are sixty-three seconds apart. Dividing the later span by the original span gives a scale of 1.05. An old cue at forty seconds should move to 43.500 seconds because it lies halfway between the source anchors. The target halfway point is halfway between twelve and seventy-five seconds.
Reserve the middle cue as your independent check. Use another actual event near the middle of your final media and record its playback position without using it to choose the scale. For the worked example, the model predicts 43.500 seconds at the old forty-second cue. If a real video places that event considerably away from the prediction, investigate the edit or the measurement. Decide on a tolerance appropriate for the recipient and method. A displayed clock with whole seconds can support only a coarser check than frame-accurate playback.
Write the transformed timestamps to a new SRT
The source is a plain SubRip file with millisecond timestamps. This example uses Python 3 and standard-library integer fractions to retain exact scale calculations until it rounds to milliseconds. Save the script as retime_srt.py. It handles conventional SubRip cue blocks, preserves cue indices and text, and raises an error if any transformed cue begins before zero or loses a positive duration. This is a deliberate stop so you can inspect which part would fall outside the new timeline. Library of Congress SubRip format profile · Python’s Fraction arithmetic
import re
import sys
from fractions import Fraction
from pathlib import Path
STAMP = r"[0-9]{2,}:[0-5][0-9]:[0-5][0-9],[0-9]{3}"
TIMING = re.compile(rf"({STAMP})[ \t]+-->[ \t]+({STAMP})")
def milliseconds(value):
if not re.fullmatch(STAMP, value):
raise ValueError(f"Invalid SRT time: {value!r}")
hours, minutes, seconds, ms = map(int, re.split("[:,]", value))
return ((hours * 60 + minutes) * 60 + seconds) * 1000 + ms
def srt_time(value):
if value < 0:
raise ValueError("A corrected time is before the start of the video")
seconds, ms = divmod(value, 1000)
minutes, seconds = divmod(seconds, 60)
hours, minutes = divmod(minutes, 60)
return f"{hours:02}:{minutes:02}:{seconds:02},{ms:03}"
def main():
if len(sys.argv) != 7:
raise SystemExit("Usage: retime_srt.py INPUT OUTPUT OLD1 NEW1 OLD2 NEW2")
source, target = map(Path, sys.argv[1:3])
old1, new1, old2, new2 = map(milliseconds, sys.argv[3:])
if old1 >= old2 or new1 >= new2:
raise ValueError("Anchors must be chronological")
scale = Fraction(new2 - new1, old2 - old1)
blocks = re.split(r"\n[ \t]*\n+", source.read_text(encoding="utf-8-sig").strip())
result = []
for block in blocks:
lines = block.splitlines()
match = TIMING.fullmatch(lines[1]) if len(lines) >= 3 else None
if match is None or not lines[0].isdigit():
raise ValueError(f"Malformed cue: {lines[:2]!r}")
start, end = map(milliseconds, match.groups())
if start >= end:
raise ValueError(f"Invalid cue duration: {lines[0]}")
start, end = (round(new1 + (t - old1) * scale) for t in (start, end))
if start < 0 or start >= end:
raise ValueError(f"Inspect corrected cue timing before writing: {lines[0]}")
lines[1] = f"{srt_time(start)} --> {srt_time(end)}"
result.append("\n".join(lines))
with target.open("x", encoding="utf-8") as file:
file.write("\n\n".join(result) + "\n")
print(f"Wrote {len(result)} cues at scale {float(scale):.6f}")
if __name__ == "__main__":
main()
Run it with the example’s four times, or substitute your actual anchors in the same order. Use a new destination name. The script uses exclusive creation so an existing file remains available. An error before the write indicates that the input or corrected cues need attention.
python3 retime_srt.py "workshop-original.srt" "workshop-retimed.srt" \
00:00:10,000 00:00:12,000 00:01:10,000 00:01:15,000
Review the printed count and compare it with the expected cue count. Inspect the first and last blocks to confirm that their original text is present. The same equation transforms both the start and end of every interval. At a scale of 1.05, a four-second cue becomes 4.2 seconds before rounding. If the original cue intervals already had overlaps, the transformation can preserve translated overlaps. Review any overlaps that remain in the retimed file using the receiving player’s actual behavior.
Check actual playback at more than the anchors
Load the new SRT as an external subtitle file in a player supporting SubRip, with the intended media. Verify the two measured anchors and the middle point you kept separate. Then watch passages before the earliest and after the latest anchor. Those times use the same scale outside the range where you measured it. A correct result at the anchor boundaries does not establish that the extrapolation remains accurate across an unrelated introduction, omitted segment, or outro.
Check the last cue against the end of the media. The script does not read the video duration. A cue that extends past the ending may need manual adjustment or a different mapping. For a large correction, inspect at least one quiet passage and one dense two-speaker passage for readable duration. Changes in the time scale can alter the amount of time viewers have for the same text. Keep the correct wording while adjusting any problematic cue duration deliberately.
If the middle point fails, measure a fourth point close to the suspected change. An isolated offset after a cut differs from an evenly growing error. Compare the spoken phrases and picture before committing to a correction. If the subtitles and video are from different versions, move back to the matching inputs while both originals are still available. Regenerating the track from the final export may give you a cleaner base than applying successive corrections.
Keep a small timing record with the delivery
Record the source and output filenames, the names or words of the two anchors, the four times, and the result from an independent checkpoint. Note any cue you corrected manually after the script. If another editor changes the video, ask them to use that record to check whether the changed edit needs a fresh subtitle version. Keep the unchanged files separately so the same correction can be repeated with revised measurements.
If you need a format change after retiming, work from the retimed SRT that passed playback and verify the result again after conversion. Format success and timing success concern the same caption track in different ways. For a web player requiring WebVTT, convert the checked SRT to WebVTT on the Mac and check that the approved moments still line up on that player.
Prepare a compact timing rehearsal
A reproducible test file can contain three cues with old starts at ten, forty, and seventy seconds. Set each of their ends exactly two seconds later. Use a distinct sentence such as Prepare the stand, Set the distance, and Read the marker. The three old intervals are 10.000 to 12.000, 40.000 to 42.000, and 70.000 to 72.000 seconds. After applying the example mapping, their starts should be 12.000, 43.500, and 75.000 seconds. Their ends should be 14.100, 45.600, and 77.100 seconds. Compare the saved output against all six expected endpoints and confirm each phrase is unchanged. These calculated expectations apply to the example’s specific anchors and sample cues.
The test is more useful if you also try a scale of one. Set the original anchors at ten and seventy seconds and the new anchors at twelve and seventy-two seconds. The span is still sixty seconds, so the common shift is two seconds. The middle cue now starts at forty-two seconds and ends at forty-four. Comparing the two results shows which parts of the correction follow a change in speed and which follow a common shift. Use new filenames to keep the two experiments distinguishable.
To test an error path, use a small cue that would be mapped before the video begins and anchors that shift the track earlier. The script should report that the affected cue requires inspection. A negative mapped time usually means the corrected cue would start before the first available frame. Decide how to handle that particular utterance only after listening to the start of the revised video. The appearance of clipped speech can indicate that the caption file includes an opening that is no longer present in the final export.
Resolve correction that fails between the anchors
If the first measured cue appears correct and the last appears correct, but the middle fails by several seconds, check for timeline changes. A removed passage can leave the later subtitles consistently displaced as soon as the edit is reached. A newly inserted title can move a single block. In either case, draw a short list of observed differences before altering more cues. Listen to adjacent words on either side of the suspected edit and map them to the original file. Use the gaps in the matching words to determine whether a whole spoken section was added or removed.
For a project exported from an editor, compare the exact media duration and opening frame before reopening the old edit. A media filename shared across versions gives you weak evidence about which file is current. Spot the first unique frame or the last phrase of each version instead. Once you find the video that matches the original SRT, use it as a reference for the edits that changed timing. A coherent retiming requires the current video and original cue times to refer to the same speech sequence.
Consider your measurement uncertainty. A rounded playback time near forty seconds could represent a cue beginning at thirty-nine and a half seconds or a little later than forty seconds. A consistent visual method, such as repeated playback just around each phrase, makes errors easier to compare. When a project needs frame-level placement, measure it in an editor that exposes the relevant frames and record the result in the SRT’s millisecond format. A stopwatch or a rounded player display may be sufficient for a practice clip and inadequate for formal caption delivery.
Keep one copy of the output that passed the measured checks. If you retime for a version with an additional edit, maintain both versions separately and note the new measurements. This avoids applying a correction twice to a track you already retimed.
Read the signed errors before choosing a correction
Write down the old subtitle start and the intended start for several short, distinct phrases. Subtract the old time from the intended time for each. A positive result means that cue needs to move later. A negative result means it needs to move earlier. For example, old starts at 10.000, 70.000, and 130.000 seconds and intended starts at 11.250, 71.220, and 131.270 give errors of 1.250, 1.220, and 1.270 seconds. The spread is fifty milliseconds, while the common shift is close to 1.25 seconds. Compare that spread against the precision of your measurements. If you took the times from repeated ordinary playback, much of the small difference can correspond to the point at which you decided the word begins.
A different example uses the same old times and new starts of 11.000, 71.600, and 132.200. The differences are 1.000, 1.600, and 2.200 seconds. They increase by six tenths across each minute. An initial one-second correction alone would leave the last cue 1.200 seconds early. Using the first and last as anchors gives a new span of 121.200 seconds from an original 120.000, so the time scale is 1.01. The middle cue’s expected new start is 71.600. Keep that as an independent measurement if you are using the outer two positions in the script.
Make the comparisons relative to the intended beginning of a line. The appearance of a title or action is a valid anchor only if it corresponds to the particular caption event you are correcting. A quiet breath, drum hit, or repeated phrase can be awkward to locate consistently. A distinctive consonant or visual event tied to a caption gives you a reference you can check again. Keep the measured frame or moment and a short description, so someone else with the same file can distinguish two similar phrases.
A useful decision depends on more than the sign at the beginning or end. If a project requires tolerance within a frame, use an editor with an accurate timebase and measure complete events precisely. If you only use a player with whole seconds visible, record that the measurements are approximate and judge obvious errors first. Longer separation between the anchors improves your ability to recognize a real time-scale mismatch, provided the sequence between them has no independent edits.
Recognize a single cut before applying a global scale
Take a practice SRT with cues at 10, 35, 50, 72, and 90 seconds. In a new cut, the same confirmed phrases at 10, 35, 72, and 90 from the original play at 10, 35, 67, and 85 seconds, while the phrase at 50 no longer exists. The first two errors are zero, and the last two are minus five seconds. A global scale fitted to 10 and 90 seconds predicts about 33.438 for the 35-second cue. That is wrong by more than a second even though both chosen endpoints fit. The jump in error indicates a likely cut. Verify which section was removed using the recorded words or the edit timeline.
Once you confirm the edit and know which cues belong in the new cut, work from a copy of the subtitle track. Preserve cues known to occur before the cut. Remove the cue only if the corresponding words really are absent from the new video. Move the matching post-cut cues earlier by the measured offset. For a small number of cues, it is easy to do this in the editor with both media versions visible. If using the script for a longer confirmed group, first copy that group to a separate valid SRT, apply two anchors with the same offset, then combine it with the confirmed preceding group and restore sequential cue numbering for the delivery copy.
Watch the transition in the new video. A cue that originally spanned the cut may need both wording and timing changed. Listen to what survives in the new audio. Split or rewrite the surviving cue based on its actual words and give it a duration appropriate for the video. Avoid moving the entire cue intact when some of its words were removed. Check a phrase shortly before the cut, the first intact phrase after it, and a later phrase before approving the output.
An inserted section can show the same pattern with the opposite sign. If everything after a new five-second title needs to move later, inspect what does or does not require a caption during the inserted title. A speech or sound event that did not exist in the original SRT needs its own cue if the intended subtitle track covers it. Apply the corrected timing to the confirmed matching text and add captions for genuinely new content independently.
Catch duration failures and dense captions after scaling
A mapped cue can start within the program while its end extends past the last visible frame. If the source cue ends at 72.000 seconds and your fitted scale moves that endpoint to 77.100, confirm the intended media actually continues beyond that point. When it ends at 76.900, inspect the final spoken word or visual cue first. You might need to shorten the caption to the actual endpoint or obtain the matching version of the video. Increasing the video duration simply to accommodate a stale subtitle can hide a version mismatch.
Check adjacent cues where a change makes reading effort materially different. Suppose a two-line cue originally fills four seconds. Scaling by 0.9 reduces that to 3.6 seconds, even when both transformed endpoints are valid. Read the result in real playback and check for a crowded boundary where the next cue arrives. If a meaningful pause remains in the footage, use the receiving editor to adjust that specific cue without overlapping the next. If a line needs shortening, preserve the intended wording and verify the result with the editor responsible for caption content.
An earlier shift can make the first cue cross zero. The script stops on that condition to show you where to review. Determine whether the words were cut, already underway at the first frame, or originally assigned the wrong start. If they begin at the first frame in the final program, fix the particular cue on a separate checked copy. If speech never occurs in that rendition, remove the old cue after confirming it in playback. Check the rest of the file again and verify that the other anchors still appear at their intended times.
After making a partial adjustment, export a separately named SRT and load that one in the target player. Some editors can cache a subtitle track or reopen a similarly named earlier file. Temporarily close the test player and choose the fresh track from Finder or the player’s subtitle menu. Compare one distinctive marker next to each adjusted boundary and check the last cue against the final frame. If the file is destined for upload, check cue numbering, positive durations, and whether the receiving player’s preview draws the final track correctly.