If the sound goes out of sync only after conversion, first play the original and the output in the same player and compare the beginning, middle and end. Possible causes include how the container stores timing, the player, edits you made, missing PTS and the audio timing itself. A variable frame rate (VFR) alone does not mean the file is broken.
Record the Symptom First
| Check | What it tells you |
|---|---|
| Original and output in the same player | Whether the conversion changed something or the player is the difference |
| Sound and movement near the start, middle and end | A fixed offset, or an offset that grows |
| Playback in another player | Whether the problem is limited to one player |
| Conversion command and warnings | Whether trimming, speed changes or timestamp options played a part |
Use a moment you can both see and hear, such as a hand clap. Check whether the problem was already in the source or came from the conversion. Before you share logs, remove file names, account names and local paths.
If the offset stays the same, see fixing audio delay manually. If it grows over time, see fixing audio drift.
Compare a Re-Encoded Output
Stream copy (-c copy) moves the encoded audio and video into a new container without decoding them. The timestamp values can still change, because FFmpeg may convert the time base (the unit timestamps are counted in) or adjust the start time. So a sync problem after a stream copy does not by itself prove the source timestamps were broken.
This command re-encodes both video and audio so you can compare. Keep the original, and use an output name that does not overwrite an existing file.
ffmpeg -i input.mp4 -c:v libx264 -crf 20 -c:a aac output.mp4
CRF 20 is only an example value, and it is not lossless. Re-encoding keeps the input timing, so an offset that is already there stays. Compare the three points again. If nothing improved, look for another cause.
When Audio Samples Disagree with Audio Timestamps
If you found that the audio timestamps and the number of audio samples do not match, let FFmpeg fill or trim the audio while it copies the video.
ffmpeg -i input.mp4 -af aresample=async=1 -c:v copy output.mp4
async=1 follows the audio stream’s own timestamps. It does not look at the picture or at lip movement. If those timestamps are wrong, the result is still out of sync. Besides the sync, listen for new silences or missing sound.
When PTS Is Missing
+genpts fills in missing presentation timestamps (PTS) when the decoding timestamps (DTS) are there. It does not fix every wrong timestamp that already exists, and it cannot work out how the original recording lined up.
ffmpeg -fflags +genpts -i input.mp4 -c copy output.mp4
-fflags is an input option, so put it before -i. Stream copy avoids re-encoding, but the container and the way the data is stored can still change.
When the Destination Requires Constant Frame Rate
VFR is a normal way to record frames at changing intervals, and containers and players that support it keep it in sync. Convert to a constant frame rate (CFR) only when the destination requires it, or when you have traced the problem to a player or editor that cannot handle VFR.
ffmpeg -i input.mp4 -fps_mode cfr -r 30 -c:v libx264 -c:a aac output.mp4
30fps is only an example. Pick a rate that suits the source and the destination. The command duplicates or drops video frames. It may not correct a constant audio offset, or recording devices whose clocks run at slightly different speeds.
If r_frame_rate and avg_frame_rate differ, the file may be VFR, but that alone does not prove it. Check the gaps between frame timestamps too. See how to check for VFR and convert to CFR.
If Sync Still Fails
- Change one setting at a time, and make each test file from the original.
- If you trimmed or changed the speed before converting, check whether the sync broke at that step.
- Check the whole finished file, not only a short part of it.
- When you ask for help, include a shareable sample that shows the problem, your command and the offsets at the three points. Do not post private footage, or logs that still contain personal details.