Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > VP9 and AV1

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th April 2021, 11:43   #1  |  Link
orion44
None
 
orion44's Avatar
 
Join Date: Jul 2007
Location: The Background
Posts: 303
Which VP9's crf value corresponds to x264's crf 20?

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?
orion44 is offline   Reply With Quote
Old 14th April 2021, 02:52   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 18th April 2021, 16:42   #3  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 182
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.

Last edited by takla; 18th April 2021 at 16:46.
takla is offline   Reply With Quote
Old 20th April 2021, 02:05   #4  |  Link
VS_Fan
Registered User
 
Join Date: Jan 2016
Posts: 98
Quote:
Originally Posted by benwaggoner View Post
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:

Code:
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:



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.

Last edited by VS_Fan; 20th April 2021 at 17:05.
VS_Fan is offline   Reply With Quote
Old 21st April 2021, 01:48   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 21st April 2021, 02:10   #6  |  Link
VS_Fan
Registered User
 
Join Date: Jan 2016
Posts: 98
Quote:
Originally Posted by benwaggoner View Post
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)

Last edited by VS_Fan; 21st April 2021 at 02:45.
VS_Fan is offline   Reply With Quote
Old 23rd April 2021, 10:04   #7  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Interesting. I wonder if x265 has rebalanced their CRF to track closer to x264's, since most of their customers upgrade from that.
foxyshadis is offline   Reply With Quote
Old 23rd April 2021, 10:29   #8  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
@VS_Fan
Interesting finding. What were the resulting filesizes in your SSIM vs CRF tests?
Sharc is offline   Reply With Quote
Old 23rd April 2021, 19:15   #9  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
Quote:
Originally Posted by VS_Fan View Post
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 23rd April 2021, 19:17   #10  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
Quote:
Originally Posted by Sharc View Post
@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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:30.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.