[FFmpeg-user] Image extraction broken with ffmpeg, but not with mencoder. How can I fix this?

Tom Evans tevans.uk at googlemail.com
Thu Sep 5 13:11:01 CEST 2013


On Wed, Sep 4, 2013 at 9:46 PM, James Board <jpboard2 at yahoo.com> wrote:
> I consulted the documentation.  It doesn't explain why how '-vsync 0' stops
> ffmpeg from artificially inserting duplicate frames into your output image files.
> If you think the documentation does explain this, them point out which sections
> explain.

The vsync section in the manual describes the behaviour of the
different vsync options.

"0" passes through each frame with its timestamp to the muxer. This
means if your source is VFR then you will not have a CFR output. If
you were transcoding video+audio, this would probably result in audio
desynch.

"1" will duplicate and/or drop frames as needed in order to have the
required output fps. Eg, if a section of the VFR video is 10fps, and
the requested ofps is 25fps, then ffmpeg will duplicate frames to get
the desired fps, and avoid audio desynch. This produces CFR files.

"2" can drop frames and/or pass them through with their timestamps to
the muxer. This enables the muxer to generate VFR files.

The default is "-1", which intelligently chooses between "1" and "2"
based upon the capabilities of the muxer you are feeding. So if you
don't want duplicates or dropped frames, you must not use "-1", "1" or
"2".

So why do you get the dupes. It would seem like your input video is
VFR, and you are outputting to image2, which is a CFR muxer, so ffmpeg
is duplicating frames to get your requested output.

BTW, this seemed quite clear to me from the docs for vsync. Could you
suggest any improvements that would have made it clearer for you?


The linked ticket explains the reasoning for this. This is effectively
your position:

> Yeah I agree that for most people, their default thought is
> "I'm converting to images? It will output one output image per
> input frame" so +1 from me for making -vsync vfr default in this case... :)

Versus the counterpoint:

> Some people expect that. Other people output to images to apply
> some external processing and then re-encode, and expect this process
> to keep A-V sync even if the source material had a few skipped black frames.

ffmpeg can do either, but one is the default and the other is the
option. You need the option.

Cheers

Tom


More information about the ffmpeg-user mailing list