View Full Version : x264 rate control modes
xxxyyyzzzz
4th September 2013, 03:34
Recently I am reading the x264 source codes. Mostly, I concern the RC part. And I am confused about the parameters --bitrate and --vbv-maxrate. When bitrate is set, the CBR mode is used in frame level. If you want to start the MB level RC, the parameters bitrate, vbv-maxrate and vbv-bufsize should be set. But I don't know the relationship between bitrate and vbv-maxrate.
What is the criterion of the real encoding result when bitrate and vbv-maxrate are both set?
And what is the recommended value for bitrate? Equals to vbv-maxrate?
Also what is the recommended value for vbv-bufsize? Half of vbv-maxrate? Please give me some advice.
sneaker_ger
4th September 2013, 07:48
--bitrate sets the average bitrate of the complete encode
--vbv-bufsize sets the size of the decoding buffer
--vbv-maxrate sets the maximum bitrate at which said buffer can be filled
If --bitrate is equal to --vbv-maxrate, CBR encoding will be used. (if --bitrate is greater than --vbv-maxrate, x264 will automatically reduce --bitrate to equal --vbv-maxrate)
You set --bitrate according to the final filesize/average bitrate you want to achieve. (Or use the constant quality mode, i.e. --crf)
You set --vbv-maxrate according to the hardware capabilities of your device (e.g. the CPU/decoder of the player or the speed of your internet connection)
You set --vbv-bufsize according to the hardware capabilities of your device (the memory of the player) and the maximum time you want to spend on buffering. (--vbv-bufsize/--vbv-maxrate = maximum time in seconds it takes to buffer the video before starting to play * (http://mewiki.project357.com/wiki/X264_Settings#vbv-init))
H.264 has predefined levels to help choosing the correct --vbv-maxrate and --vbv-bufsize values:
https://forum.handbrake.fr/download/file.php?id=50&sid=27ffdae5eb5f5a8993c782e0d94f70fb&mode=view
xxxyyyzzzz
4th September 2013, 13:25
Thanks for your reply.
I test some sequences using x264. When --bitrate and --vbv-maxrate are both set, the fininal real bitrate is close to the value of vbv-maxrate and may exceed --bitrate? If bitrate sets the size of the final size, how can you explain this?
sneaker_ger
4th September 2013, 13:34
Are you using x264 revision 2340 or older?
xxxyyyzzzz
5th September 2013, 01:56
I am using the x264-snapshot-20060316-2245. Are there too many changes between different versions?
nhakobian
5th September 2013, 06:22
I am using the x264-snapshot-20060316-2245. Are there too many changes between different versions?
Yes.
You are using a version that is almost 7.5 years old. That would be somewhere around revision 468. Thats close to 2000 (!) revisions out of date, with some revisions being extremely complex.
Why are you using something ridiculously out of date? For future note, its usually good form to try the latest version before reporting a bug. It saves time on your end and other people's end, and saves developers a huge headache.
Now, if you have a specific reason for using that old version, you might want to also state that. You may also want to take a look at guides at how to write a bug report. They usually have instructions on performing good first order checks that'll save you time and headaches overall.
sneaker_ger
5th September 2013, 08:27
The master git: http://git.videolan.org/gitweb.cgi?p=x264.git;a=summary
Up-to-date binaries: http://download.videolan.org/pub/x264/binaries/
This is a recent change you are missing:
http://git.videolan.org/gitweb.cgi?p=x264.git;a=commit;h=e4ac506d2cbeceb7d1cbe02e2e69dac6ac57975a
xxxyyyzzzz
5th September 2013, 08:31
Haha, thanks. I think the RC source codes of the new versions may be too complex to understand for me.
Thanks for you advice. I will find some new versions.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.