Author Topic: crf vs 2pass question  (Read 17392 times)

Offline Niktesla

  • Member
  • Posts: 19
  • I do it The Delphi way. Though CPP sometimes...
    • View Profile
crf vs 2pass question
« on: March 24, 2010, 09:56:48 PM »
At 1st glance CRF mode is doing exactly what i need - maintaining fixed "quality" with minimized bitrate.
But then, its a multiple posts here and there, says that 2pass is anyway superior to CRF, given the same filesize...

So the question:
1. Is there any sense to make a 2pass encoding, using --pass 1 with --crf n  and then --pass 2 with the resulted bitrate ? Any qualyty gain compared to 1pass crf encoding expected ?
2. Does --qcomp affect anything in 2pass mode encoding ?
3. What are the usage limitations of .stats file, created on --pass 1 ?  I mean will the once created .stats file sill be usefull if i double the --bitrate of pass2 compared to pass1, or just change some CL options in pass2 ?

----------------------
PS: My context is ANIME encoding

Offline checkers

  • Member
  • Posts: 72
    • View Profile
    • MeWiki
Re: crf vs 2pass question
« Reply #1 on: March 24, 2010, 10:19:48 PM »
Quote
says that 2pass is anyway superior to CRF, given the same filesize...
It was. Now it's not.

Answering your questions in order:
1. No.
2. It affects things, but you shouldn't touch it.
3. The more the settings between passes differ the less useful the statsfile will be (and at some point it will become negatively useful). Some options (specifically those set when you set --pass 1 without --slow-firstpass have almost no impact), others (like --bframes) have a large impact. Changing bitrate by that much would have a large impact.

Offline Mr. Monte

  • Member
  • Posts: 14
    • View Profile
Re: crf vs 2pass question
« Reply #2 on: April 17, 2010, 06:18:16 PM »
It was. Now it's not.


I must have missed a changelog or something.  Would you mind expanding on that?  So, a CRF encoded video at say 18 with a resulting filesize of say 2 gigs would be superior or equal to the same file encoded with 2-pass, locked 2 gig filesize?

Next, since CRF 18 is supposed to be indistiguishable from the source at that level.  If I was to do a 2-pass of the same above video file, however I locked the filesize to 4480 (4.7 gig), would it still be only as goog as the resulting CRF 18 2 gig version?

Visually to me, I thought the 2-pass was superior..especially in fast action scene movies due to the allocation of bits across the video.  I understand CRF ALSO can look ahead, however I do not belive it can be as efficient in bit distribution since it does not use the same type table as 2-pass.  Am I correct?

TIA

Offline Dark Shikari

  • x264 developer
  • Administrator
  • Member
  • *****
  • Posts: 650
    • View Profile
Re: crf vs 2pass question
« Reply #3 on: April 17, 2010, 08:20:35 PM »
Visually to me, I thought the 2-pass was superior..especially in fast action scene movies due to the allocation of bits across the video.  I understand CRF ALSO can look ahead, however I do not belive it can be as efficient in bit distribution since it does not use the same type table as 2-pass.  Am I correct?
CRF and 2-pass use identical bit allocation algorithms.  All 2-pass does is pick the CRF value that gives the filesize you want.  It's still using the CRF algorithm.

Offline checkers

  • Member
  • Posts: 72
    • View Profile
    • MeWiki
Re: crf vs 2pass question
« Reply #4 on: April 17, 2010, 09:30:04 PM »
I must have missed a changelog or something.  Would you mind expanding on that?  So, a CRF encoded video at say 18 with a resulting filesize of say 2 gigs would be superior or equal to the same file encoded with 2-pass, locked 2 gig filesize?
To repeat: in the past there was a difference, now there is not.

Offline Yumi

  • Member
  • Posts: 21
    • View Profile
Re: crf vs 2pass question
« Reply #5 on: April 18, 2010, 08:45:58 PM »
Since this topic was brought up, I'd just like to ask something.

Is --direct auto a little more efficient in 2 pass mode than crf?  I ask because I notice that x264 usually selects spatial in crf, but often selects a lot more temporal in 2 pass.  If there's a difference, my guess would be that it would be fairly minor, am I correct?
(note, this is from memory, from a while ago, if it's changed more recently, then my apologies)

Thanks.

Offline Forteen88

  • Member
  • Posts: 47
  • Didée-fan!
    • View Profile
Re: crf vs 2pass question
« Reply #6 on: April 19, 2010, 11:10:14 AM »
@Yumi: Yes, 2-pass results in a better --direct auto, but that's a tiny quality-difference.

Offline Yumi

  • Member
  • Posts: 21
    • View Profile
Re: crf vs 2pass question
« Reply #7 on: April 19, 2010, 02:04:25 PM »
@Yumi: Yes, 2-pass results in a better --direct auto, but that's a tiny quality-difference.
Thanks :)

Offline J_Darnley

  • Global Moderator
  • Member
  • *****
  • Posts: 397
    • View Profile
Re: crf vs 2pass question
« Reply #8 on: April 19, 2010, 03:03:45 PM »
Don't forget that crf (or any first pass) can make use of extra predictors created by lookahead whereas a later pass cannot.
« Last Edit: April 19, 2010, 03:06:53 PM by J_Darnley »
Knowledgeable about: cmd.exe, ffmpeg, x264

Offline Mr. Monte

  • Member
  • Posts: 14
    • View Profile
Re: crf vs 2pass question
« Reply #9 on: April 19, 2010, 06:17:22 PM »
CRF and 2-pass use identical bit allocation algorithms.  All 2-pass does is pick the CRF value that gives the filesize you want.  It's still using the CRF algorithm.

DS..thanks for that to-the-point answer.

So, for my own knowledge..If I select CRF 18 on a 20 gig BluRay file and encode it at preset slow and the resultant file is say 5 gig.  There would be no benifit in re-encoding with two-pas lock file size 8 gig?

Ultimately, CRF 18 will be better than any two-pass setting (using the same cmd-line switches or presets that is)

Offline J_Darnley

  • Global Moderator
  • Member
  • *****
  • Posts: 397
    • View Profile
Re: crf vs 2pass question
« Reply #10 on: April 20, 2010, 01:51:44 AM »
No, it is probable that an 8GiB file will look better than a 5GiB file with the same settings regardless of which was 2pass and which was crf.

The point is that if a crf encode and a 2pass encode will have the same quality if they are the same size.
Knowledgeable about: cmd.exe, ffmpeg, x264

Offline zamwow

  • Member
  • Posts: 6
    • View Profile
Re: crf vs 2pass question
« Reply #11 on: April 20, 2010, 02:29:19 PM »
CRF and 2-pass use identical bit allocation algorithms.  All 2-pass does is pick the CRF value that gives the filesize you want.  It's still using the CRF algorithm.
Is there a way to find out what CRF value was used after a 2-pass?