ZiNgA BuRgA Wrote:This is my interpretation of what CRF is (may be wrong):
Here wee have two images, each compressed with JPEG @ 80% quality.
Now, let's ramp down the quality to JPEG @ 15% quality:
This "quality" setting is like a quantizer, since you specify a rate and the compressor determines the number of bits to use. As you can probably guess, the 2nd image is always smaller than the first.
However, although both look horrible at 15% quality, it "doesn't really matter" for the right image, since there's not much detail there anyway, as opposed to the left image.
So if wee assume wee have a video with just those two frames, and there's enough copies of each so that the encoder can't find them in its look ahead phase...
...a single pass ABR would most likely reduce the first image to a lower quality than the second.
...a single pass constant quantizer will give the results above.
...a two pass encode (ABR or CRF) would allocate a higher quality to the first image, and a lower quality to the second image.
Well, that's my guess anyway.
Crf mode basically is a complexity compensated CQ mode.
So that "quality" in your picture example is more equivalent of a CRF encode or an ABR encode than a "quantizer" encode.
A constant quantizer encode would distribute enough bits so that both the above pictures looks pretty much the same perceived quality. That is, a CQ encode would dump a lot more bits into the the more complex picture, and less into the second.
A CBR encode would dump an exact equal amount of bits into each picture. And ABR encode just slightly "wiser" distributed than CBR, but is not too different from CBR.
Now, it costs more bits to increase the perceived quality of the more complicated image than the simpler image. And putting additional bits into each will yield diminishing returns in quality.
Then imagine a distribution of bits between the two frames that can be said to be "optimal", that is, providing the best average quality. That optimal rate will lie somewhere in between CQ and CBR.
Imagine a distribution algorithm that decides what "optimal" quantizer to assign to frames of different complexity. Now assume this rate control equation is perfect. Therefore, for any given input rate factor, the quation will generate the best quantizer values to use in each frame of different complexity. With a higher rate factor giving more quality to each picture of different complexity.
It follows that if the 2 frames have the same rate factor, then the total amount of bits is distributed perfectly among the 2 frames to exactly compensate for their difference in complexity in the optimal way.
Now that distribution above is exactly what 2-pass encodes aim for. What 2-pass does is to attempt to use the recorded complexity values from the 1st pass to determine how to best distribute the set amount of bits in the 2nd pass. Then that would be equivalent of trying to achieve the exact same rate factor for each frame, according to what I previously defined the rate factor as.
So basically,
1-pass Crf = perfect distribution always achieved not caring about size.
2-pass size based = Tries to achieve perfect distribution for given size.
Now the rate control equation is not going to be perfect, be that doesn't matter, because both the Crf and the 2-pass are depending on the same equation, so any inaccuracies will effect both. And the 2-pass will NOT be able to achieve 100% accurate distribution.
Therefore 1-pass Crf > 2-pass if they have the exact same output size.
Therefore it is completely pointless to do any more than 1 passes for Crf. It is already more perfect than any 2-pass hopes to become.
Basically, in terms of flexibility:
Least Flexible -» Most Flexible
CBR » ABR » Multi-Pass «> CRF » CQ where CRF is theoretically optimal.
ZiNgA BuRgA Wrote:Possibly - I've never seen anyone using 2 pass CRF.
But CRF and quantizer are different. What you described basically, was quantizer. A constant quantizer encode will be pretty much fixed.
Yeah, I did make my theory sound a bit like CQP in the previous posts. But the main point that the crf would give better results carries through.
And a constant rate factor encode will also be fixed. Fixed at a constant rate factor (that is, fixed quantizers for every complexity level). :P