The audio matches the video at the start of the clip but is clearly off by the end, and the gap keeps growing. This is audio drift, and it is a different problem from a fixed delay. A constant offset is the same amount of lead or lag from start to end, and one timestamp shift fixes it. Drift grows over time because the audio clock and the video clock run at slightly different speeds. To fix it you have to correct the rate; a one-time offset cannot do that.
If the audio is off by the same amount from the very start, you need a single offset instead: see Fix Audio Delay Manually. For other sync problems, see Fix Audio Sync.
Drift vs Constant Offset
The fix depends on which of the two you have, so check the symptom first.
| Pattern | Symptom | Cause | Fix type |
|---|---|---|---|
| Constant offset | Audio is off by the same amount from start to end | A fixed delay in recording/muxing | One-time shift (-itsoffset, adelay) |
| Drift | In sync at the start, increasingly off by the end | Two clocks running at different rates, or VFR video in software that ignores timestamps | Rate correction (audio speed / CFR) |
A quick test: shift the audio so that the start lines up. With drift, the end is still out of sync, and the other way round. No single offset can fix both ends, because the error grows over the length of the clip.
Why -itsoffset Cannot Fix Drift
-itsoffset shifts an entire stream’s timestamps by a fixed number of seconds. That is right for a constant offset, where the whole stream moves together. Drift is not an even shift: the audio might be 100 ms off at the 1-minute mark and 1 second off at the 10-minute mark. A single offset lines up one point in the clip and leaves every other point wrong.
-itsoffset slides the audio left or right as one rigid block. Drift needs the audio stretched or compressed so that its playback rate matches the video. That is a speed change, not a shift, so every fix below changes the audio rate or the frame rate instead of adding an offset.
Fix 1: Change the Audio Speed by the Measured Ratio
Measure how far off the audio is near the end of the clip, then play the audio slightly faster or slower with the atempo filter. For example, if the audio is 0.5 seconds late at the 10-minute mark (600 seconds), the factor is (600 + 0.5) / 600 = 1.00083.
ffmpeg -i input.mp4 -af atempo=1.00083 -c:v copy output.mp4
-af atempo=1.00083— play the audio 1.00083 times as fast-c:v copy— copy the video unchanged (fast, lossless)- The audio is re-encoded, because the filter rewrites the samples
If the audio is early instead, the factor is below 1: (600 - 0.5) / 600 = 0.99917. Try this fix first, because the video stream stays copied. Then check the end of the clip again.
aresample=async=1000 does not help here. It only lines the audio up with its own timestamps. In an MP4 those usually come from the number of samples, so a clock mismatch does not show up in them. It helps when the timestamps are right but samples are missing, for example when a capture dropped audio: it then fills the gaps with silence.
Fix 2: Standardize the Sample Rate (Compatibility)
-ar 48000 sets the output sample rate and resamples the audio to it. 48000 Hz is the standard rate for video. This gives a clean, widely compatible output rate, but on its own it does not correct drift caused by a wrong real clock or bad timestamps. The drift correction is the speed change in Fix 1. If the file declares the wrong sample rate (it was tagged with the wrong value), use asetrate, which reinterprets the rate. Use -ar together with Fix 1, not as a drift fix by itself.
ffmpeg -i input.mp4 -ar 48000 -c:v copy output.mp4
-ar 48000— resample the output audio to the standard 48 kHz-c:v copy— keep the video as it is
To set a standard rate and correct the drift in one pass, combine it with Fix 1: -af atempo=1.00083 -ar 48000 -c:v copy output.mp4.
Fix 3: Force Constant Frame Rate (When Your Editor Needs It)
In a variable frame rate (VFR) video, the time between frames changes. With correct timestamps, VFR video stays in sync with its audio. Some editors and players ignore the timestamps, and the picture then drifts away from the sound. If only such a program shows the drift, convert the video to constant frame rate (CFR).
ffmpeg -i input.mp4 -fps_mode cfr -r 30 -c:v libx264 -c:a aac output.mp4
-fps_mode cfr— force constant frame rate output-r 30— target frame rate; set it to your source’s nominal rate-c:v libx264 -c:a aac— re-encode both streams onto a steady timeline
Note: In FFmpeg 8.x use
-fps_mode cfr. The legacy-vsync cfrstill works but is deprecated.
To check whether a file is VFR and convert it, see Convert Variable Frame Rate to Constant. If the drift started after a conversion, also see Audio Out of Sync After Converting.
Which Fix Should I Use?
| Situation | Recommended fix |
|---|---|
| Audio gets steadily later or earlier, want to keep video copied | -af atempo=1.00083 -c:v copy (your measured factor) |
| Samples missing but timestamps right (dropped audio in a capture) | -af aresample=async=1000 -c:v copy |
| Want a clean, standard output rate (pair with Fix 1) | -ar 48000 -c:v copy |
| VFR source drifts only in an editor that ignores timestamps | -fps_mode cfr -r 30 (re-encode) |
| Audio is off by a fixed amount, not growing | Not drift — see Fix Audio Delay |
Start with the speed change in Fix 1: it corrects the rate while the video stays copied. Add -ar 48000 for a standard output rate. Make a CFR copy only when an editor or player that ignores timestamps shows the drift.
FAQ
How do I tell drift apart from a constant delay?
Line up the audio at the start of the clip. If the end is still out of sync, it is drift: the error grows over time. If the whole clip moves together and stays in sync, it is a constant offset. Fix that with Fix Audio Delay Manually.
Why doesn’t -itsoffset fix my drift?
-itsoffset moves the entire audio stream by a fixed amount, as one rigid block. With drift the error grows over the clip, so any single offset lines up only one point and leaves the rest wrong. Drift needs a rate correction instead, such as the speed change in Fix 1.
What does the number in aresample=async=1000 mean?
It is the most the audio may be stretched or squeezed, in samples per second, to follow its timestamps. Any value from 1 also lets FFmpeg fill gaps with silence or trim extra samples. It only follows the audio’s own timestamps, so it cannot fix a clock mismatch that the timestamps do not show. Use Fix 1 for that.
My drift is caused by a variable frame rate — what then?
VFR video with correct timestamps stays in sync. If an editor or player that ignores timestamps shows the drift, re-encode with -fps_mode cfr -r 30 to force a constant frame rate. Convert Variable Frame Rate to Constant shows how to detect VFR and convert it step by step.
Can I combine Fix 1 and Fix 2?
Yes. ffmpeg -i input.mp4 -af atempo=1.00083 -ar 48000 -c:v copy output.mp4 changes the speed and sets a fixed 48 kHz rate in one pass. The video is still copied.