[FFmpeg-user] How to fix audio/video out of sync problem

肖谋 xiaomou at gmail.com
Wed May 22 07:42:45 CEST 2013


Hi, all.
    I have a mp4 file 1.mp4 in which the audio is about 2 seconds ahead of
video. I want to fix this using ffmpeg without transcoding, just copy.  My
method is a little complicated.
1. use ffmpeg to split the video and audio into two mp4 file :
    ffmpeg -i 1.mp4 -acodec copy -vn video.mp4
    ffmpeg -i 1.mp4 -vcodec copy -an audio.mp4

I found that the duration of the video.mp4 file is 74 seconds and that of
the audio.mp4 is 72 seconds.


2. strip the first 2 seconds of the audio: ffmpeg -i audio.mp4 -ss 2
-acodec copy audio_stripped.mp4
3. merge audio_stripped.mp4 and video.mp4 into one mp4. And the resulting
mp4 is a/v synced.

So, my question is:  is there a simple, effective, automated solution to
fix this kind of problem.
By the way, if the mp4 is transcoded, the resulting mp4 is also a/v synced.

Thanks!


Regards
xiaomou


More information about the ffmpeg-user mailing list