[FFmpeg-devel] [RFC][PATCH] ticks_per_frame / timebase

Reimar Döffinger Reimar.Doeffinger
Thu Feb 26 16:40:51 CET 2009


On Thu, Feb 26, 2009 at 03:15:09PM +0100, Michael Niedermayer wrote:
> Attached is a patch that adds ticks_per_frame, which is a convertion factor
> between the timebase and the "framerate" as stored in the header.
> the patch also adapts several uses of timebase that where using it in the
> meaning of the framerate
> this patch is based on the one from ivan
> 
> i will commit this in a few hours if i receive no objections or better
> suggestions. (short delay because of the release ...)

I think you missed at least one place (though that might be broken as it
is anyways), the problem is libx264.c:
    x4->params.i_fps_num = avctx->time_base.den;
    x4->params.i_fps_den = avctx->time_base.num;

The problem here is that obviously libx264 uses this for its rate
control - which means after this change bitrate will be regularly off by a
factor of 2 for H.264->H.264 encodings.
Obviously the whole thing is rather silly since it can't work for
variable-fps at all, and for e.g. this file
http://samples.mplayerhq.hu/game-formats/interplay-mve/baldursgate-logo.mve
bitrate is even today already off by a factor 40000 due to this, and the wrong
level is encoded in the bitstream as well, but that is another point.




More information about the ffmpeg-devel mailing list