[Ffmpeg-devel] [PATCH] fix (?) 2pass convergence errors
Corey Hickey
bugfood-ml
Mon Sep 4 22:58:11 CEST 2006
Michael Niedermayer wrote:
>>> if(toobig==0){
>>> av_log(s->avctx, AV_LOG_INFO,
>>> "[lavc ratecontrol] Using all of requested bitrate is not "
>>> "possible for this video with these parameters. (try decreasing qmin)\n");
>> I thought about a recommendation like that earlier, but I decided
>> against it because there are too many possible solutions to include in a
>> small message.
>>
>> * decrease qmin
>> * decrease lmin if necessary
>> * decrease vratetol if you have a short video
>> * make sure lavc is getting the right framerate and number of frames
>> * don't downscale the source video as much
>> * don't denoise as much
>> * don't worry about it; be happy with a smaller file
>> * you can use fewer high-quality options if you want faster processing
>
> ok s/(try decreasing qmin)/see DOCS\/foobar.txt/
All right. I'll put a note like that in when I write the doc.
>>> PS: the step_mult stuff from x264 ratecontrol.c should be ported assuming
>>> they (loren?) doesnt mind relicensing the few related lines under LGPL of
>>> course ...
>> I hadn't realized how similar the two ratecontrol.c files were. :) Are
>> you talking about simply:
>>
>> 1. add this calculation:
>> step_mult = all_available_bits / expected_bits;
>>
>> 2. Use this for the corresponding loop control:
>> for(step = 1E4 * step_mult; step > 1E-7 * step_mult; step *= 0.5){
>>
>> 3. alter the if(toobig==40) you recommended because the for() will loop
>> a different number of times.
>>
>> Would I have to change anything else?
>
> yes, the (1pass qscale) expected_bits calculation, in x264 its:
>
> expected_bits = 1;
> for(i=0; i<rcc->num_entries; i++)
> expected_bits += qscale2bits(&rcc->entry[i], get_qscale(h, &rcc->entry[i], 1.0, i));
> step_mult = all_available_bits / expected_bits;
Ok. I'll keep that in mind. Those changes can be a separate patch, I
think, so I'll do that later (pending Loren's "ok").
I have to go do other stuff for now; if nobody has objected by this
evening, I'll apply my most recent patch.
Thanks again,
Corey
More information about the ffmpeg-devel
mailing list