Rate Control
CBR and constant-q (with or without QP-pattern) are supported.
Constant Bit Rate (CBR)
Aims to support a constant bitrate defined by a buffer model. The model aims to keep a constant level of buffer fullness without undershoots (bitrate too high) or overshoots.
Core CBR parameters are (see API Parameters):
- bitratekbps
- vbv_buffer_size
- vbv_max_rate
- strict_vbv
Additional parameters that may be used to affect the rate control process are:
- max_intra_kbits
- frame_kbits_limit
- enable_frame_skip
- qpmin
- qpmax
Core CBR parameters
vbv_max_rate is the rate (in kbps) at which bits are deemed to be received in the VBV model: bits are added at this rate, and actual bits used removed. If vbv_max_rate is larger than the bitrate, the buffer will tend towards fullness which allows for large frames to be accommodated but can produce a more although the rate control aims to be much tighter than this. Reducing vbv_max_rate and vbv_buffer_size results in a tighter rate control, typically in a trade-off with video quality.
In all cases the rate control will try to respect the buffer parameters i.e. avoid underflow and overflow. strict_vbv will impose an additional limit on frame sizes according to how many bits remain in the buffer. By default strict_vbv is 0 for screen content and 1 for camera content.
Additional parameters
Minimum quality levels may be imposed by setting qpmax. This may cause VBV non-compliance if frames get too big. This can be controlled by frame size limits and/or enabling frame skip.
Intra and inter frame sizes may be directly controlled with max_intra_kbits/frame_kbits_limit.
enable_frame_skip = N allows for a maximum of N frames to be skipped (dropped) in a row by the rate control. For dynamic content 3 may be a reasonable number. Using a large value will give effectively unlimited dropping. Using a small value will maintain a reduced frame rate for a period.
qpmin sets the maximum quality that frames may achieve. If set too high this can cause bit rates to undershoot.