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 15th June 2009, 22:46   #1  |  Link
10L23r
Registered User
 
Join Date: Apr 2009
Posts: 122
on multipasses

is there any advantage to using crf for the first pass rather than abr?
10L23r is offline   Reply With Quote
Old 15th June 2009, 22:59   #2  |  Link
shon3i
BluRay Maniac
 
shon3i's Avatar
 
Join Date: Dec 2005
Posts: 2,419
If you like the quality of the output after CRF, you will save you time
shon3i is offline   Reply With Quote
Old 15th June 2009, 23:06   #3  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 957
The advantage is that you pick a quality then use the resulting bitrate in the second pass, but this does mean that you should use "slow" settings on the first pass. "Fast" settings alter the resulting bitrate by a fair amount.

If you are targeting a specific bitrate, I don't know if/why you should use crf for the first pass.

[EDIT] Do the common "fast" settings use subme 1 or 2?
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.

Last edited by J_Darnley; 15th June 2009 at 23:13.
J_Darnley is offline   Reply With Quote
Old 15th June 2009, 23:27   #4  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
A 2-Pass encode with CRF in the first pass makes only sense if you want to use CRF plus VBV.

Unless VBV is involved, CRF works perfectly fine with a single pass. And if you are targeting for a specific filesize (or average bitrate), you will need to do a "classical" ABR 2-Pass encode anyway...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 15th June 2009, 23:47   #5  |  Link
St Devious
Hardware Aspirin
 
Join Date: Jul 2007
Posts: 461
I have never really used anything besides automatic 2 pass encode average bitrate encoding in MeGUI. But I am looking to expand my knowledge to different ways to encode.

So bear with me.

I understand from here that CRF is a parameter to set the output quality and it selects bitrate by itself.

Is it a 2 pass encode or just one pass ?

Is it better than 2-pass average bitrate encode ?
St Devious is offline   Reply With Quote
Old 15th June 2009, 23:49   #6  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 957
Plain CRF is one pass, it is equivalent to 2-pass at the same bitrate.
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.
J_Darnley is offline   Reply With Quote
Old 16th June 2009, 00:00   #7  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
Quote:
Originally Posted by J_Darnley View Post
[EDIT] Do the common "fast" settings use subme 1 or 2?
last i recall, subme=2 in megui's "turbo" settings and I haven't heard of it changing since then.
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 16th June 2009, 00:02   #8  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by J_Darnley View Post
Plain CRF is one pass, it is equivalent to 2-pass at the same bitrate.
...with the subtle difference that with CRF you can't know the resulting bitrate in advanced

It's also possible to run the first pass of a 2-Pass encode with CRF mode (instead of ABR mode), but the second pass will be ABR again (with the target bitrate that resulted from the first CBR pass). But I say it again: This kind of "2-Pass CRF" makes only sense, if you want to use CRF mode with VBV (because VBV doesn't perform well with a single pass). However if you are not using VBV, then CRF will work perfectly fine with a single pass! And if you want to do a "classical" 2-Pass encode to hit a desired filesize (or target betirate), then you can not run the first pass in CRF mode for obvious reasons...

(BTW: ABR mode is used via "--bitrate x", CRF mode is used via "--crf x". These two parameters are not used at the same time!)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 16th June 2009 at 00:19.
LoRd_MuldeR is offline   Reply With Quote
Old 16th June 2009, 00:18   #9  |  Link
St Devious
Hardware Aspirin
 
Join Date: Jul 2007
Posts: 461
Quote:
Originally Posted by LoRd_MuldeR View Post
...with the subtle difference that with CRF you can't know the resulting bitrate in advanced

It's also possible to run the first pass of a 2-Pass encode with CRF mode (instead of ABR mode), but the second pass will be ABR again (with the target bitrate that resulted from the first CBR pass). But I say it again: This kind of "2-Pass CRF" makes only sense, if you want to use CRF mode with VBV (because VBV doesn't perform well with a single pass). However if you are not using VBV, then CRF will work perfectly fine with a single pass! And if you want to do a "classical" 2-Pass encode to hit a desired filesize (or target betirate), then you can not run the first pass in CRF mode for obvious reasons...
thanks.

So is CRF faster than 2-pass encode but almost the same quality if they are the same bitrate ?

Is it possible to judge than a certain CRF value like 18 would always have certain bitrate ?
St Devious is offline   Reply With Quote
Old 16th June 2009, 00:22   #10  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by St Devious View Post
So is CRF faster than 2-pass encode but almost the same quality if they are the same bitrate ?
Obviously CRF is faster, because usually it requires only one single pass. So compared to a 2-Pass encode, a normal CRF encode will require roughly 1/2 the time.

And as said before: A 2-Pass encode and a CRF encode of the same bitrate are equivalent. You probably couldn't tell the difference

Quote:
Originally Posted by St Devious View Post
Is it possible to judge than a certain CRF value like 18 would always have certain bitrate ?
Nope. It totally depends on the content of the video. That's why we have CRF mode: We don't need to decide on a bitrate in advance

(Try encoding a clean CGI source and a grainy "real life" source of the same length/resolution/framerate, both at the very same CRF value. They'll come out at completely different sizes)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 16th June 2009 at 00:41.
LoRd_MuldeR is offline   Reply With Quote
Old 16th June 2009, 01:45   #11  |  Link
St Devious
Hardware Aspirin
 
Join Date: Jul 2007
Posts: 461
Quote:
Originally Posted by LoRd_MuldeR View Post
(Try encoding a clean CGI source and a grainy "real life" source of the same length/resolution/framerate, both at the very same CRF value. They'll come out at completely different sizes)
What about two game videos with the same CRF setting ?
St Devious is offline   Reply With Quote
Old 16th June 2009, 01:49   #12  |  Link
10L23r
Registered User
 
Join Date: Apr 2009
Posts: 122
Quote:
Originally Posted by LoRd_MuldeR View Post
A 2-Pass encode with CRF in the first pass makes only sense if you want to use CRF plus VBV.

Unless VBV is involved, CRF works perfectly fine with a single pass. And if you are targeting for a specific filesize (or average bitrate), you will need to do a "classical" ABR 2-Pass encode anyway...
, got it

now more questions:

is crf more similar to 3pass or 2pass? (yes, i know that 3pass is only 1% or so better than 2pass). ignore vbv here.

how exactly does using fast settings on the first pass influence the quality of the second pass?
well here are my two guesses:
1. the .stats file is less accurate cus of the fast settings' intrinsic inaccuracy
2. when using fast settings, the final bitrate of the first pass varies more greatly from the specified bitrate than when using slow settings.

also, by how much does a fast first pass influence the second pass's quality? i would guess that the decrease is along the lines of using 2pass over 3pass or using umh over tesa, but idk.

@st devious
they should come out at about the same size, depending on the quality of the video. a crysis video and a super mario video at the same resolution and crf would NOT have the save filesize
10L23r is offline   Reply With Quote
Old 16th June 2009, 12:51   #13  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by St Devious View Post
What about two game videos with the same CRF setting ?
Probably it would result in a more similar bitarte than sources of different type, but you still won't get the same bitrate and you still won't be able to predict the size in advance.

If you care about the resulting bitrate (or filesize), then simply don't use CRF

Quote:
Originally Posted by 10L23r View Post
now more questions:

is crf more similar to 3pass or 2pass? (yes, i know that 3pass is only 1% or so better than 2pass). ignore vbv here.
There is no "similar to 3-Pass", because 3-Pass is useless. 3-Pass is nothing but a placebo. It's no better than 2-Pass.

Quote:
Originally Posted by 10L23r View Post
how exactly does using fast settings on the first pass influence the quality of the second pass?
Many options (for example the ones MeGUI lowers in "Turbo" mode) can be lowered safely in the first pass, with no noticeable (or negligible) effect on the second pass.

Quote:
Originally Posted by 10L23r View Post
1. the .stats file is less accurate cus of the fast settings' intrinsic inaccuracy
2. when using fast settings, the final bitrate of the first pass varies more greatly from the specified bitrate than when using slow settings.
1) Yes. But the difference in stats file "accuracy" usually is too small to be noticeable in the final encode (second pass).

2) 2-Pass will always hit the desired target bitrate, even when using "fast" settings. Using faster settings (in the final pass) will only lower the "quality per bit".

BTW: You can even use a bitrate for the second pass that differs from the bitrate that was used for the first pass. x264 will still hit the target bitrate!
But be aware: The bigger the bitrate difference (first pass vs. second pass), the more quality will suffer. Ideally use the same bitrate for both passes.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 16th June 2009 at 17:53.
LoRd_MuldeR is offline   Reply With Quote
Old 16th June 2009, 19:03   #14  |  Link
10L23r
Registered User
 
Join Date: Apr 2009
Posts: 122
Quote:
Originally Posted by LoRd_MuldeR View Post
But be aware: The bigger the bitrate difference (first pass vs. second pass), the more quality will suffer. Ideally use the same bitrate for both passes.
what if u specify 500kbps for the first pass and it gives u something crazy like 2000kbps? shouldn't a third pass be slightly useful then?

or... is 3pass COMPLETELY useless. i mean even more useless than me-tesa

Last edited by 10L23r; 16th June 2009 at 19:05.
10L23r is offline   Reply With Quote
Old 16th June 2009, 19:37   #15  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 957
x264 is very unlikely to do that and if it does there are probably other problems that you should fix before doing a third pass.
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.

Last edited by J_Darnley; 16th June 2009 at 19:41.
J_Darnley is offline   Reply With Quote
Old 16th June 2009, 19:52   #16  |  Link
JohannesL
AviSynth/x264 user
 
JohannesL's Avatar
 
Join Date: Jan 2009
Posts: 149
Quote:
Originally Posted by LoRd_MuldeR View Post
If you care about the resulting bitrate (or filesize), then simply don't use CRF
Significant correction:
If there is a specific bitrate you need to stay below, at the expense of quality, don't use CRF. Otherwise, use CRF.
__________________
archlinux
JohannesL is offline   Reply With Quote
Old 16th June 2009, 20:13   #17  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by 10L23r View Post
what if u specify 500kbps for the first pass and it gives u something crazy like 2000kbps? shouldn't a third pass be slightly useful then?
That won't happen. Even with only the first pass, x264 will hit the specified target avarage bitrate (or the specified target filesize).

So if you specify 500 kbps for the first pass, then you will get a 500 kbps file after that first pass.

And of course you still get a 500 kbps file after the second pass, unless you changed the target bitrate between the passes (which generally is NOT recommended).

We don't need 2-Pass to hit a specific (average) bitrate or filesize! 1-Pass ABR can do that just fine!

The one and only purpose of 2-Pass encoding is to improve the bitrate distribution within the file - under the given target bitrate restriction.

So a 2-Pass encode gives significant better quality than a 1-Pass ABR encode of the same size (bitrate). But a thrid pass won't improve the quality any further!

And yes, I'd consider three passes more "useless" than ME TESA. Anyway, I wouldn't use ME TESA, unless I had a lot of time to waste

Quote:
Originally Posted by JohannesL View Post
Significant correction:
If there is a specific bitrate you need to stay below, at the expense of quality, don't use CRF. Otherwise, use CRF.
In fact if you need to stay below a certain maximum bitrate, then VBV is needed (either 2-Pass or CRF).

2-Pass alone (without VBV) will hit the target average bitrate exactly, not just stay below it. But there may be bitrate spikes MUCH higher than the target (average) bitrate!
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 16th June 2009 at 20:29.
LoRd_MuldeR is offline   Reply With Quote
Old 16th June 2009, 20:52   #18  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
Quote:
Originally Posted by LoRd_MuldeR View Post
That won't happen. Even with only the first pass, x264 will hit the specified target avarage bitrate (or the specified target filesize).

So if you specify 500 kbps for the first pass, then you will get a 500 kbps file after that first pass.
that's technically incorrect.
1pass ABR is allowed to fluctuate from the given bitrate based on the value of ratetol.
if you throw ratetol up to something beyond the default value of 1, you allow it to diverge even farther away from the given bitrate.
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 16th June 2009, 20:54   #19  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by kemuri-_9 View Post
that's technically incorrect.
1pass ABR is allowed to fluctuate from the given bitrate based on the value of ratetol.
if you throw ratetol up to something beyond the default value of 1, you allow it to diverge even farther away from the given bitrate.
I know. But the divergence allowed for 1-Pass ABR is pretty small in fact. And as you said, it can be tweaked if needed (in both directions).

The default value allows a divergence of 1%. So if you specify 500 kbps, you will end up with 505 kbps in worst case...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 16th June 2009 at 20:59.
LoRd_MuldeR is offline   Reply With Quote
Old 17th June 2009, 00:29   #20  |  Link
10L23r
Registered User
 
Join Date: Apr 2009
Posts: 122
uhm... ya 1%... how about 10%??

using r1165 from x264.nl:
Code:
x264.exe --bitrate 500 --pass 1 --ref 4 --mixed-refs --bframes 6 --
b-adapt 2 --b-pyramid --weightb --direct auto --deblock -1:-1 --subme 7 --trelli
s 2 --psy-rd 1.0:0.1  --8x8dct --me umh --threads 1 --thread-input --progress --
no-psnr --no-ssim --partitions all --output "huh.264" "bbb.avs"
avis [info]: 640x352 @ 24.00 fps (241 frames)
x264 [info]: using cpu capabilities: MMX2 Cache64
x264 [info]: profile High, level 3.0
x264 [info]: slice I:7     Avg QP:27.10  size: 15493
x264 [info]: slice P:100   Avg QP:30.12  size:  4086
x264 [info]: slice B:134   Avg QP:31.63  size:  1257
x264 [info]: consecutive B-frames:  7.7% 37.6% 38.5%  5.1%  8.5%  2.6%  0.0%
x264 [info]: mb I  I16..4: 15.7% 70.9% 13.4%
x264 [info]: mb P  I16..4:  2.0%  5.7%  0.4%  P16..4: 44.1% 12.8%  9.4%  0.2%  0
.3%    skip:25.0%
x264 [info]: mb B  I16..4:  0.3%  0.4%  0.0%  B16..8: 39.5%  1.1%  1.6%  direct:
 2.8%  skip:54.3%  L0:37.1% L1:58.6% BI: 4.3%
x264 [info]: final ratefactor: 27.47
x264 [info]: 8x8 transform  intra:69.3%  inter:64.1%
x264 [info]: direct mvs  spatial:94.8%  temporal:5.2%
x264 [info]: coded y,uvDC,uvAC intra:47.5% 71.2% 40.4% inter:12.7% 16.2% 2.5%
x264 [info]: ref P L0  76.3% 12.6%  7.2%  3.9%
x264 [info]: ref B L0  86.5%  9.6%  3.9%
x264 [info]: ref B L1  93.6%  6.4%
x264 [info]: kb/s:546.2

encoded 241 frames, 6.05 fps, 546.77 kb/s
ok, i did pick a pretty damn complex scene from bigbuckbunny... but still, how would u explain this???

Last edited by 10L23r; 17th June 2009 at 00:35.
10L23r 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 13:31.


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