[FFmpeg-user] Extracted Audio not in Sync with Video

Josh jnfo-d at grauman.com
Tue Oct 31 01:31:01 EET 2023


Hi all,

My use case is that I want to extract audio from a mp4, edit the audio, 
and then put the audio and the video back together. It works fine, but 
over the course of the two hour video, the audio gets out of sync with the 
video and falls behind it (visibly, so you can see the mouth and sound 
aren't in sync).

I extract the audio with a command like this:
ffmpeg -y -i "v1-ed.mp4" -vn "a1.wav"

I edit a1.wav with audacity to create a1-ed.wav.

And then combine audio and video with a command like this:
ffmpeg -y -i "v1-ed.mp4" -i "a1-ed.wav" -filter_complex "[1]anull[aud]; [0]fade=t=out:st=6673.87:n=24[out]" -strict experimental -shortest -map [out] -map [aud] "lecture.mp4"

Is there any easy way to make sure the audio stays sync'd through this 
process?

Thanks,

Josh


More information about the ffmpeg-user mailing list