View Full Version : Which VP9's crf value corresponds to x264's crf 20?
orion44
13th April 2021, 11:43
I want to encode a 480p movie with VP9 in two passes.
Google recommends to use crf 34 for low quality encoding of 480p video, and crf 33 for medium quality:
https://developers.google.com/media/vp9/settings/vod
I am also using '-tune-content film' option to optimize for grain.
Which crf value in VP9 corresponds to x264's crf 20?
benwaggoner
14th April 2021, 02:52
I doubt there's going to be a linear relationship. Even in x264 and x265, which have more in common than either does with VP9, similar subjective quality can be up to 5 CRF values apart.
And even within one encoder, a difference of 1 CRF isn't that visible; definitely smaller than the difference between "low" and "medium" quality. Those would be more like 6 CRF apart in x264 or x265.
takla
18th April 2021, 16:42
The text in your link talks about cq, which is not crf. Generally speaking, all google docs and most other users data is way outdated when it comes to vp9.
From personal experience, I'd advice against 2pass uses with vp9, because it enables auto-alt-ref frames, which you cannot turn off. This option forces very aggressive denoising which destroys very fine detail even with the lowest denoise settings.
I found a much clearer outcome with just 1pass, cpu-used 1 & -g=fps*10, -row-mt 1 and a very low crf value (10 to 15), aswell as denoising with mvtools (do not mess with tile settings. vpx-vp9 v1.09 and newer does a very good job with most settings on auto, except for the mentioned settings). The final video file resulted in a video file size 2 to 3 times lower over the raw bluray file.
VS_Fan
20th April 2021, 02:05
I doubt there's going to be a linear relationship. Even in x264 and x265, which have more in common than either does with VP9, similar subjective quality can be up to 5 CRF values apart.
I found that there is indeed a linear relationship between the crf values for the vp9, x265 and x264 codecs. My experimental approximation:
x265_crf(x264_crf) = 1.09 * x264_crf − 4.19
vp9_crf (x264_crf) = 1.98 * x264_crf − 14.46
This means the answer to the OP's question would be: a value of crf=25.14 for the vp9 codec should encode a video with about the same quality: 18.66 SSIM dB (0.9864 SSIM), as the one generated by the x264 codec with a value of crf=20.0, or crf=17.61 for x265.
Continue reading for the details and explanation of my findings:
Last January I ran an experiment with ffmpeg (git-20210110), comparing the vp9(v1.9.0-122-gebac57ce9), x264(core 161 r3027 4121277) and x265(version 3.4) codecs. I selected a set of 20 seconds full-HD (1920x1080) videos captured with two different android phones, a canon camera, a nikon camera, and the xbox game bar in windows 10.
Each of the videos in the set was encoded using ffmpeg with each of these codecs, for 7 different crf values aiming to result in videos with quality ranging between 10 to 22 SSIM dB. A pivot table of the metrics obtained, averaging the SSIM for the set of videos at the each crf, leads to the following graphic and linear regressions, that show for each codec separately, the clear linear relationship between CRF and encoded video quality measured in SSIM dB:
https://i.imgur.com/f72QnAp.png
This evidently, in turn, shows the linear relationship between the crf of the three codecs, as illustrated in the equations at the beginning of this post.
In the not too distant future I expect to have some time to summarize some other findings in my exercise regarding the quality, bitrate and encoding speed for each codec depending on the crf.
benwaggoner
21st April 2021, 01:48
Wow, interesting research. Thanks for sharing!
Although how many clips did you test on? x264 and x265 are tracking more closely than I have seen them in the breadth of real-world titles.
VS_Fan
21st April 2021, 02:10
Wow, interesting research. Thanks for sharing!
Although how many clips did you test on? x264 and x265 are tracking more closely than I have seen them in the breadth of real-world titles.
I used 10 full-HD 1920x1080 clips: 20 seconds duration, 2 from each of the following 5 sources: 2x2 different android phones, 2 from a canon camera, 2 from a nikon camera, and 2 video game sequences captured with the xbox game bar in windows 10. They all contain dynamic scenes with moving camera and moving subject(s)
EDIT: The reason for my mix of videos: With the experiment I wanted to find the most appropriate codec and settings for archiving these kind of videos:
Videos from cameras and phones; medium speed encoding, good quality (>= 18 SSIM dB)
Video game captures: Fast encoding, acceptable quality (~15 SSIM dB)
foxyshadis
23rd April 2021, 10:04
Interesting. I wonder if x265 has rebalanced their CRF to track closer to x264's, since most of their customers upgrade from that.
Sharc
23rd April 2021, 10:29
@VS_Fan
Interesting finding. What were the resulting filesizes in your SSIM vs CRF tests?
benwaggoner
23rd April 2021, 19:15
I used 10 full-HD 1920x1080 clips: 20 seconds duration, 2 from each of the following 5 sources: 2x2 different android phones, 2 from a canon camera, 2 from a nikon camera, and 2 video game sequences captured with the xbox game bar in windows 10. They all contain dynamic scenes with moving camera and moving subject(s)
EDIT: The reason for my mix of videos: With the experiment I wanted to find the most appropriate codec and settings for archiving these kind of videos:
Videos from cameras and phones; medium speed encoding, good quality (>= 18 SSIM dB)
Video game captures: Fast encoding, acceptable quality (~15 SSIM dB)
Ah, gotcha. So it's either game footage or recompressing already compressed content without postproduction. Those are pretty specific use cases, so it makes sense your results would have higher correlation than a more general case which includes lossless film and video sources, cel animation, etcetera.
benwaggoner
23rd April 2021, 19:17
@VS_Fan
Interesting finding. What were the resulting filesizes in your SSIM vs CRF tests?
Also, CRF-SSIM correlation is going to be quite a bit closer than CRF to subjective quality scores. Generally objective metrics track more closely to each other than any do to subjective quality ratings.
FWIW, VMAF isn't really an objective metric in this sense. It uses a fusion of multiple objective metrics as input to a machine learning model to predict subjective quality scores.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.