[FFmpeg-devel] [PATCH] Fix ratecontrol bug when time_base.num > 1
joseph at mirriad.com
Fri Nov 16 17:01:26 CET 2012
On 16/11/2012 15:28, Kieran Kunhya wrote:
>> I dont fully understand the problem, so its hard to suggest how to
>> fix it.
> The problem is his application doesn't like the timebase as a reduced
> fraction, but would rather
> have it as a reducible fraction.
Not quite. That's only part of the problem. The following line of code
wanted_bits = (uint64_t)(s->bit_rate*(double)dts_pic->f.pts / fps);
won't work correctly for any time_base where numerator is greater than
1, as it doesn't consider the scale of dts_pic. For instance, it will
fail on your typical NTSC timing of 1001/30000. Now, the obvious fix is
to include s->avctx->time_base.num into the denominator of the above
line of code. That would fix the NTSC case, but not my case, which was
24/600, as s->avctx->time_base gets automatically reduced to 1/25.
Therefore, I went with s->dts_delta instead of s->avctx->time_base.num.
However, Michael explained it's not suited for that purpose.
So, a fix for ffmpeg is necessary in any case, the only question is how
to fix it in such a way and it works for reducible ratios.
Senior C++ Applications Developer
More information about the ffmpeg-devel