Detect Audio-Video Sync Drift: Why Dialogue Slowly Falls Out of Sync
The first thirty seconds look perfect. By the ten-minute mark, the mouth movements are noticeably ahead of the audio. This isn’t a fixed sync offset — those are easy to spot and easy to fix with a single delay value. This is drift: the gap grows over time, and it needs a different diagnosis.
Fixed offset vs. drift — they’re different bugs
| Fixed offset | Drift | |
|---|---|---|
| Symptom | Audio and video are off by the same amount from frame 1 to the last frame | Sync is correct at the start and gets progressively worse |
| Cause | Wrong start-time alignment during editing/muxing | A clock mismatch between the audio and video capture/encode pipelines |
| Fix | Shift the whole audio track by a constant delay | Requires re-syncing at multiple points, or fixing the underlying clock mismatch |
A fixed offset is a one-line fix. Drift means something in your pipeline is running audio and video at slightly different speeds — and shifting the whole track by one number won’t fix a problem that gets worse over time.
What actually causes drift
- Mismatched clock sources. The camera’s video clock and a separate audio recorder’s clock are never perfectly identical — even a 0.1% speed difference accumulates to over half a second of drift across a 10-minute recording.
- Variable frame rate (VFR) footage treated as constant frame rate (CFR). Phone cameras often record VFR; if your editor or encoder assumes a fixed frame rate, small timing gaps compound.
- Dropped frames during capture or transcoding. Every dropped video frame without a corresponding audio adjustment pushes the two further apart.
- Sample rate conversion errors. Resampling audio (e.g., 48kHz to 44.1kHz) with a buggy or approximate converter can introduce a slow, cumulative timing error.
How to measure drift (not just notice it)
Eyeballing “does this look off” only tells you drift exists — you need to know how much, and whether it’s constant or accelerating, to know what fix applies.
- Sample multiple points across the timeline. Check sync at the start, the middle, and the end of the video — not just the first few seconds.
- Use a clapperboard or sync spike if you have one. A single sharp audio transient (a clap, a beep) paired with a visible event (hands meeting) gives you an exact, measurable offset at that point in time.
- Compare against a known-good reference. If you have an earlier export or the original camera file, DiffALL’s video comparison tool tracks similarity second-by-second — a steadily widening gap between two versions that should be identical is exactly what drift looks like on the per-second chart, even without a clap track.
- Calculate drift rate. If sync is correct at 0:00 and off by 400ms at 10:00, that’s roughly 0.67ms of drift per second — useful for judging whether a constant-rate correction (stretching the audio track slightly) will actually fix it.
Fixing drift once you’ve confirmed it’s linear
If the drift rate is constant throughout (not accelerating or erratic), audio can often be time-stretched to match:
ffmpeg -i video.mp4 -i audio.wav -filter_complex \
"[1:a]atempo=0.9993[a]" -map 0:v -map "[a]" -c:v copy output.mp4
The atempo value here is expected_duration / actual_duration — a video that should be 600.000s but whose audio track runs 600.400s needs atempo=1.00067 to compress it back to the correct length. Get this number from your own drift measurement, not by guessing.
If drift is erratic — sync gets better, then worse, then better again — a single time-stretch won’t fix it. That pattern usually points to dropped/duplicated frames rather than a clean clock mismatch, and the fix is in the capture or transcode step, not in post.
Preventing drift at the source
- Record audio and video on the same device when possible — eliminates the two-clock problem entirely.
- If using separate audio (external mic/recorder), sync at multiple points, not just the start — a single slate clap at the beginning of a 30-minute interview won’t reveal drift that only becomes audible at minute 20.
- Force constant frame rate (CFR) during any transcode step:
ffmpeg -i input.mp4 -vsync cfr -r 30 output.mp4. - Re-verify sync after every transcode, not just after the original edit — a re-encode is a common place for drift to be silently introduced.
Checklist
- [ ] Confirm the problem is drift (gets worse over time) and not a fixed offset.
- [ ] Sample sync at three or more points across the full duration.
- [ ] Calculate the drift rate to judge whether it’s linear (time-stretch fixable) or erratic (needs re-capture/re-encode).
- [ ] Check whether source footage is VFR before assuming a CFR pipeline handled it correctly.
- [ ] Re-check sync after every export step in the pipeline, since drift can be introduced at more than one stage.
Fixed sync offsets are a five-second fix. Drift requires actually measuring how the gap changes over time first — otherwise you’re guessing at a correction for a problem you haven’t fully diagnosed. Compare two versions of the file to get that measurement before reaching for atempo.
Stop hunting for differences by hand. DiffALL spots every change between any two files — automatically.
Compare your files — free