Tool
When the audio runs later or earlier than the lip movement, this tool measures how far off it is and builds an ffmpeg command to fix it. Pick a clap video and it calculates the difference between the clap frame in the video and the time the clap starts in the audio; if you already know the value, you can enter it directly in ms or frames. All calculation happens only inside this browser.
① Measure the offset with a clap video (optional)
Pick a video in which you clapped once in front of the camera. The tool finds the frame where the palms meet in the video and the moment the clap starts in the audio, and calculates the difference. If you already know the value, skip to ②.
② Enter the offset
Direction check preview
If you pick the wrong direction, the offset doubles. Press the buttons to check that the symptom you picked feels like what you were seeing, and that it lines up after the fix. The screen flash is tied to the browser's display refresh (usually around 16 ms), so it is not a precise measurement at the tens-of-ms level.
③ Build the command
ffmpeg command (output: input_sync.mp4)
ffmpeg -itsoffset 0.2 -i "input.mp4" -i "input.mp4" -map 0:v:0 -map 1:a:0 -c copy "input_sync.mp4"
The audio is 200 ms late, so the same file is opened as input a second time and -itsoffset 0.2 is applied to the first input (the video), which delays the video by that amount. Relatively, that is the same as pulling the audio 200 ms earlier.
-itsoffset applies only to the single -i that comes right after it. Because there are two inputs, -map 0:v:0 means the video of the first input and -map 1:a means the audio of the second. Subtitles and other audio tracks are left out of this command, so add more -map options if you need them.
In MP4, a start delay is stored as an edit list, and there are reports that some players and editors ignore it, so it has no effect. Open the result and check it yourself; if it doesn't work, use the ‘re-encode audio only’ method.
Because this method delays the video, the start of the output file may have a stretch with no video, and depending on the player the first few hundred ms may show as a black or frozen frame.
The original input is not touched; the result is saved as a new file. Open the result and check the clap scene again.
Inside a video file, the video and the audio are compressed and stored separately, and each has its own timetable (timestamps) saying ‘play this at this many seconds.’ The player lines the two timetables up. So an offset usually appears when one timetable is shifted to one side: for example, the recording or capture device received the video and the audio with different delays, only one of them was trimmed during editing, or the playback device, like Bluetooth earbuds, outputs the sound late. The last case is a problem of the playback setup, not of the file, so first check whether the offset also shows up on other speakers or a wired connection. There is a reason to fix the file only if it is still off over a wired connection.
A loud scene other than a clap (a door slamming, a slate) works too. If several sounds are mixed in the range, narrow the analysis range to around the clap. You can also line things up by eye using a flash of light in the scene or the lip movement, but the eye can hardly tell differences of tens of ms, so the error gets larger.
The same file is opened twice as input, only the timetable of the input that has -itsoffset is pushed back, and then the video is taken from the first input and the audio from the second. Both the video and the audio are copied as compressed data, so picture and sound quality do not change and it finishes almost instantly. This tool always builds the command with positive values only: if the audio is late it delays the video (which, as a result, is the same as pulling the audio earlier), and if the audio is early it delays the audio. This avoids negative offsets, whose sign is easy to mix up.
The downside is that results can differ depending on the container and the player. There are user reports on the FFmpeg issue tracker and forums that it had no effect in MP4 or that-itsoffset on the second input did not take, so be sure to open the file you made and check the clap scene again.
The audio is processed directly with a filter and compressed anew. If the audio is early, adelay adds silence at the front to delay it; if the audio is late,atrim=start= cuts off the front of the audio to pull it earlier. The video stays as is with -c:v copy, so picture quality is kept, but the audio goes through lossy compression once more. Because it relies less on how the container handles timestamps, it is the alternative when the copy method does not behave. The speed correction (atempo) for an offset that keeps growing is also possible only with this method.
People easily use ‘the audio is late/early’ in opposite ways. This tool’s convention is: if, for the same event, the sound comes after the picture, it is ‘late.’If you pick the wrong direction, the fix doubles the offset, so press the play-before-fix button to confirm the symptom matches what you have been seeing, then use the command.
To see which tracks are inside a file, use the video file info inspector; if a command throws an error, use the FFmpeg error log explainer. For subtitles that are out of sync, there is a separate subtitle sync fixer.