[FFmpeg-user] Need help understanding framerate conversion!

Andy Furniss adf.lists at gmail.com
Fri Jan 13 13:19:53 EET 2017


Matthias, Thomas wrote:
> 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!

I don't know how to do it "properly" but years ago I had to make a dvd 
for someone and wanted to speed up 23.98 to 25 fps.

This is just a paste from old notes = it may be crap in multiple ways!

Possibly you could use fractions rather than decimal for the pts/atempo 
corrections.

untested - I don't even know if it will work now, I guess it was OK at 
the time (unless I saved a failing version!).

ffmpeg -i in-23.98fps.avi -r 25 -filter_complex 
"[0:v]setpts=0.95904096*PTS[v];[0:a]atempo=1.04270833229[a]" -map "[v]" 
-map "[a]" -target pal-dvd -bf 2 -mbd rd -trellis 2 -cmp 2 -subcmp 2 
-aspect 16/9 -acodec ac3 -b:a 128k out-25fps.mpg




>
> ~Thomas
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>



More information about the ffmpeg-user mailing list