====== x264 Quality ====== * [[x264]] * [[http://forum.doom9.org/showthread.php?t=150118|Meaning of PSNR and SSIM scores]] - doom9, source of formula by Dark Shikari Use SSIM or PSNR to gauge differences between encoding settings. ==== SSIM ==== When comparing two values, here is the formula to discern what percentage amount something has improved. First of all, let's look at a two-pass encode of a file: <code> x264 -o movie.264 --ssim --tune ssim --profile high --level 3.1 --bitrate 1024 --preset medium --keyint 30 --pass 1 movie.y4m x264 -o movie.264 --ssim --tune ssim --profile high --level 3.1 --bitrate 1024 --preset medium --keyint 30 --pass 2 movie.y4m </code> Find this value in the output, and use the Y variable. <code> x264 [info]: SSIM Mean Y:0.9613678 (14.131db) </code> Run the same tests, against a 2048k bitrate instead of a 1024k one: <code> x264 -o movie.264 --ssim --tune ssim --profile high --level 3.1 --bitrate 1024 --preset medium --keyint 30 --pass 1 movie.y4m x264 -o movie.264 --ssim --tune ssim --profile high --level 3.1 --bitrate 1024 --preset medium --keyint 30 --pass 2 movie.y4m </code> With separate SSIM output: <code> x264 [info]: SSIM Mean Y:0.9751283 (16.043db) </code> Here's the formula: <code> (((1 - old) / (1 - new)) - 1) * 100 </code> Here's a simpler visualization: <code> 1 - 0.9613678 = 0.0386322 1 - 0.9751283 = 0.0248717 0.0386322 / 0.0248717 = 1.55325932686547361057 1.55325932686547361057 - 1 = 0.55325932686547361057 0.55325932686547361057 * 100 = 55.325932686547361057 </code> Rounding it out to an integer, would be 55, for a result of 55%. So when encoding this particular video at double the bitrate, the SSIM increases by 55%. Not bad! Here's a PHP function to do the same thing: <code> function ssim_improvement($old_ssim, $new_ssim) { $a = 1 - $old_ssim; $b = 1 - $new_ssim; $c = $a / $b; $d = $c - 1; $e = $d * 100; return $e; } </code> === PSNR === Using the doom9 forum post as a reference, the equation is: <code> (new - old) / 0.05 = % improvement </code>
Trace:
Article
Show pagesource
Log In
Search
Toolbox
What links here
Media Manager
Site index
Permanent link
Cite this article