[x264-devel] Making sense out of x264 rate control methods
Horacio Sanson
hsanson at gmail.com
Thu Feb 18 03:20:16 CET 2010
I am learning how to use the rate control methods that x264 supports and
I would like to confirm that my knowledge on the topic is correct:
CQP Mode
- Always use constant QP for I, P and B frames.
- To enable in x264 use qp, ipratio and pbratio to select the
desired qp values for P, I and B frames respectively.
- Use only for first pass, a second pass offers no benefits.
- Old rate control method deprecated in favor of CRF mode.
- Not good for generating one pass log files.
x264 --qp 23 --ipratio 1.4 --pbratio 1.3 -o <output> <input>
ABR Mode
- Tries to keep the encoded media around the desired bitrate. No
guarantees.
- To enable in x264 simply set bitrate parameter.
- qp_min, qp_max and qp_step can be used to control the
quality of ABR mode?
- qp, ipratio and pbratio are ignored in ABR mode?
- Good for generating the first pass log file that can be used for
subsequent VBR or CBR second passes.
x264 --bitrate 1500 -o <output> <input>
VBR Mode
- By running ABR mode two or more passes we automatically get VBR
mode.
- Does a better job at keeping the media around the desired bitrate
than ABR but takes longer encoding time
- Good for generating second and subsequent log pass files. Run as
many times as desired but after 3 passes quality improvements are
negligible.
x264 --pass 1 --bitrate 1500 -o <output> <input> # ABR Mode
x264 --pass 2 --bitrate 1500 -o <output> <input> # VBR Mode
CBR Mode
- By running ABR mode and setting vbv_maxrate equal to bitrate we get
CBR mode.
- The hard limit in maxrate can cause high degradation in quality.
Only use if you really need to limit the bitrate below a certain
value.
- Not useful to generate first pass log files.
x264 --vbv-bufsize 2000 --bitrate 1000 -o <output> <input>
CRF Mode
- Good to keep constant quality over all the frames.
- No way to control the bitrate of the resulting file. We can vary
the CRF value until we get a desired bitrate but is better to
simply use ABR or VBR mode for this.
- 18 is the recomended setting for quality. more than 23 starts
showing quality degradation.
- One pass gives good results but can also be used for sencond and
subsequent passes.
x264 --crf 24 -o <output> <input>
Lossless Mode
- Setting CRF to 0 or QP to 0 results in lossless encoding.
x264 --crf 0 -o <output> <input>
or
x264 --qp 0 -o <output> <input>
For single pass encodings I should use use CQP, ABR, CBR, CRF or Lossless.
- Lossless if you want a perfect copy of the original and bitrate/size
is not a problem.
- ABR if you care about bitrate (e.g. streaming)
- CRF if you care about quality and bitrate/size is irrelevant.
- CQP and CBR are deprecated by CRF and CBR respectively.
For two or more pass encodings we can use ABR or CRF as first pass, VBR,
CRF as subsequent passes and VBR or CBR for last pass.
- What advantages of using each combination is beyond me. If someone
has experience with this please share.
Comments, error, tips are all appreciated....
--
regards,
Horacio Sanson
More information about the x264-devel
mailing list