“The lip movements don’t match the audio.” “Sound is 1.5 seconds behind the video after conversion.” — A/V sync drift after recording, streaming, or transcoding can be fixed with FFmpeg. Identify the direction of the offset, pick the right option, and in many cases you can fix it without re-encoding. Time to complete: 10 minutes.
Tested with: FFmpeg 6.1 (ubuntu-latest / GitHub Actions CI-validated)
What You Will Learn
- How to identify the direction of the offset
- Measuring drift with ffprobe
-itsoffsetfor lossless timestamp adjustmentadelayfilter for millisecond-precise audio delay-asyncoption for automatic sync correction- Comparison of all correction methods
- Five common errors and fixes
- Five frequently asked questions
Identify the Direction of the Offset
Before choosing a fix, confirm which direction the offset is in.
| Condition | Meaning | Fix |
|---|---|---|
| Audio is later than video | Sound arrives after the action (clap → sound) | Shift audio earlier, or delay video |
| Audio is earlier than video | Sound arrives before the action (sound → clap) | Shift audio later |
Measure the Drift with ffprobe
# Check start_time of video and audio streams
ffprobe -v error -show_entries stream=codec_type,start_time \
-of default=noprint_wrappers=1 input.mp4
Example output:
codec_type=video
start_time=0.000000
codec_type=audio
start_time=1.536000
The difference between start_time values is the drift amount (in this example, audio is 1.536 seconds late).
Command Examples
1. -itsoffset to Shift Audio Earlier (audio is late — no re-encoding)
Input the same file twice — take video from the second input and audio from the first (with offset applied).
# Fix: audio is 1.5 seconds behind video
ffmpeg -itsoffset 1.5 -i input.mp4 -i input.mp4 \
-map 1:v -map 0:a -c copy output.mp4
-itsoffset 1.5— delays the timestamps of the next-iby 1.5s (effectively pulling audio forward)-map 1:v— video from the second input (no offset)-map 0:a— audio from the first input (offset applied)-c copy— no re-encoding (fast, lossless)
2. -itsoffset to Delay Video (audio is early)
# Fix: audio is 1.0 second ahead of video
ffmpeg -i input.mp4 -itsoffset 1.0 -i input.mp4 \
-map 0:a -map 1:v -c copy output.mp4
- Apply
-itsoffsetto the video input to delay video by 1.0s
3. adelay Filter — Delay Audio by Milliseconds
# Delay audio by 1500ms (1.5 seconds) — stereo
ffmpeg -i input.mp4 -af "adelay=1500|1500" -c:v copy output.mp4
adelay=1500|1500— delay left channel 1500ms, right channel 1500ms- Use
|to specify per-channel delay (stereo requires two values) - This filter only delays audio — it cannot shift audio earlier
4. -async for Automatic Sync Correction
# Auto-correct small drift and jitter
ffmpeg -i input.mp4 -async 1 -c:v copy output.mp4
-async 1— automatically aligns audio to video timestamps by inserting or dropping samples- Effective for small offsets (tens to hundreds of milliseconds)
- May slightly alter pitch — not suitable for large offsets
5. Fix Sync While Re-Encoding
# Fix 1.5s audio delay + re-encode to H.264
ffmpeg -itsoffset 1.5 -i input.mp4 -i input.mp4 \
-map 1:v -map 0:a \
-c:v libx264 -crf 23 -c:a aac output.mp4
Correction Method Comparison
| Method | Re-encoding | Handles | Precision |
|---|---|---|---|
-itsoffset + -c copy | None | Both directions | High (timestamp-level) |
adelay filter | Audio only | Audio late only | High (millisecond) |
-async 1 | Audio only | Small drift/jitter | Auto (coarse) |
aresample filter | Audio only | Sample rate drift | High (sample-level) |
When to use which:
- No re-encoding wanted →
-itsoffset+-c copy - Known fixed offset →
-itsoffsetoradelay - Small drift or jitter →
-async 1oraresample
Option Reference
| Option / Filter | Meaning | Recommended Value |
|---|---|---|
-itsoffset N | Delay timestamps of next -i by N seconds | Drift amount (seconds) |
-map 0:a | Select audio stream from input 0 | Used with itsoffset |
-map 1:v | Select video stream from input 1 | Used with itsoffset |
-af adelay=N|N | Delay audio channels by N milliseconds | Drift × 1000 (ms) |
-async N | Auto sync-correct audio samples | 1 (auto) |
-c copy | Copy without re-encoding | When using itsoffset |
Troubleshooting
Problem 1: adelay Has No Effect With -c copy
Cause: adelay is a filter and requires audio re-encoding — incompatible with -c copy
Fix: Re-encode audio while copying video:
ffmpeg -i input.mp4 -af "adelay=1500|1500" -c:v copy -c:a aac output.mp4
Problem 2: -itsoffset Applied But Sync Is Still Off
Cause: -itsoffset is not immediately before its target -i, or -map specifies the wrong input
Fix: Verify command structure:
# Correct order
ffmpeg -itsoffset 1.5 -i input.mp4 -i input.mp4 \
-map 1:v -map 0:a -c copy output.mp4
# ^^this is the input that -itsoffset targets ^^normal input
Problem 3: Sync Drift Remains After Fix
Cause: The measured offset was inaccurate
Fix: Use ffprobe to get exact timestamps:
ffprobe -v error -show_entries stream=codec_type,start_time \
-of default=noprint_wrappers=1 input.mp4
Problem 4: Audio Cuts Out or Has Silence Gaps After Fix
Cause: A very large offset (5+ seconds) creates silence at the start or end of the stream
Fix: For large offsets, investigate the source recording settings. Trimming with -ss before correction often helps:
# Trim 2 seconds from the start, then apply fix
ffmpeg -ss 2 -i input.mp4 -c copy trimmed.mp4
Problem 5: Audio Pitch Changes After -async
Cause: -async inserts or drops samples, which can affect pitch
Fix: Use the aresample filter to sync without pitch change:
ffmpeg -i input.mp4 -af aresample=async=1:min_hard_comp=0.1 -c:v copy output.mp4
FAQ
Q1. How do I measure the offset when I don’t know how much it is?
A. Use ffprobe to check start_time, or play the video and look for a scene with a clear sync reference (clap, impact) to visually/aurally estimate the drift.
Q2. What units does -itsoffset use?
A. Seconds. 1.5 = 1.5 seconds. Note that adelay uses milliseconds (1500 = 1.5 seconds) — don’t mix them up.
Q3. Can I fix sync without re-encoding anything?
A. Yes — use -itsoffset + -c copy. Only the timestamps are modified; no decode/encode happens, so quality is unchanged.
Q4. What if the drift is less than 0.5 seconds?
A. Try -async 1 for automatic correction. If drift persists, try aresample=async=1.
Q5. How do I use adelay with mono audio?
# Mono audio — specify a single value (no | separator needed)
ffmpeg -i input.mp4 -af "adelay=1500" -c:v copy output.mp4
Related Articles
- Extract Audio from Video — Complete Guide
- FFmpeg Command Basic Syntax — Inputs, Filters, and Outputs
- Inspect Metadata and Stream Info with ffprobe
- Loudness Normalization — EBU R128 with loudnorm Filter
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