FFmpeg Cookbook
JA

Fix Audio Sync Tool

Is the sound early or late? Shift the audio by a set number of milliseconds. The video is copied as it is, so the picture does not change and the job finishes quickly.

Your file is not uploaded
Drag & drop a video, or tap to select
MP4 / MOV / MKV / WebM, up to 500 MB
—
—

Set how far to shift the audio.

Positive delays the audio (use it when the sound plays too early). Negative advances the audio (use it when the sound is late). This tool fixes a constant offset; if the gap grows over the clip, that is drift — see the audio-drift guide below.
Processing… 0%

Equivalent FFmpeg command

CLI command for your current settings. Updates live as you change controls.

ffmpeg -i in-1.mp4 -filter_complex "[0:a:0]atrim=start=0,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -movflags +faststart -avoid_negative_ts make_zero out-1.mp4

How to use

  1. Drop your videoChoose an MP4, MOV, MKV or WebM file (up to 500 MB). It first checks that the file has an audio track.
  2. Set the offsetPositive delays the audio (when the sound is early). Negative advances it (when the sound is late). Use the buttons, the slider or the number box.
  3. Apply and checkPress "Apply audio offset", then play the result and check the timing. If it is still off, change the value and run it again.

Recommended settings

Lip-sync slightly off after a screen recording
Try ±100–300 ms, preview, adjust
Start small, play the result, and adjust.
Sound is clearly ahead of the picture
Positive offset (delay audio)
It only adds silence at the start, so no audio is lost.
Sound trails the picture
Negative offset (advance audio)
Cuts the start of the audio so it begins sooner.

When it goes wrong

The gap grows over the clip instead of staying constant

Cause: That is drift. It happens when, for example, the audio and video clocks run at slightly different speeds.

Fix: A single offset cannot fix drift. Use the audio-drift guide.

"No audio track to shift"

Cause: The video has no audio track.

Fix: Choose a video that has sound.

Conversion fails on a .mov / .webm

Cause: The video is copied into an MP4, so it fails when MP4 cannot hold that video format (VP8 in WebM, ProRes in MOV, and so on).

Fix: Convert to an H.264 MP4 first, then try again.

Questions

Which way do I shift?

If you hear the sound before the action, delay the audio (positive offset). If you hear it after, advance it (negative offset).

Does it reduce quality?

The video is copied, so the picture does not change. The audio is re-encoded to AAC at 192 kbps.

It is in sync at the start but drifts later — will this fix it?

No. That is drift. It needs a speed correction of the audio, not a single shift. See the audio-drift guide.

How do I do this from the command line?

To delay: `ffmpeg -i input.mp4 -filter_complex "[0:a:0]adelay=300:all=1[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac output.mp4`. To advance, replace the filter with `atrim=start=0.3,asetpts=PTS-STARTPTS`.

More detail (settings, limits, FFmpeg commands)

What each setting means

Positive offset (delay)
Adds silence at the start of the audio with `adelay`. Use it when the sound is ahead of the picture. No audio is cut.
Negative offset (advance)
Cuts the start of the audio with `atrim`. Use it when the sound lags the picture. Not available if the clip length cannot be read.
Output
An MP4. The video is copied as it is (`-c:v copy`) and the audio is re-encoded to AAC at 192 kbps.

Browsers and limits

  • Fixes a constant offset only, not drift that grows over the clip
  • Keeps the first audio track; any extra audio tracks are dropped
  • Input up to 500 MB. Output is MP4: the video is copied in its original format and the audio is AAC

The same job with the FFmpeg command line

Delay audio by 300 ms
ffmpeg -i input.mp4 -filter_complex "[0:a:0]adelay=300:all=1,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -movflags +faststart output.mp4
Advance audio by 300 ms
ffmpeg -i input.mp4 -filter_complex "[0:a:0]atrim=start=0.3,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -movflags +faststart output.mp4