View Single Post
Old 16th July 2015, 12:33   #431  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Thanks for the thanks! ;-)

Quote:
Originally Posted by De_Hollander View Post
but I have this re-encode compared with to the 2 passes encode
the 2 passes gives a sharper image even though it is smaller
Well, I have just finished some tests to compare the result of the CRF and 2-pass modes.

I have encoded a short clip (about 6 minutes) in CRF 20 two times, with the SSIM option and then with the PSNR. Then, I have noted the bitrate of the generated video stream, and encoded the same clip in 2-pass mode, with that bitrate, to obtain approximately the same file size. Again, I have encoded the clip two times, to obtain the SSIM and PSNR stats.

Of course, in all tests, I have not modified any other parameter. All encodings were made with preset slower and level 4.1. (The tune was set to ssim or psnr, but that settings are necessary to optimise the stats, and should not modify the video. But I cannot use the grain tune at the same time, so you have to consider that the encodings were made with tune "none".)

Here are the results of the tests:
Code:
CRF 20, preset slower, force level 4.1:
Encoding speed: 6.16 fps (encoding duration: 0:24:17.5)
SSIM Mean Y:0.9845501 (18.111db)
PSNR Mean Y:46.713 U:48.811 V:48.073 Avg:47.079 Global:46.399 kb/s:2532.32
Resulting video bitrate: 2532.09 kbps

2-pass 2532 kbps, preset slower, force level 4.1:
Encoding speed: 10.23 fps (pass 1) and 6.55 fps (pass 2) (total encoding duration: 0:37:27.5)
SSIM Mean Y:0.9845700 (18.116db)
PSNR Mean Y:46.698 U:48.799 V:48.058 Avg:47.067 Global:46.381 kb/s:2535.43
Resulting video bitrate: 2535.42 kbps

At the end of pass 1, this information was given:
SSIM Mean Y:0.9819845 (17.444db)
PSNR Mean Y:45.226 U:47.875 V:47.216 Avg:45.743 Global:44.857 kb/s:2542.13
Final ratefactor: 21.49
If you don't know how to interpret the SSIM and PSNR values, don't worry, me too I don't know. But I know that in both cases, higher values means better quality (or, more precisely, better similarity with the source video). A SSIM of 1.0 means lossless.

Therefore, as you can see, the encoding in CRF 20 mode is (slightly) better than the 2-pass encoding, for a slightly smaller file size. The CRF more is clearly the winner. These are objective values, not what the human eye sees. That doesn't mean that the encoding is "better" in CRF mode, because an human may prefer a video slightly sharper or softer than the original, and some artefacts that are detected by the SSIM or PSNR procedures may be invisible for the human eye. But at least these values are indisputable facts. The CRF encoding IS closer to the original source than the 2-pass encode.

Also, note the speed of the encoding. In 2 pass mode, the two encodings are shorter than the CRF pass, but pass 2 is almost as slow. And when you add the durations of the 2 passes together, the total duration is MUCH MUCH longer. About 1.5 times slower... for a slightly less good quality.

I have also posted the SSIM and PSNR values displayed after the first pass too, for your information only. Of course, they are less good than CRF or the 2nd pass, but that's normal, because it's the "fast first pass" necessary only to generate the stats. And it's why the first pass is "fast" than the result of the second pass cannot be perfect. If you want a better first pass, there is an option to turn off the fast first pass, and compute everything like in the 2nd pass. That setting may improve slightly the final quality in 2-pass mode, but of course, the total duration of the encoding will be even longer. Probably around 2 times the duration of the CRF pass.

A very interesting information displayed after the first pass in 2-pass mode is the final ratefactor. It's the ratefactor that will be used in pass 2 to obtain the target bitrate. As you can see, in my test, it is 21.49. CRF means "Constant Rate Factor", and in my CRF test I have used 20. The CRF value of the 2-pass encoding is greater, and as you know, a greater CRF means a less good quality. (I don't know if there are other small differences between CRF mode and 2-pass, but anyway a ratefactor greater than 20 is less good than 20.)

In conclusion, my tests confirm that 2-pass is slightly less good, and totally useless when it is not necessary to obtain a very precise final file size. I agree that the difference in quality is minor, but it exists, and I see no reason to waste much encoding time to do 2 passes when an encoding in one pass CRF is much more rapid. In fact, using CRF or 2-pass is approximately equivalent, and the first pass consists mainly (only?) in determining the CRF value to use during the second pass in order to obtain the specified bitrate. Do you really need to spend much time just to know a value that you could have specified directly in the GUI? Imo, it's only a waste of time and CPU power, not good for you and the planet.

I must say that it is possible that the difference with the two methods may vary from movie to movie, and perhaps also if you use some other parameters, such as the "grain" tuning. But in general, the quality of a CRF encoding must be considered as equivalent or slightly better than the quality of 2-pass, only much faster.

And don't forget the other advantage of CRF over 2-pass. It will produce a smaller file when the movie is easy to compress, or a larger file when it is difficult, automatically. In 2-pass, you must know exactly what bitrate you have to give to a certain movie to obtain the quality you want, and without a close analysis (that an human cannot do accurately), it's impossible to determine. CRF does it for you, free of charge.

I don't know what you did to see big quality differences in your tests, but you must have made something wrong, or changed other parameters (like the grain) between the two tests. Anyway, I continue to think that CRF is the better way to encode much (all?) movies, and it will stay the default mode in BD3D2MK3D.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV

Last edited by r0lZ; 16th July 2015 at 12:43.
r0lZ is offline