[FFmpeg-user] Need help understanding framerate conversion!

Moritz Barsnick barsnick at gmx.net
Fri Jan 13 12:04:28 EET 2017


On Fri, Jan 13, 2017 at 02:54:33 +0000, Matthias, Thomas wrote:
> 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!

(You should usually show us your complete, unabridged console output
along with the ffmpeg command.)

I have no idea either. Using an ideal source - i.e. ffmpeg lavfi
sources - I get what I consider the correct behavior. Albeit, at 10
seconds, ffmpeg has no reason to drop any video frames, as 30 fps is
close enough to 30000/1001. ffmpeg encodes 300 frames, and thus the
video gets *slightly* longer. The audio is decoded at exactly 10
seconds.

I may be missing something totally, but:

What could be the issue is that your input video (and/or audio) doesn't
actually have equi-distant frames, i.e. a slightly varying frame rate
(and only the header indicated 30 fps). You would check this with

$ ffprobe -show_packets input.mov | grep -E '^(codec_type|duration_time)=' | grep -A1 video

I get:
    codec_type=video
    duration_time=0.033367
    --
    codec_type=video
    duration_time=0.033367
    --

all the way through for 30000/1001, duration_time=0.033333 for 30 fps.
Perhaps your source video has some variations.

You could also try the "fps" filter instead of the "-r" output option.
If I understand correctly, it uses different mechanisms to change the
framerate.

Cheers,
Moritz


More information about the ffmpeg-user mailing list