Browser-based subtitle timing · speech detection, offset, drift, anchors

Subtitle Auto Sync

Fix subtitles that run early, late or drift: the audio is scanned for speech, matched against the subtitle timing to find the best shift (after trying the common frame-rate speed changes), and the corrected SRT, WebVTT or SBV file is saved in the same format.

1. Video or audio

Up to 100 minutes. The soundtrack is read at 16 kHz in the browser.

Drop the video or audio here or click to choose

MP4, MOV, WebM, MP3, WAV, M4A, FLAC, OGG

2. Subtitle file

SRT, WebVTT or SBV, up to 5 MB.

Drop the subtitles here or click to choose

.srt, .vtt, .sbv

Subtitle Auto Sync

Operator: Abdulla Al Fahad. How tools are built and checked

Subtitles that appear two seconds late are annoying; subtitles that start in time and are ten seconds out by the end are worse, because no single shift fixes them. Both come from a subtitle file timed against a different release of the film: a different start, or a different frame rate.

Instead of nudging by hand and rewinding, this page listens. It finds where speech is in the soundtrack and lines that pattern up with the pattern of the subtitle cues. It first tests the common frame-rate conversions (23.976, 24 and 25 fps, and the 1.001 factor) in case the whole file runs at the wrong speed, then reports the offset that matches best, whether the offset still changes over the film, and how sure it is.

The corrected file is saved in the format you loaded, with the cue text untouched.

Key features

  • Speech detection from the audio of a video or audio file up to 100 minutes, using energy in the speech band and spectral flatness
  • A speed ratio chosen from six frame-rate conversions (23.976 to 25, 25 to 23.976, 24 to 25, 25 to 24 and the 1.001 factor either way) when stretching the cue times fits the speech clearly better than leaving them alone
  • A global offset found by cross-correlation within a search range of 10 seconds to 5 minutes either way, at 10 ms resolution
  • Local offsets for windows of 2, 5 or 10 minutes, a robust linear drift fit through them, and per-window anchors you can switch off one by one
  • Three correction modes: one offset, offset plus linear drift, or piecewise through the anchors

How speech is matched to subtitle timing

The audio is read at 16 kHz mono. Every 10 ms a 32 ms window is analysed between 200 and 4,000 Hz, where speech lives: its level in dB and its spectral flatness (how noise-like the spectrum is, near 0 for a voice with harmonics and higher for hiss). A frame counts as speech when its level is above a floor taken from the quietest tenth of the track plus 30% of the way up to its 95th percentile, and at least 8 dB, and its flatness is under 0.45. Gaps shorter than 150 ms between speech frames are closed and bursts shorter than 80 ms are dropped.

SRT, WebVTT and SBV are read with the Subtitle Converter's parser and written with its writers, so cue text and tags survive, and so do WebVTT cue identifiers and settings; only the start and end times change. A WebVTT file's header text and its STYLE, REGION and NOTE blocks are not carried into the saved file. A cue that would start before 0:00 is cut to begin at 0:00; a cue that would end before 0:00 is left out, and if more than a handful would be, the download is switched off because the shift cannot be right.

Loud music, effects and crowd noise also look like speech to an energy-and-flatness test, and quiet whispering may not, so a film with a constant score will weaken the match.

How it works

Speech and the cue pattern are each a series of 0s and 1s every 10 ms. After removing their means, the page computes their cross-correlation with the FFT, divides by the product of their lengths so the peak is between -1 and 1, and takes the shift with the highest value within the search range. The strongest correlation at least 2 seconds from that peak is kept as the runner-up, and the ratio of the two is the peak's clarity. This is done for the cue times as they are and again with the cue times multiplied by each of the six frame-rate ratios; a ratio is used only if its correlation is more than 0.06 above, and at least 1.4 times, the unstretched one. A 4.27% mismatch smears the unstretched peak across seconds, so only the matching ratio gives a sharp peak.

The film is then cut into windows. In each one with at least 8 cues and between 5% and 95% speech, the cues are slid within 3 seconds of the global offset and the best shift is recorded, together with its correlation, as an anchor at the window's middle. A Theil-Sen line (the median of all pairwise slopes) through the anchors gives the drift, so a few windows that matched on a wrong scene do not bend it. When the line has a slope, the windows are repeated around the line instead of the global offset, so a drift of tens of seconds stays inside the 3-second reach.

Confidence rates the correction as it will be saved. It is high when the corrected cues correlate with speech at 0.30 or more, at least 60% of their time lies on speech and that is at least 20 points more than the share of the audio detected as speech (cues placed at random would score the speech share), and, for a single offset, the winning peak is at least 1.5 times its runner-up. It is medium at 0.20, 50%, 10 points and 1.25 times, and low otherwise, so a faint peak of 0.10 is never rated medium.

Common use cases

  • A film's English subtitles come from a release that starts 6.5 seconds later: the page finds -6.5 s and one offset is enough.
  • A 23.976 fps subtitle file for a video that plays at 25 fps: the cues drift later by 4.27% of the elapsed time, so a line at 10 minutes is 26 seconds out and no single shift fixes it. The page tries that ratio and the five other common ones, finds the 25 / 23.976 stretch fits, applies it and then looks for any remaining offset.
  • A two-hour film with a missing scene in the middle of the subtitle source: piecewise follows two different offsets, one on each side of the cut.
  • A lecture recording where the subtitle file was made from the transcript and runs 12 seconds ahead; the search range is set to ±30 s.
  • A conference talk recorded in two halves, where the subtitles for the second half were made from a recording that started 9 seconds earlier: the anchor windows read about 0 s in the first half and about +9 s in the second, and piecewise follows the step where one offset or one line would not.

How to use this tool

  1. Load the video or audio file and wait for the speech scan; the share of the time detected as speech is shown.
  2. Load the SRT, WebVTT or SBV file.
  3. Set the search range wide enough for the offset you expect, and press Find the best shift.
  4. Read the confidence, then choose one offset, offset plus drift, or piecewise; untick anchor windows that look wrong.
  5. Compare the strip chart, where speech and the subtitles before and after are drawn, then download the synced file.

Example

A subtitle file timed for 23.976 fps, played against a 25 fps video of about 12 minutes of dialogue

Search range ±60 s, anchor windows of 5 minutes. For an input like this the cue at 3.000 s should sit at 3.128 s.

Speed change, shift and confidence

Cue times stretched ×1.04271 (23.976 to 25 fps), then best overall shift +0.00 s, correlation 0.93, 8.0 times the best rival peak: high confidence.
Subtitle time on speech rises from 45% to 96%. The cue that started at 3.000 s now starts at 3.128 s, and the last cue, near 700 s, moves by about 30 s.

Common pitfalls

Subtitles for a different edit, with scenes cut or added, cannot be fixed by a shift or a straight drift; the result shows as low confidence or as an anchor table that jumps around.

The drift fit assumes the error grows evenly, as it does with a frame-rate mismatch. Offsets that jump at scene cuts need the piecewise mode.

A speed error that is not one of the six frame-rate ratios, such as a 1% speed-up, is tracked through the anchor windows, which each look only 3 seconds around the running estimate. For a 12-minute file with a 1% error and 2-minute windows, a ±10 s search range found it, while ±60 s smeared the first peak and the result was rated low. Narrow the range when you know the start offset is small.

Speech from other languages dubbed over the film still counts as speech, so the match tells you when the speech is, not whether the subtitles say the same thing.

A track with a constant score produces false speech frames, which shows as a high speech share and a flatter, less certain correlation.

  • Set the search range to about twice the shift you expect; a wider range lets the match pick up an unrelated, equally patterned stretch.
  • Use the 2-minute window for a short video and 10 minutes for a long one, so each window holds enough cues to be meaningful.

Common errors and how to fix them

Almost no speech was detected, so there is nothing to line the subtitles up with
The track may be silent or music only. Try a different audio track from the file.
Only 5 usable cues were found; at least 8 are needed to find an offset
The subtitle file is too short or most blocks are damaged. Check it in a text editor.
12 cues would end before 0:00, and the download is switched off
A correct offset cannot push that many cues before the start of the file. Try a different correction mode or search range; if the confidence is low, the subtitles may belong to another cut.
"film.mp4" is 130 minutes long; this tool takes up to 100 minutes
Extract the part you need first, or the first 100 minutes: the match needs only a good stretch of speech and the cues for it.

Best practices

  • Fix the global offset first and look at the anchor table before choosing drift: a flat table means one offset is enough.
  • Keep the original subtitle file: the download is a new file with .synced before the extension, and the original is never changed.

Frequently asked questions

How is this different from the Subtitle Editor with Waveform?

That page moves cues by hand against a waveform, one cue or a whole file at a time. This page finds the speed ratio, the shift and the drift from the audio and applies them to every cue.

Can it use Whisper or another speech recogniser?

No. This page only uses the energy and flatness of the sound, which is fast and needs no model download but cannot read words, so it matches when speech happens, not what is said.

Why is the overall shift not the offset at the start?

With drift, the best single shift is the average over the film, so it sits between the offset at the start and the offset at the end. The linear-drift line shows the start offset and the drift in milliseconds per hour; use that mode when the anchors move steadily.

Does it change the text of the cues?

No. Only start and end times change; text, formatting tags and WebVTT cue settings are kept as they were.