[x264-devel] Re: clarification on rate control

Daniel Rogers daniel at phasevelocity.org
Thu Apr 6 03:57:48 CEST 2006


On Apr 5, 2006, at 6:14 PM, Jeff Clagg wrote:

> VBR: bitrate VARIES. A constant qp encode is VBR.
>
> ABR: Local bitrate vary, perhaps by arbitrary large amounts, but  
> overall
> there is some target average bitrate.
>
> CBR: Local bitrate varies within constraints that are defined by
> vbv_buffer size and vbv_max_bitrate.

Let me see if I got this right:
to get VBR: do a constant (or ranged) qp encode
to get ABR: set a bitrate
to get CBR: set a bitrate, a max bitrate, and a buffer_size


>> Q6: I get the feeling that the vbv_X parameters are the ones that are
>> most powerful for controlling maximum bit rate.  I want to understand
>> how to set a max bitrate in a file.  If my max_bitrate is, for  
>> example,
>> 768, and I want the stream to be encoded as baseline (or main)  
>> level 1.3
>> so for conformance I cannot _ever_ exceed this value, what length of
>> vbv_buffer_size to I need to choose to ensure this happens?
>
> I am pretty sure the spec addresses vbv buffer size (annex A).

It's a shame that the spec is not freely available. . .

> I'll let
> you figure out whether I'm right or wrong ;) Note that just because  
> your
> decoder claims it supports level 1.3, doesn't mean it'll never  
> tolerate
> slightly out-of-bounds input...
>
>> Essentially, I want ffmpeg (or QuickTime) to report that the  
>> bitrate of
>> the file as more more than 768.  Another way of asking this  
>> question is,
>> how is the bitrate of the entire stream caculated, and how to I  
>> pick a
>> vbv_buffer_size and vbv_max_bitrate such that vbv_max_bitrate is  
>> greater
>> than or equal to the bitrate of the entire file?
>
> If vbv_buffer_size and vbv_max_bitrate are set, and you've requested a
> bitrate < vbv_max_bitrate, you'll generally get this, although the
> ratecontrol is not quite perfect and you may get buffer underflows  
> in my
> experience.

I experienced that too.  I set vbv_max_bitrate to 768, and  
vbv_buffer_size to some large value (naively), and then watched as my  
peak bit rate ended up being around 1000.  I'm trying to understand  
how why this occurred.

>
>> Q7: My guess here is that the max 1 second long bit rate in the  
>> stream
>> determines the bitrate of the entire stream. If so, does this mean  
>> that
>> a vbv_buffer_size equal to one second at my desired max bitrate will
>> suit me?  How does picking a larger or smaller vbv_buffer_size affect
>> the final bitrate of the stream.  Also, as an important  
>> clarification,
>> what are the units of vbv_buffer_size (ie bits or bytes)?
>
> There's nothing special about 1 second.

Then what is special?  what determines the max bitrate of the  
stream?  How is max bitrate measured?  It it average max bitrate?  if  
so, what is the period of the averaging?

>
> vbv_max_bitrate determines max bitrate... why would you think the size
> of vbv_buffer_size does?

I can't find the reference right now, but I remember reading (I think  
it was in mplayer related documentation) that vbv_max_bitrate is  
based on your buffer_size.  I.e. with this understanding (which may  
be incorrect) vbv_max_bitrate defines a max _average_ bit rate, where  
the period of the average is determined by vbv_buffer_size.

> What exactly are you trying to achieve? What led you to ask all these
> questions?

Well, two things.  One is my own edification.  I like to understand  
what I am doing, not just how to do it.  Two, I am trying to tune  
some ipod video encodings.  I have something that works, but I would  
like to understand the parameters involved so I can make better  
judgements about what would make it better.

Basiclly, I could ask: how do I encode ipod video?  Then someone will  
tell me a list of flags.  If I ask someone to explain the flags, then  
I can figure out what I need to set for ipod video, and what  
compromises I am making in doing so.
-- 
Daniel

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list