Log in

View Full Version : "absolute" quality factor


ronny85
13th April 2017, 17:21
i have two videos of the same scene

1080p, 4mbps
720p, 3mbps


using a bounded crf25 parameter (max27 min22) and scaled to 800x400 i get different file sizes

using the 1080p as source i get a 1.7gig output file
the 720p gives a 1.1gig


soundn't crf be supposed to give a similar file size? or, how could i get around this?

thank you

Sharc
13th April 2017, 19:11
... soundn't crf be supposed to give a similar file size? or, how could i get around this?

No! This assumption is totally wrong (unless I misunderstand the context of your question).
What encoding tool or GUI are you using? Does it provide a CRF prediction for targeting a certain file size?

Generally, CRF stands for Constant Rate Factor - and nothing else.
In terms of viewing quality of an encode it aims at providing a consistent (or constant) viewing quality experience throughout a movie for a given set of encoding parameters ("encoder settings"). The resulting filesize depends on the complexity and resolution of the source.
For a fixed encoder setting and same source:
- lower CRF values produce larger file sizes and better quality (less compression)
- higher CRF values produce lower file size and lower quality (more compression)
But that's it.

If you target a fixed files size you have to go for 2-pass encoding, unless your tool provides some more or less reliable CRF => file size prediction method based on samples.

Wrong interpretations/assumptions:
- CRF stands for constant or same quality, independent of the source and encoder settings
- A fixed CRF produces same and/or predictable file size

Just google for it, and read the wikis and help files of x264 and its many GUIs.

LoRd_MuldeR
13th April 2017, 20:32
CRF is not an "absolute" quality factor. The only thing you know is that the same CRF value gives roughly the same perceived quality for different sources - provided that you don't change any other options, such as, e.g., the "--preset".

Furthermore, the same CRF value can result in very different bitrates, depending on the "complexity" of the source!

Finally, I would assume that the "1080p" (4 mbps) source contains a lot more details/grain than the "720p" (3 mbsp) source of the same scene. So, even after both sources have been resized to 800×400 pixels, the clip that was created from the "1080p" source is probably significantly more detailed/sharp/grainy (i.e. more complex!) than the clip created from the "720p" source - and therefore results in a higher bitrate when encoded with the same CRF value.

BTW: As a test, you can encode the same source clip twice, at the same CRF value. One time you encode the clip "as is", and one time you add some grain (http://avisynth.nl/index.php/AddGrainC) prior to encoding. You will see how adding some grain significantly bumps the bitrate!

ronny85
13th April 2017, 22:06
thank you for your time

i know that crf is not absolute, I was hilarious and that's why i used the ""

I was wondering if there is a way to calibrate crf to reach the same quality for both files


I mean, crf is used to reduce quality, FROM a source file

i just want to know to choose the appropiate crf, so that, the reduced quality make both files look similar


both my files represent the same scene, the same length, the same final display size

using plain cli x264 or ffmpeg, no avisynth or vapoursynth
(adding noise to the video seems too weird to me... )

Sharc
13th April 2017, 22:29
How do you measure "same quality"?
Encode both videos to a black picture, and you get the "same quality" for both.;)

ronny85
13th April 2017, 22:41
at least similar psnr ssim relative to the highest quality video for the encoded files :)

Sharc
13th April 2017, 22:49
And what is your "highest quality video"?

ronny85
13th April 2017, 23:02
And what is your "highest quality video"?

the 1080p version...

Sharc
13th April 2017, 23:27
Ok, so take the 1080 version as your reference and downscale it to 720 which is now the new reference, call it A. Now encode it with a CRF of your choice and calculate the psnr with reference to A. Call this psnr value X.
Now take your alternate 720 version and encode it with a sequence of different CRF and for every CRF calculate the psnr with respect to A until you get X.
It's a lost case, but I wish you good luck.
Perhaps someone else has a better proposal.

ronny85
13th April 2017, 23:36
so there is no solution, thank u

Bloax
14th April 2017, 06:21
If you want to scale them down and encode them and it's the exact same scene with the exact same frame timings then I would just scale the 1080p one down, blend it together with the 720p version to hopefully salvage something more whole from the two of them and then scale it down to the final resolution. : )

ajp_anton
14th April 2017, 11:03
If you want to scale them down and encode them and it's the exact same scene with the exact same frame timings then I would just scale the 1080p one down, blend it together with the 720p version to hopefully salvage something more whole from the two of them and then scale it down to the final resolution. : )
Why would blending them salvage something more? If the 1080p source is of higher quality, blending the 720p source to it would more likely *remove* detail than add/salvage anything new. After all, you're getting a dumb blend of high and low quality, which is somewhere between high and low quality. Unless you have some intelligent algorithm that chooses what to pick from which source, but otherwise always use only the higher quality source.

benwaggoner
19th April 2017, 23:33
so there is no solution, thank u
If we had a good absolute quality metric, than all encoders would tune for that metric, and all encoding would be close to optimal for a given bitrate without much need for encoder tuning.

Alas, we keep thinking of more and more and better and better psychovisual optimizations, which let us improve perceptual quality while decorrelating with existing metrics.