Fixing Audio-Video Sync Issues — -itsoffset and adelay Filter

After recording, streaming, or converting, you may encounter problems like “the lip movements don’t match the audio” or “the audio is behind/ahead of the video.” FFmpeg has several approaches to fix this sync issue. This article explains the main techniques by situation.

Verified with: ffmpeg 6.1


Identifying the Direction of the Offset

Before choosing a fix, confirm which direction the offset is in.

ConditionMeaningFix
Audio is later than videoSound arrives after the actionShift audio earlier, or delay the video
Audio is earlier than videoSound arrives before the actionShift audio later

1. -itsoffset — Offset Input Timestamps

-itsoffset adds an offset value to the timestamps of the file specified by the next -i.

Specifying a positive value causes that stream’s start to be delayed (the stream shifts back).

When audio is later than video (align audio to video)

Input the same file twice — take video from the second input and audio from the first input (with offset).

ffmpeg -itsoffset 1.5 -i input.mp4 -i input.mp4 -map 1:v -map 0:a -c copy output.mp4

Command explanation:

Note: -itsoffset applies to the immediately following -i. Order matters.

Meaning of positive and negative itsoffset values

ValueEffect
+1.5 (positive)Delays that stream’s start by 1.5 seconds (shifts audio back relative to video)
-1.5 (negative)Advances that stream’s start by 1.5 seconds (shifts audio forward relative to video)

2. adelay Filter — Delay the Audio

When audio is earlier than video, the adelay filter can delay the audio track by a specified number of milliseconds.

ffmpeg -i input.mp4 -filter:a "adelay=1500|1500" output.mp4

Command explanation:

Example of setting different delays per channel

ffmpeg -i input.mp4 -filter:a "adelay=1000|500" output.mp4

(Left channel: 1000ms, Right channel: 500ms) — Not in CI scope (reference example)


3. -async Option — Automatic Sync Correction

-async is an option that automatically stretches or compresses audio samples to synchronize them with the video.

ffmpeg -i input.mp4 -async 1 output.mp4

4. Difference Between aresample and async

Option/FilterBehaviorUse case
-async NDrops/pads audio based on timestampsAutomatic minor correction
aresample filterRe-converts sample rateRemoving subtle sync drift, unifying sample rates
adelay filterAdds silence to audio channels to delay themAdding a fixed delay
-itsoffsetOffsets the timestamps themselvesStream-level sync adjustment

General usage guide:


Common Notes



Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner)
Primary sources: ffmpeg.org/ffmpeg.html / ffmpeg.org/ffmpeg-filters.html / trac.ffmpeg.org