Just as an addendum (though I think it's been mentioned on this list
before), PSNR isn't always a good measurement of visual quality, so take
these results with a grain of salt.  Lower PSNR generally means lower
visual quality, but depending on the actual image data, deliberate
"errors" such as averaging pixels can help the brain fill in the missing
detail on its own, causing the image to look better to a human viewer.

  --Andrew Church
    achu...@achurch.org
    http://achurch.org/

>There was a short thread recently on encoding options for x264 (and 2-pass
>encoding in particular), to which I wrote a reply that was subsequently
>swallowed by a power failure before I could send it.  Since then I took
>the time to actually try 1-pass, 2-pass, and constant rate factor (CRF,
>x264's "2-pass in a single pass") modes, and here's what I found as of
>x264 build 84:
>
>- 2-pass does significantly better than 1-pass on smoothing out the image
>  quality.  This may actually be a double-edged sword, because if you
>  lose too much detail in still scenes (as can happen if the bitrate is
>  too low), that loss of quality can carry over into motion scenes, and
>  you may not get the benefit you'd expect.  That said, I didn't try
>  encoding at a low bitrate so I can't say for sure one way or the other.
>
>  (Phil, regarding what you said you heard about 2-pass support being
>  nonfunctional: I can only assume that was referring to a very old x264
>  build, because the PSNR curves were substantially different between
>  1-pass and 2-pass.  If nothing else, I know the 2-pass log file has
>  actual data because I had to add a workaround in encode_x264 for an
>  x264 bug that writes invalid frame numbers at the end of the log.)
>
>- Constant rate factor mode (enabled by crf=N in x264.cfg) does a fairly
>  good job of matching the 2-pass PSNR curve for the same bitrate, but it
>  fluctuates a bit more (slightly higher PSNR in still scenes, lower PSNR
>  in high-motion scenes).  This may indicate that CRF mode tries harder
>  than regular 2-pass to retain detail in still scenes.
>
>So my recommendation regarding multi-pass encoding for x264 would be:
>
>* Use 2-pass mode when (1) you need to hit a specific bitrate target (for
>  example, if you're trying to fill a DVD to capacity) and (2) you're
>  encoding at a high enough bitrate that you can sacrifice some bits from
>  still scenes without suffering much damage to visual quality.  My
>  totally unscientific guess at "a high enough bitrate" is about
>  1/15 (0.067) bit/pixel, or ~700kbps for 720x...@30fps video.
>
>* If you need to hit a bitrate target but you're using a low bitrate, you
>  should probably try both 1-pass and 2-pass and see which one looks
>  better (check both still and high-motion scenes, as well as transitions
>  between the two).  Another possibility is to try several different CRF
>  values and find the lowest value (highest quality) that stays under the
>  target bitrate.
>
>* Otherwise, use CRF mode.  The value N in the "crf=N" parameter seems
>  to correspond roughly to the average quantization level (QP); in my
>  tests, I generally got a QP of crf-1.5 in I-frames and crf+1.5 in
>  P-frames, with B-frames somewhat higher.  There are probably better
>  references elsewhere on the web, but my rough (and again totally
>  unscientific) feeling is:
>     - crf=20: high quality (if you're familiar with videotapes, think
>                  "SP mode")
>     - crf=25: good quality ("LP mode")
>     - crf=30: fair quality, low bitrate ("EP mode")
>
>  --Andrew Church
>    achu...@achurch.org
>    http://achurch.org/
>

Reply via email to