Eliminating H.264 bitrate peaks with Handbrake
When encoding video to x264 for theatrical screening using Handbrake open
source encoder, bitrate is to high. When it comes to more complex scenes,
screening computer doesn’t handle it.
Limit maximum bitrate in peaks. Although Handbrake has some settings in it’s
GUI, internally used encoder can accept much more options using “Advanced
Option String” in “Advanced” tab.
in Advanced Option String.
Each option=value pair is separated by colon.
// Codebird made careful evaluation of some such options and compared
// the results in graphs.
// You can find in deep explanation of all the options for x264 encoding
// in "Video Encoding Settings for H264 Excellence".
For limiting maximum bitrate set option vbv-maxrate and vbv-bufsize.
vbv-maxrate is accepted only in conjunction with vbv-bufsize, otherwise it
will be ignored. vbv-bufsize is the size of buffer, rule of thumb is twice the
value of maxrate.
For desired Average bitrate 10000 kbps I use setting:
which limits bitrate peaks to 12000 kbps.
!!! As of Handbrake version 0.10 vbv-maxrate doesn’t work with “Constant
!!! quality” mode.
For evaluation of bitrate you can use command-line utility 'plotframes'
(requires ffprobe of ffmpeg, gnuplot, and p5.22-json).
It plots a nice graph like:
For nicer results I use also the settings:
rc-lookahead is a number of frames which the encoder examines in advance to
optimise a bitrate flow. The more frames, the more RAM is used. 40 is nice
value, virtually no impact of increasing to more than 60. If you wanna to
save RAM, use 10.
b-adapt=2 is adapting the number of ‘b-frames’ using more sophisticated (and
more slow) algorithm.
me=tesa sets the motion-estimation algorithm to be better (and slower)
Resulting “advanced option string” for me is:
// This setting was tailor-made for One World film festival in Prague. They
// use nice bitrate of 10 000 kbps for FullHD screening, when Cannes film
// festival is satisfied with 2500 only!
Binary Sxizophreny - index of comp related stuff
Kangaroo's Homepage (czech)