[Ffmpeg-devel] [RFC] ratecontrol buffer size magic

Michael Niedermayer michaelni
Wed Apr 25 19:36:03 CEST 2007


Hi

On Wed, Apr 25, 2007 at 12:21:52PM +0200, Baptiste Coudurier wrote:
> Michael Niedermayer wrote:
> > Hi
> > 
> > On Thu, Apr 12, 2007 at 11:07:10AM +0200, Baptiste Coudurier wrote:
> >> Hi
> >>
> >> Michael Niedermayer wrote:
> >>> Hi
> >>>
> >>> On Wed, Apr 11, 2007 at 01:47:55PM +0200, Baptiste Coudurier wrote:
> >>>> Hi
> >>>>
> >>>> Michael Niedermayer wrote:
> >>>>> Hi
> >>>>>
> >>>>> On Thu, Apr 05, 2007 at 06:51:00PM +0200, Baptiste Coudurier wrote:
> >>>>>> Hi,
> >>>>>>
> >>>>>> I stumbed accross a weird behaviour of the CBR ratecontrol lately,
> >>>>>> basically doing:
> >>>>>>
> >>>>>>  ffmpeg -i file.mpg -vcodec mpeg2video -minrate 30000k -maxrate 30000k
> >>>>>> -b 30000k -intra -flags +ildct+low_delay -dc 10 -flags2
> >>>>>> +ivlc+non_linear_q -ps 1 -qmin 1 -qmax 12 -top 1 -vglobal 4 -acodec
> >>>>>> pcm_s16be -f mov -bufsize 1200000 -rc_init_occupancy 1200000 cbr.mov
> >>>>>>
> >>>>>> Constraints are so in order to achieve vbv delay as 3600.
> >>>>>> Now ffmpeg will only give me qp as 24. While tweaking I changed some
> >>>>>> magic in ratecontrol.c (see patch attached) and now qp have decent/good
> >>>>>> values.
> >>>>>>
> >>>>>> I dig into svn history and found out that r2601 bumped */2 to */3 to
> >>>>>> improve CBR ratecontrol. Can anyone explain in detail why that magic
> >>>>>> does improve behaviour ?
> >>>>> yes, your vbv buf size is VERY significantly too small it can barely
> >>>>> hold a single frame, increase it by a factor of 100 ...
> >>>>>
> >>>>> i hope theres no spec which mandates such nonsense parameters ...
> >>>>>
> >>>>>
> >>>>>> Can that parameter be user setable ? 
> >>>>> if you make it user settable ...
> >>>> Is something like that ok ?
> >>> yes except that name of the variable and the comment
> >> +
> >> +    /**
> >> +     * Ratecontrol available buffer space coefficient applied when
> >> choosing qp.
> > 
> > does anyone understand what this variable does based on this description?
> > no?
> > if no then patch rejected
> 
> Humm ok another try:
> 
>     /**
>      * Coefficient applied to buffer space, by ratecontrol,
>      * for limiting QP (bits2qp) when encoding with a buffer size.
>      * - encoding: Set by user.
>      * - decoding: unused
>      */
>     float rc_buffer_space_to_qp_coeff;

hmm its better
but still
the description says therese that parameter which is a coefficient
and that is applied to the buffer space, whats still unclear
* buffer? -> vbv buffer
* buffer space? is that the size of the whole buffer? of the free space
  left?
* applied? if id say ill apply a coeffificint to a number 95% of the math
  people would lynch me, its scaled or multiplied or something like that
  or if its a more complex operation then that should also be said more
  clearly
* also what is the now changed "buffer size" used for?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070425/24df512a/attachment.pgp>



More information about the ffmpeg-devel mailing list