[XviD-devel] variable bitrate encoding

Edouard Gomez ed.gomez at free.fr
Thu Jul 24 12:48:55 CEST 2003


Olaf Landsiedel (olaf at olafland.de) wrote:
> I am working on my thesis / Diploma. It is partly about mpeg4 and rtp.
> For the  congestion control of  rtp transmissions a variable  bit rate
> encoding would be perfect.
> 
> I do not want to change more  than needed in the sources of xvid, so I
> thought I  should ask  you guys for  some advice. Looking  through the
> sources, it seemed  that setting encoder->rate_control->target_rate to
> the   new   desired  bit   rate   should   work   fine.  In   addition
> target_framesize and avg_framesize have  to be recomputed and set with
> the new values.
> 
> Is this idea correct? Is it really so easy? Did I miss anything?
> 
> Or is it all way more complex? 

I  guess   you're  talking  about   0.9.x  series  or   current  cvshead
version. 

Then i would advise you not to use the CBR rate controller as a starting
point  for VBR.  Our CBR  implementation is  rather simplistic,  and you
already  have a  good  overview of  "how  it works"...  but it's  really
targeting a CBR design. 

The algorithm used is:
 1/ how many  bits should have we  spent if we had  respected the desired
    bitrate  (depends  only  on  desired  bitrate +  number  of  encoded
    frames+1). 
 2/ how many bits did we really used (depends on a real total)
 3/ Then we subtract the two  totals (desired, and real), and we compute
    a Qp that should respect that number of bytes.

The two parameters  you try to modify,  are used in 1/ but  i don't it's
the way  to do VBR  (varying CBR parameters  is not very secure,  it has
never been thought this way). 

My advice would be you use the dev-api-4 CVS branch and write your rate
controler  plugin. It  would give  you far  more power  on  all encoding
paremeters (including the dquant array if you need a very precise quant)

-- 
Edouard Gomez


More information about the XviD-devel mailing list