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 > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th March 2018, 18:18   #1  |  Link
TEB
Registered User
 
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
2Pass VBR vs Constrained CRF modes, differences?

hi! What is the real difference between:

1. 2Pass VBR with a max min avg level, example 8mbps max, 4mbps avg.
2. Constrained/Capped CRF mode, (example: CRF22 with with a max bitrate of 8mbps

Im fully aware that different types of content will give different results, but in general what are the pros and cons with both methods from a quality perspective ?

/TEB
TEB is offline   Reply With Quote
Old 13th March 2018, 18:51   #2  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
1) can target a specific bitrate.
2) cannot target a specific bitrate.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 13th March 2018, 19:58   #3  |  Link
TEB
Registered User
 
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
Quote:
Originally Posted by Asmodian View Post
1) can target a specific bitrate.
2) cannot target a specific bitrate.
Thx for the anwser, but im fully aware of this, hence i wrote :
"pros and cons with both methods from a quality perspective ?"
TEB is offline   Reply With Quote
Old 14th March 2018, 10:04   #4  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
If both result files have the same size, it's been always told that there will be no differences, because it's the same algorithm/method used in both cases.

I've nevertheless noticed a difference, not in quality, but just in the result log files.
Even if both cases are encoded with "--direct auto", and with the same parameters except the CRF/VBR part, in the result log file, i've noticed that for CRF mode, i've always a result like "Spatial : 100% Temporal : 0%".
But, in 2 pass encode, the 1rst pass is also always "Spatial : 100% Temporal : 0%". but the 2nd pass i've a "Temporal" which is not at 0. I can have for exemple "Spatial : 95% Temporal : 5%".
For now, i have the feeling that if you are in a one pass mode, you'll never access to "Temporal". No idea how it affects quality, and what exactly is or how things are impacted.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 14th March 2018, 10:07   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
There have been discussions about this before and iirc. assuming the output file size is the same overall quality should be nearly the same, on some frames crf will look better and on some 2pass will look better.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 14th March 2018, 10:16   #6  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
I understand that there are subtle differences, but you will usually not see these when watching, unless perhaps when one applies a too strict limitation of the max. bitrate / buffer control in CRF mode.
So for equal file sizes and same encoder settings the quality will be very much the same (identical). There is no clear winner as I understand it. So nothing to worry about.
Sharc is offline   Reply With Quote
Old 14th March 2018, 10:34   #7  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by jpsdr View Post
I've nevertheless noticed a difference, not in quality, but just in the result log files.
Even if both cases are encoded with "--direct auto", and with the same parameters except the CRF/VBR part, in the result log file, i've noticed that for CRF mode, i've always a result like "Spatial : 100% Temporal : 0%".
But, in 2 pass encode, the 1rst pass is also always "Spatial : 100% Temporal : 0%". but the 2nd pass i've a "Temporal" which is not at 0. I can have for exemple "Spatial : 95% Temporal : 5%".
This could just be a consequence of the "fast 1st pass" setting, I think.
I would assume that with "slow 1st pass" the result for spatial/temporal would be the same.
Sharc is offline   Reply With Quote
Old 14th March 2018, 14:32   #8  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
No, i'm not using fast 1st pass. And, as i said, there is also this 100% 0% on CRF encode with the same parameters than the 2nd pass, where there is not anymore 100% 0%.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 14th March 2018, 20:56   #9  |  Link
TEB
Registered User
 
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
I did some tests the other day with a Prores source, comparing 2pass VBR, constrained CRF and CRF "free". CRF Free won the SSIM tests overall and had the smallest filesize as a end result of the 10000 frames in my testcase. 2pass VBR actually came up ontop of CRF constrained within the same bitrate limits.
So to conclude from my perspektive.. CRF "free" gives the encoder the ability to maximize its ratecontrol to the fullest and best way, whilst constraining it (restricting it) gives a worse result than 2pass VBR
TEB is offline   Reply With Quote
Old 14th March 2018, 23:04   #10  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by jpsdr View Post
No, i'm not using fast 1st pass. And, as i said, there is also this 100% 0% on CRF encode with the same parameters than the 2nd pass, where there is not anymore 100% 0%.
Maybe this is the explanation. In CRF there is a first pass only, hence --direct auto defaults to ????

Edit:
b.t.w. x264 in 2-pass VBR mode defaults to "fast 1st pass". One has to specify explicitly "--slow-firstpass" when the same encoder settings should apply for both passes.

Last edited by Sharc; 15th March 2018 at 08:27. Reason: typo
Sharc is offline   Reply With Quote
Old 14th March 2018, 23:11   #11  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by TEB View Post
I did some tests the other day with a Prores source, comparing 2pass VBR, constrained CRF and CRF "free". CRF Free won the SSIM tests overall and had the smallest filesize as a end result of the 10000 frames in my testcase. 2pass VBR actually came up ontop of CRF constrained within the same bitrate limits.
So to conclude from my perspektive.. CRF "free" gives the encoder the ability to maximize its ratecontrol to the fullest and best way, whilst constraining it (restricting it) gives a worse result than 2pass VBR
I think this makes sense because only 2-pass has the global view for bitrate distribution and optimum placement of I,B and P frames, which may pay off in bitrate constrained scenarios.

Last edited by Sharc; 14th March 2018 at 23:24.
Sharc is offline   Reply With Quote
Old 14th March 2018, 23:34   #12  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Placement of I/B/P doesn't change in second pass.
sneaker_ger is offline   Reply With Quote
Old 15th March 2018, 00:22   #13  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by sneaker_ger View Post
Placement of I/B/P doesn't change in second pass.
Yes, but it can be different for CBR (1-pass) and 2-pass VBR encoding.
Moreover, it is very difficult to obtain exactly the same file size for CBR and 2-pass VBR mode, for a comparison.

Last edited by Sharc; 15th March 2018 at 08:59.
Sharc is offline   Reply With Quote
Old 15th March 2018, 12:27   #14  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
When did this change to CBR ? I thought the discussion is about CRF.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 15th March 2018, 13:09   #15  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
The way I understand it, CRF has to guess as to the quality of the I-frames, whereas 2 pass doesn't, but on the other hand, CRF doesn't have to make any quality adjustments to achieve a particular bitrate whereas 2 pass needs to make quality adjustments as encoding progresses if the target bitrate isn't going to be achieved.

I've only ever seen CRF look worse than 2 pass when using a ridiculously low bitrate on a source with a complex opening scene. I have seen 2 pass give the ending credits of a long encode a fair bit more bitrate than CRF to achieve the requested file size.

The best explanation I've read regarding x264's rate control methods is here:
A qualitative overview of x264's rate control methods

Although I had a bit of a hard time wrapping my head around it initially, so I re-wrote it in a more logical manner for my brain to digest. My re-written version can be found here:
https://forum.videohelp.com/threads/...65#post2470457

Last edited by hello_hello; 15th March 2018 at 13:17.
hello_hello is offline   Reply With Quote
Old 15th March 2018, 17:12   #16  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Nice, didn't know your summary over at videohelp. Liked it.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 15th March 2018, 17:38   #17  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by Selur View Post
When did this change to CBR ? I thought the discussion is about CRF.
Sorry, I meant CRF of course ....
Sharc is offline   Reply With Quote
Old 15th March 2018, 18:05   #18  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by hello_hello View Post
I've only ever seen CRF look worse than 2 pass when using a ridiculously low bitrate on a source with a complex opening scene. I have seen 2 pass give the ending credits of a long encode a fair bit more bitrate than CRF to achieve the requested file size.....
I remember I have seen 2-pass to produce less color banding on flat scenes. Not sure whether this observation can be generalized though. 2-pass was also slightly superior for fast (relaxed) encoder settings. VBV/maxbitrate constrains have already been mentioned.
I did such test quite some years ago, so the differences might be lower now due to x264 development progress since.
Sharc is offline   Reply With Quote
Old 23rd March 2018, 18:52   #19  |  Link
TEB
Registered User
 
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
thx for a nice and constructure discussion
Anyone compared CRF to other Constant Quality modes? (QP)?
I heard that CRF is more optimized with regards to high temporal motion vs. QP... I may be mistaken..
TEB is offline   Reply With Quote
Old 23rd March 2018, 20:09   #20  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by TEB View Post
Anyone compared CRF to other Constant Quality modes? (QP)?
I heard that CRF is more optimized with regards to high temporal motion vs. QP... I may be mistaken..
"QP" is not "constant quality". It's constant quantizer

Efficiency wise --qp is worse. Quality is lower if you measured various encodes at equivalent final bitrate. It also means things like AQ (adaptive quantization) are disabled. AQ is one of the big strengths in many encoding scenarios
poisondeathray 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 12:33.


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