If the audio matches at the start but falls further out of sync toward the end, that is drift. The audio and video clocks run at slightly different speeds, so the gap grows over time. If the gap is the same from start to end, it is a fixed delay; see Fix Audio Delay Manually.
| Pattern | Symptom | Cause | Fix |
|---|---|---|---|
| Constant offset | Same amount from start to end | A fixed delay when recording or muxing | Shift once (-itsoffset, adelay) |
| Drift | In sync at the start, growing toward the end | Two clocks at different speeds, or VFR in software that ignores timestamps | Correct the rate (atempo, CFR) |
If the end is still off after you line up the start, it is drift.
Why -itsoffset Can’t Fix Drift
-itsoffset shifts every stream of the next input (video and audio) by a fixed number of seconds. Drift grows, for example 100 ms at 1 minute and 1 second at 10 minutes, so any single shift lines up only one point.
Fix 1: Change the Audio Speed by a Measured Ratio
Measure the gap near the end and use atempo to speed the audio up (or slow it down) slightly. If the audio is 0.5 seconds late at 10 minutes (600 seconds), the ratio is (600 + 0.5) / 600 = 1.00083.
ffmpeg -i input.mp4 -af atempo=1.00083 -c:v copy output.mp4
The video is copied and only the audio is re-encoded. If the audio runs early, use a ratio below 1: (600 − 0.5) / 600 = 0.99917. To make the output audio 48 kHz, add -ar 48000 (-ar alone does not fix drift).
aresample=async=1000 corrects mismatches between timestamps and the audio’s sample count. It helps with dropped samples during recording and with drift that shows up in the timestamps. In MP4, audio timestamps usually come from the sample count, so a clock-speed mismatch never shows up in them and async cannot fix it.
Fix 2: Force a Constant Frame Rate (When Only Your Editor Drifts)
A variable frame rate (VFR) video stays in sync if its timestamps are correct. If it drifts only in an editor or player that ignores timestamps, re-make the video at a constant frame rate (CFR).
ffmpeg -i input.mp4 -fps_mode cfr -r 30 -c:v libx264 -c:a copy output.mp4
Set -r to the source’s nominal frame rate. The older -vsync cfr still works but is deprecated. To check for VFR, see Convert Variable Frame Rate to Constant; if the drift started right after a conversion, see Audio Out of Sync After Converting.
FAQ
What does the number in aresample=async=1000 mean?
1 only inserts silence or trims samples. Values above 1 also set the maximum stretch or squeeze, in samples per second. Inserting and trimming start when the gap exceeds 0.1 seconds (the default min_hard_comp).