- Constant rate factor
-
Constant Rate Factor (CRF) is a x264's single-pass encoding method.
Contents
Overview
The way constant quality encoding is usually done, it keeps up a constant quality by compressing every frame of the same type the same amount. In technical speak, that's maintaining a constant quantization parameter (QP). Constant Rate Factor, on the other hand, compresses different frames by different amounts. It does this by taking motion into account.
The eye perceives more detail in still objects than when they're in motion. Because of this, a video compressor can apply more compression (drop more detail) when things are moving, and apply less compression (retain more detail) when things are still. Subjectively, the video will seem to have higher quality.
Constant Quantization Parameter (CQP) mostly don't produce better visual quality as it just wastes space by compressing less in areas one really won't notice. This compares to MP3 encoding cutting off high and low frequencies in music that are audible on CDs.
If one were a computer then it would look at a Constant Rate Factor encoding and say it was lower quality than the Constant Quantization Parameter copy. And it would be. But if one is a human being, the Constant Rate Factor copy will look better because of perception subjectivity. It least compresses the parts you see the most, and most compresses the parts you see the least.
Technical details
A Constant Quantization Parameter encode at Q=18 will stay at Q=18 regardless of the frame. Constant Rate Factor will increase the Q to, say, 20, for high motion frames (compressing them more) and lower it down to 16 for low motion. That means that while the average quality as objectively gauged by peak signal-to-noise ratio (PSNR) goes slightly down, the perceptible image quality goes up.
When you use a constant rate factor, it varies the QP slightly. When a scene has a lot of action and motion, it will raise the quantization parameter (compressing more). This is because your eye will be distracted by everything going on, and won't have the image on screen for enough time to see the heavier compression. When a frame doesn't have a lot of motion, it will lower the QP, compressing it less. This is because your eye will have more time to look at the image, so you want it to be as much like the source as possible.
Constant Rate Factor is about improving subjective quality (or what the human eye sees) at the expense of objective quality (what a PSNR calculation sees). There is no way for anyone to tell you what your eye will notice on any given film.
Not a common knowledge
Constant Rate Factor is not the cause of the blocking you might see on digital cable or satellite broadcasts.
That derives from too low of a bitrate. Different bitrates correspond to different compression rate factors with different sources. So 1500 kbps will be enough to get a rate factor of 15 with one source, but only a rate factor of 20 with another, dirtier source. When someone use CRF or CQP it's like ordering "use whatever bitrate is necessary to preserve this much detail".
Those TV broadcasts get blocky because the complex things they're displaying require more bits than the broadcaster has chosen to give them. They order "preserve as much detail as you can while never going above this high a bitrate no matter how complicated things get."
Lower overall size and quality isn't always a bad thing.
When using Constant Rate Factor, codec raises the quantization parameter (compressing more, losing more detail) for complex parts but doesn't raise it drastically, and it makes sure those complex parts still maintain a set quality level. Just a level lower than the simple parts. The bitrate for those parts might still be higher than for the simple parts, because the bitrate needed at a given moment to reach a given rate factor fluctuates. So overall size and quality may be lowered but overall perceived quality will be sustained in any case.
See also
References
External links
Categories:- C libraries
- Free multimedia codecs, containers, and splitters
- Free video software
- Video codecs
Wikimedia Foundation. 2010.