[FFmpeg-user] Need help understanding framerate conversion!

Matthias, Thomas Thomas.Matthias at dolby.com
Fri Jan 13 04:54:33 EET 2017

Hi All,

I need to mux and then framerate convert a rawvideo .mov file, and a PCM 16bit 48Khz wav file.

For example,  a .mov file is exactly 10 seconds long, and a .wav file is also exactly 10 seconds.  The initial .mov file is a 30 frames-per-second, but after muxing with the audio, I need to convert it to 29.97.  The issue I’m seeing is that for some reason, the resulting video file is slightly longer than 10 seconds, and the resulting audio is just shy of 10 seconds.  This leads to the audio being out-of-sync with the video by the end of the video.  In reality, I’m performing this task with much longer clips, and so the av-sync issue is much more noticeable, but even at 10 seconds the sync offset is noticeable in a video editor.

What am I doing wrong?  I’ve tried separating the muxing and framerate conversion into separate FFmpeg calls, but that doesn’t help. I’ve tried numerous setting combinations, but nothing keeps the audio at the correct length.  I’ve tried using atempo to stretch the audio, but that doesn’t even seem to work.  Here is an example command I’ve tried:

ffmpeg –y –i initial_video.mov –i initial_audio.wav –c:v  rawvideo –c:a pcm_s16le –pix_fmt uyvy422 –r 30000/1001 output.mov

I’m clearly missing something here, but I have no idea why the audio track would end up shorter (in the 10s example, it’s about 9.98 seconds after), and the video longer (about 10.06).  Thanks!


More information about the ffmpeg-user mailing list