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. // http://handbrake.fr


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.


Use: “rc-lookahead=10:b-adapt=2:me=tesa:vbv-maxrate=12000:vbv-bufsize=24000” 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. // http://birds-are-nice.me/publications/extremex264_1.shtml // You can find in deep explanation of all the options for x264 encoding // in "Video Encoding Settings for H264 Excellence". // http://www.lighterra.com/papers/videoencodingh264/ 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: “vbv-maxrate=12000:vbv-bufsize=24000” 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). // https://github.com/FFmpeg/FFmpeg/blob/master/tools/plotframes It plots a nice graph like: sample graph output out of 'plotframes' For nicer results I use also the settings: “rc-lookahead=40:b-adapt=2:me=tesarc-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: “rc-lookahead=40:b-adapt=2:me=tesa:vbv-maxrate=12000:vbv-bufsize=24000” // 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! EOF Comments requested ~~~~~~~~~ Binary Sxizophreny - index of comp related stuff Kangaroo's Homepage (czech)