After browsing around Google, I've came across this page about h264 encoding and discovered about qp. https://trac.ffmpeg.org/wiki/Encode/H.264
My questions are: What are the differences with crf and qp? Is it better to use qp over crf overall, or is it only if for using qp 0 for best lossless? Does qp have a known sensible setting if it's preferred? So far, I know crf has the default value of 23 while 18 is a sensible preferred increase in quality, although I don't understand why 18 wouldn't be default if better sensible lossless. Lastly, would changing either of them cause incompatibility with non-ffmpeg players or just qp?
I'm converting from webm to mp4 by the way.
I was going to test crf 23 and 18 and pick which is best but I can't seem to find any concrete information on this comparison or about qp.
The Constant Rate Factor or CRF is an option available in the libx264 encoder to set our desired output quality. It enables us to specify a target value that maps to a specific quality by adjusting the bitrates automatically based on the input video.
Similar to how CQP gives you a range of 0 to 30, with the lower numbers being better quality, CRF ranges from 0 to 51, with around 17 to 24 being considered 'good quality'. Approximately every 6 points will double your file size, and as you can imagine, subtracting 6 will halve it.
VMAF 93 = Good Enough So, if you're using CRF 20, you're almost certainly delivering a VMAF quality that's higher than 93-95 (since lower CRF values deliver higher quality). This means that the data rate on all videos that you distribute is likely too high, or at least higher than it needs to be.
– Bitrate variability. – Cost (2 or more passes) – Most other VOD. CRF. – Adjusts data rate to achieve quality.
When you set the quantization parameter QP
directly it remains constant throughout the encoding and each frame will be compressed based on the set value.
Constant rate factor CRF
allows the QP
to go up for frames with a lot of motion or down for still frames resulting in a consistent perceived quality while keeping the compression efficient.
This article explains it very well.
The CRF
default is just a default, you need to pick a value adapted for your type of video. FFmpeg has filters like PSNR and SSIM which allow you to compare the results.
Just for the record, -qp
is supported by both livx264
and h264_nvenc
codecs (CUDA-backed coded).
CUDA ignores -crf
, which took me forever to notice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With