Discussion:
[MEncoder-users] x264: vbv bufsize
Nicolas Hesler
2007-12-06 14:14:11 UTC
Permalink
What is the vbv bufsize exactly and how do I calculate what size it
should be?

Let's say for bitrate 3000 and vbv_maxrate 4500

or

bitrate 3000 and vbv_maxrate 9500
Loren Merritt
2007-12-07 01:14:14 UTC
Permalink
Post by Nicolas Hesler
What is the vbv bufsize exactly and how do I calculate what size it
should be?
Let's say for bitrate 3000 and vbv_maxrate 4500
or
bitrate 3000 and vbv_maxrate 9500
vbv bufsize is the amount of memory a constant bitrate decoder needs to
allocate to buffering the incoming compressed bitstream. You don't
calculate it. There are 4 possible cases:
* You want to target a specific hardware deocder, and its documentation
says what bufsize it uses. Copy that size.
* You want to target a specific hardware deocder, and its documentation
doesn't say what bufsize it uses. You're screwed.
* You want to stream to a generic software player. Any bufsize works, but
the end user needs to specify the same (or larger) bufsize when playing.
It's a tradeoff between quality and latency, and there are no rules for
choosing an optimal value, any more than there are rules for choosing an
optimal bitrate.
* You aren't streaming nor targetting a hardware decoder. Don't use
constant bitrate.

--Loren Merritt
Nicolas Hesler
2007-12-07 14:10:45 UTC
Permalink
Post by Loren Merritt
Post by Nicolas Hesler
What is the vbv bufsize exactly and how do I calculate what size it
should be?
Let's say for bitrate 3000 and vbv_maxrate 4500
or
bitrate 3000 and vbv_maxrate 9500
vbv bufsize is the amount of memory a constant bitrate decoder needs to
allocate to buffering the incoming compressed bitstream. You don't
* You want to target a specific hardware deocder, and its documentation
says what bufsize it uses. Copy that size.
* You want to target a specific hardware deocder, and its documentation
doesn't say what bufsize it uses. You're screwed.
* You want to stream to a generic software player. Any bufsize works, but
the end user needs to specify the same (or larger) bufsize when playing.
It's a tradeoff between quality and latency, and there are no rules for
choosing an optimal value, any more than there are rules for choosing an
optimal bitrate.
* You aren't streaming nor targetting a hardware decoder. Don't use
constant bitrate.
--Loren Merritt
Thanks. That clears that up. But how do you set min and max bitrate on
a variable bitrate encode with x264?
Loren Merritt
2007-12-08 00:10:50 UTC
Permalink
Post by Nicolas Hesler
Thanks. That clears that up. But how do you set min and max bitrate on
a variable bitrate encode with x264?
vbv_maxrate is maxrate. You can't specify minimum bitrate, because there
aren't any situations in which a minimum bitrate is appropriate. If
maxrate > avgrate, why wouldn't you want easy scenes to compress as much
as possible and leave more bits for the hard scenes? If maxrate == avgrate,
then the encoder must use constant bitrate in order to satisfy both
constraints, so there's no need to separately specify minrate.

--Loren Merritt

Loading...