[FFmpeg-user] Need help understanding framerate conversion!

Carles Vila cvilad at gmail.com
Fri Jan 13 18:15:16 EET 2017


The reason that the resulting video is longer is simple: it plays slower!
which is what you want (pull-down)

By default, ffmpeg does nothing to the audio, so you must stretch it. The
most simple solution is to resample it.
Try this command line below: the -r before the input tells ffmpeg to
interpret the input as 29,97. Assuming that your source audio is at 48.000
Hz,  the asetrate sets a "fake"  sampling rate to 47952 (stretches the
audio longer by the same ratio) and after that aresample resamples back to
48000 Hz.

ffmpeg -r 30000/1001 -i input_30fps.mov –i initial_audio.wav -af
asetrate=47952,aresample=48000 -c:v rawvideo -c:a pcm_s16le –pix_fmt
uyvy422 output_2997fps_withresampledaudio.mov

HTH

On 13 January 2017 at 03:54, Matthias, Thomas <Thomas.Matthias at dolby.com>
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!
>
> ~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