[FFmpeg-devel] [PATCH] Detect CFR/VFR in libx264.c for proper i_fps_*
Fri Feb 11 21:22:19 CET 2011
On Fri, Feb 11, 2011 at 09:16:49PM +0100, Rudolf Polzer wrote:
> This change adds a detection of constant/variable frame rate by the same
> heuristics as libavformat/utils.c already uses (in performing or refusing
> frame duration calculation). The heuristics is basically to check whether
> the time base is larger than 1ms, and assume CFR then, VFR otherwise.
> Without it, x264 estimates a huge macroblock rate, and thus forces H.264 level
> 5.1 even if the input could perfectly fine pass as e.g. level 2.1.
Additional note: the "real" fix to this, long-term, would be an interface
change to add a VFR flag both to the AVCodecContext and to the AVStream (latter
being used by libavformat/utils.c's VFR check). However, this should make
existing libavcodec-using applications work well enough already.
The x4->params.b_vfr_input does not necessarily need to be handled here, as it
defaults to 1 and there isn't much disadvantage in setting the flag for CFR
input according to Dark_Shikari (other than an additional frame of encoding
More information about the ffmpeg-devel