GNOME Bugzilla – Bug 719699
encoder: h264: improve bitrate calculation
Last modified: 2014-01-13 16:41:31 UTC
The set of vaapiencode_h264 options mention that a value of 0 (zero) for "bitrate" means that the target bitrate would be estimated. However, the GstVaapiEncoderH264 implementation does not seem to honour that. For CQP rate control mode, the bitrate cannot be predicted. So, this is not an issue per se. For non CQP modes, it would be necessary to better estimate the defaults. Better heuristics could be determined through appropriate testing, but here are some suggestions. If tuning for "size", reasonable defaults could be F = 0.1875 bits per pixel. Then, if "cabac" is set to FALSE, F *= 1.18 (or 1.10). If "dct8x8" is set to FALSE, F *= 1.10, etc. Yes, this is arbitrary, based on some articles, but better suggestions are welcome. :)
Reasonable heuristic, and considering that target_percentage is 70% of the supplied target bitrate, could be 48 bits per macroblock in "high-compression" mode (CABAC + DCT8x8), and increasing by 10% per each coding tool disabled.
commit c7a2095b78f9b543b9e97b8556d1d67f2e23487b Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com> Date: Mon Jan 13 11:49:14 2014 +0100 encoder: h264: improve automatic bitrate calculation. For non "Constant-QP" modes, we could provide more reasonable heuristics for the target bitrate. In general, 48 bits per macroblock with all the useful coding tools enable looks safe enough. Then, this rate is raised by +10% to +15% for each coding tool that is disabled. https://bugzilla.gnome.org/show_bug.cgi?id=719699