VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 51
Thread
  1. What is achieved exactly when rendering in 1st pass?
    Last edited by Sephisto; 7th Apr 2012 at 18:32.
    Quote Quote  
  2. During the first pass the encoder is analyzing the video so it knows how to apportion bitrate during the second pass.
    Quote Quote  
  3. Ah okay thanks.

    Btw how do you factor Bitrate into a video?

    Like, how much kbit/s would you use on a 60 FPS 1920x1080 video?
    Quote Quote  
  4. Originally Posted by Sephisto View Post
    What is achieved exactly when rendering in 1st pass?
    Not a lot.

    Back in the days of Xvid 2 pass encoding was mostly used because Xvid doesn't have the same single pass, quality based encoding ability that x264 does. So as jagabo said, the first pass analyzes the video while the second pass does the encoding. x264 works the same way.

    When it comes to x264 encoding however, it is capable of quality based, single pass encoding. There's virtually no difference between the output whether you use single pass encoding or 2 pass encoding, if the final bitrate is the same, so the only real purpose for 2 pass encoding is to achieve a particular file size.

    If you pick a CRF value (quality) and run a single pass encode, the quality is known while the file size will be whatever it needs to be.
    If you pick a file size and run a 2 pass encode, you're effectively choosing the quality without knowing what it'll be, but the file size is (of course) known. The encoder runs a first pass to analyze the video in order to work out how to distribute the bits for consistent quality, then it runs a second pass to encode it.

    Unless you need to achieve a particular file size, CRF (quality based) single pass encoding is the way to go. And it's also nearly twice as fast.
    Quote Quote  
  5. Originally Posted by Sephisto View Post
    Btw how do you factor Bitrate into a video?

    Like, how much kbit/s would you use on a 60 FPS 1920x1080 video?
    There's no way to know. No two videos compress the same. One may require a much higher bitrate than another for the same relative quality. I encode resizing to 720p and using the same CRF value (20) my encodes range from around 2.5GB to 5GB per movie. Had I used 2 pass encoding while picking a file size I would no doubt have wasted lots of bits on some movies while restricting the quality of others. Unless you need to hit a particular file size, use single pass, CRF encoding.
    Quote Quote  
  6. Originally Posted by hello_hello View Post
    Back in the days of Xvid 2 pass encoding was mostly used because Xvid doesn't have the same single pass, quality based encoding ability that x264 does.
    Xvid has a single pass constant quality mode, Target Quantizer (equivalent to CQ mode in x264). The main reason people used bitrate based encoding with Xvid was because they wanted to fit movies on 716 MB CDs. That's why the files were usually ~716 MB for movies, ~358 MB for 45 minute TV episodes, and ~179 MB for 23 minute TV episodes.
    Quote Quote  
  7. Member
    Join Date: Mar 2011
    Location: Nova Scotia, Canada
    Search Comp PM
    I've found, using h.264 and handbrake, that the same video encoded with 2 pass looked better than constant quality mode set to 20, o/p file sizes almost identical.

    But that was with the default, standard profile. CQ in high profile (necessary for 8x8 DCT, which you want unless you want to encode to a mobile) with advanced settings enabled is way better. Those extra goodies in h.264 take about 3 times as long to encode, so constant quality mode is looking much better.

    The best explanation of why you'd want 2 pass over 1 pass bit rate/file size mode I've seen is in the handbrake docs.
    Quote Quote  
  8. I've found, using h.264 and handbrake, that the same video encoded with 2 pass looked better than constant quality mode set to 20, o/p file sizes almost identical.
    did you use:
    cq = constant quantizer (not quality)
    or
    crf = constant rate factor (also not constant quality, but something that more like it)

    2pass bitrate and 1pass crf use the same rate control, so if the output size is identical the quality will be the same.


    Cu Selur
    Quote Quote  
  9. Member
    Join Date: Mar 2011
    Location: Nova Scotia, Canada
    Search Comp PM
    I realize there's some confusion in the handbrake nomenclature. When they say cq they really mean crf. I know what cq means in video geek terms.

    Maybe the quality would be the same in theory, sort of, but they weren't.
    Quote Quote  
  10. Maybe the quality would be the same in theory, sort of, but they weren't.
    So you mean to say that when you encode a file with 1pass crf and also encode the source using use 2pass abr settings to hit the same file size (not changing anything but the rate control) you end up with visible different looking files?
    If so please post some detailed infos (is there some sort of handbrake log?) of the stuff you are doing, since this should not happen and should be reported to the x264 developers. Would be cool if you can reproduce this with a free available source, so that others can reproduce you findings.

    Cu Selur
    Quote Quote  
  11. I remember being confused some time back regardless that CQ shortcut and using MeGui. Had to read it couple of times to straighten it out.

    MeGui uses Constant Quality and Constant Quantizer encoding mode. But CQ shortcut doesn't refer to Constant Quality mode. This mode , Constant Quality works with CRF.

    For Constant Quality - Constant Ratefactor is set - CRF
    For Constant Quantizer -Constant Quantizer is set set
    Quote Quote  
  12. Good info in here, I guess size wouldn't be that much of a problem.

    I rendered a World of Warcraft file at 60 fps, 1920x1080 using 5000 kbit/s, it was a little bit pixelated, I then rendered it at 10,000 kbit/s and most of the pixelation was gone. This was using Multipass.
    Quote Quote  
  13. so why don't you try CRF settings just for a minute or so or whole video why not, and you will know right away what bitrate is desired to keep quality,
    Quote Quote  
  14. Originally Posted by _Al_ View Post
    so why don't you try CRF settings just for a minute or so or whole video why not, and you will know right away what bitrate is desired to keep quality,
    Trying it just now (:
    Quote Quote  
  15. Member
    Join Date: Nov 2003
    Location: West Texas
    Search PM
    The in depth review of cpu vs gpu encoding done at BEHardware last August showed a consistent pattern. Better results when using the x264 encoder with 2 passes rather than one. http://www.behardware.com/articles/828-1/h-264-encoding-cpu-vs-gpu-nvidia-cuda-amd-str...-and-x264.html
    Quote Quote  
  16. they used 1pass abr not 1pass crf, which use different rate control algorithms,...
    That 1pass abr really should only be used if one really needs to is nothing new, but the general assumption 2pass is always better than 1pass is just wrong.
    Quote Quote  
  17. Originally Posted by jagabo View Post
    Xvid has a single pass constant quality mode, Target Quantizer (equivalent to CQ mode in x264). The main reason people used bitrate based encoding with Xvid was because they wanted to fit movies on 716 MB CDs. That's why the files were usually ~716 MB for movies, ~358 MB for 45 minute TV episodes, and ~179 MB for 23 minute TV episodes.
    Xvid doesn't have a true constant quality mode when running single pass encoding. It's CQ/target quantiser mode isn't the same as x264's CRF encoding. Which is probably not too bad a thing given most people used 2 pass encoding to fit movies on CDs etc. Also Xvid's VBR control only works in 2 pass mode, so if you wanted 100% AVI/DVD player compatibility, 2 pass encoding is required.
    Quote Quote  
  18. Originally Posted by hello_hello View Post
    Originally Posted by jagabo View Post
    Xvid has a single pass constant quality mode, Target Quantizer (equivalent to CQ mode in x264). The main reason people used bitrate based encoding with Xvid was because they wanted to fit movies on 716 MB CDs. That's why the files were usually ~716 MB for movies, ~358 MB for 45 minute TV episodes, and ~179 MB for 23 minute TV episodes.
    Xvid doesn't have a true constant quality mode when running single pass encoding. It's CQ/target quantiser mode isn't the same as x264's CRF encoding.
    Sorry, I mistyped "equivalent to QP mode in x264". TQ mode in Xvid is still a "constant quality" mode, which was my point.
    Last edited by jagabo; 9th Apr 2012 at 20:11.
    Quote Quote  
  19. Originally Posted by Selur View Post
    they used 1pass abr not 1pass crf, which use different rate control algorithms,...
    That 1pass abr really should only be used if one really needs to is nothing new, but the general assumption 2pass is always better than 1pass is just wrong.
    I couldn't see where the single pass method used was specified, although I didn't spend a lot of time reading the article (so I'll take your word for it), but one thing which seemed obvious to me when looking at the Staxrip comparisons (which was the method used to compare x264 encoding) most of the single pass encodes resulted in video which had a lower bitrate than the equivalent 2 pass encode. How do you come to conclusions as to the quality of different encoding methods if the bitrates are different? I'd agree they're not really valid comparisons.

    My understanding is there should be very little quality difference between CRF encoding and 2 pass encoding if the final bitrate is the same.

    Plus even if there are differences and 2 pass encoding does produce slightly better quality at a given bitrate, as most encoder GUIs don't run compression tests any more there's still only two options... pick a file size and hope for the best or pick a quality.
    Well of course you could run a single pass encode and use the resulting file size for a 2 pass encode but who wants to encode everything twice? Unless you need to hit a particular file size it still makes more sense to run single pass, quality based encoding using the CRF value which gives you the desired quality (even if the final bitrate does have to be slightly higher than an identical quality, 2 pass encode).
    Last edited by hello_hello; 9th Apr 2012 at 22:35.
    Quote Quote  
  20. How do you come to conclusions as to the quality of different encoding methods if the bitrates are different?
    For comparison <ou do it the other way around. First do the 1pass encoding, where you can't set a fixed bit rate than to a 2pass encoding with the target size of the result from the 1pass encoding as target.

    Well of course you could run a single pass encode and use the resulting file size for a 2 pass encode but who wants to encode everything twice?
    You would not do this for every encode. Doing the encoding twice is only a method if you want to compare the results.

    Unless you need to hit a particular file size it still makes more sense to run single pass, quality based encoding using the CRF value which gives you the desired quality (even if the final bitrate does have to be slightly higher than an identical quality, 2 pass encode).
    Exactly.
    2pass -> use it if you do want/need a specific bitrate/size.
    1pass crf -> use if you want some sort of constant quality level
    1pass abr -> use it if you are in a live streaming environment and you need some sort of bitrate control that is not covered through vbv
    1pass cq -> only use it to measure the effect of different features

    Cu Selur
    Quote Quote  
  21. CRF is better quality at the same file size than 2pass mode. Experiments confirmed it.
    Quote Quote  
  22. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Originally Posted by Mephesto View Post
    CRF is better quality at the same file size than 2pass mode. Experiments confirmed it.

    No

    It can be very similar, sometimes worse in some scenes, sometimes better, but rarely is it overall "better"
    Quote Quote  
  23. Like I wrote before if you can reproduce this, please make the appropriate informations known to the x264 developers, since neither 2pass bitrate nor 1pass crf should differ in perceivable quality if the ouput has the same file size.

    Cu Selur
    Quote Quote  
  24. But there is no guarantee that both CRF and 2pass will match bitrate for particular scene, is it a fact ? File size as a whole could be the same but bitrate for the same scene could differ, that's what I think, I do not know, I do not believe that software calculates this to the bit exactly the same, I might be wrong of course.

    And we will not know that size until we actually encode that CRF too. We do not know that number unless we actually encode that CRF and then to encode 2pass. It makes no sense in real world somehow. 2pass business is always guessing business or what room do I have here. CRF is only one pass ...
    Quote Quote  
  25. It makes no sense in real world somehow.
    thought it was clear: 2pass and CRF have different goals:
    2pass -> aim for an average bitrate (or target size)
    1pass crf -> keep a constant rate factor
    => normally people use 2pass or 1pass crf depending what they want, so normally it's not really a question what is 'better' since you don't use them on the same source.
    But is you want to compare them, they should produce the same result for the same file size, since they use the same rate control. If they don't something is broken and the x264 developers need to be informed.

    Cu Selur
    Quote Quote  
  26. My reply was general I have no problem with your answers, it was a general poke at CRF vs. 2pass, I do not need them to compare really , because even if I know it is a tiny bit better (2 pass) how would I know that average for that 2pass anyway. Catch22.
    Quote Quote  
  27. Member fritzi93's Avatar
    Join Date: Nov 2003
    Location: U.S.
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by Mephesto View Post
    CRF is better quality at the same file size than 2pass mode. Experiments confirmed it.

    No

    It can be very similar, sometimes worse in some scenes, sometimes better, but rarely is it overall "better"
    He-he. That reminds me of a thread over at Doom9. Someone stated that with the same CRF setting, the *ONLY* difference between, say, FAST and ULTRAFAST presets, is that the ULTRAFAST will produce a bigger output file. Dark Shikari (x264 developer) replied saying no, quality will not be exactly the same throughout. Lest I mis-state the rest of his comments, I'll leave it at that.
    Pull! Bang! Darn!
    Quote Quote  
  28. Originally Posted by fritzi93 View Post
    He-he. That reminds me of a thread over at Doom9. Someone stated that with the same CRF setting, the *ONLY* difference between, say, FAST and ULTRAFAST presets, is that the ULTRAFAST will produce a bigger output file. Dark Shikari (x264 developer) replied saying no, quality will not be exactly the same throughout. Lest I mis-state the rest of his comments, I'll leave it at that.
    I'd assume we're discussing CRF encoding vs 2 pass encoding using the same x264 settings for each, and at the same bitrate/file size though....

    Anyway, you reminded me of a thread where CRF vs 2 pass encoding was being discussed a couple of years ago, so I thought I'd quote the x264 developer's comments here (Dark Shikari).

    http://forum.doom9.org/showthread.php?p=1373437
    "Given the same amount of encoding time, CRF is superior to 2-pass at the same bitrate. Given the same settings rather than the same time, they're effectively identical within margin of error. My recent tests show that CRF generally has a very slight edge, albeit the difference is so small that you'd have to have OCD to care."

    So effectively he's saying that at a given bitrate and identical x264 settings, CRF encoding will at worst produce exactly the same quality as 2 pass encoding.

    I assume if you encode a video using a given CRF value and a slower preset, then encode it again using a faster preset while using the first encode's file size for a 2 pass encode, you could end up spending a similar amount of time encoding each, but the quality of the 2 pass encode won't be as high. Which makes sense.....
    Quote Quote  
  29. Originally Posted by poisondeathray View Post
    Originally Posted by Mephesto View Post
    CRF is better quality at the same file size than 2pass mode. Experiments confirmed it.

    No

    It can be very similar, sometimes worse in some scenes, sometimes better, but rarely is it overall "better"
    Not true, it is always better at the same filesize with the same settings. The difference is negligible on photographic videos (+50 SSIM) but somewhat noticeably better on low-complexity videos like cartoons and game replays (+300 SSIM.)

    I've tested this time and time again. It is difficult to make the file sizes identical which is why I made the CRF videos be slightly smaller than the 2pass and STILL the SSIM was higher.

    The thing is, when you seek an arbitrary bitrate like 2pass mode was designed for, you do it at the expense of encoding freedom and lose lots of opportunities for better compression. This is alleviated by the first pass which at least makes flexible evaluation of different scenes possible and minimizes the damage of an arbitrary bitrate.

    But this still destroys the superior motion vectors that are more free-flowing on CRF mode.

    Even if the difference is negligible, the time wasted with the first pass isn't.
    Quote Quote  
  30. 1st: using 1pass crf still only makes sense if you are not aiming for a specific file size.
    2nd: SSIM is problematic if psychovisual enhancements are activated.
    -> the argument about wasted time is not really interesting since the two methods aim for different goals

    At least for normal footage (movie like content, commercials&co; straight from the camera or out of the NLE tools) I never managed to get a comparison together that shows that 1pass crf is better at the same size as a 2pass encode. (1st make the crf encode, than the 2pass encode; for both passes make sure to have vbv enabled, since at least for me content needs to be vbv compliant to specific profiles&levels, most of the time high@4.1 or high10@4.1 is fine)

    If someone has a example for 1pass crf being better than 2pass with the same settings and the same file size, please share it.

    Cu Selur
    Quote Quote  



Similar Threads