Objective Quality Comparison in FFmpeg

There are a few different ways media engineers can perform quality checks that are based upon objective methodology. Though there are fierce debates waged over the merits of all these various techniques, they all have their legitimate uses.

Today, I’ve published a Gist containing a Ruby class, which instructs FFmpeg to return the PSNR and SSIM scores of two videos.

To use this class directly within your preferred Ruby shell:

[1] pry(main)> require './compare'
=> true
[2] pry(main)> c = CompareVideo.new("futbol.mp4","futbol.webm")  # (reference_video, input_video)
=> #<CompareVideo:0x00000002326020 @comp=[#<Pathname:futbol.webm>, #<Pathname:futbol.mp4>]>
[3] pry(main)> c.compare
EXIT STATUS: succeeded
PSNR Score: ["28.257181"]
=> nil

Transcoded videos (lossy-to-lossy) should return a PSNR score near or above 30.0. If you’re hovering around 25.0 or lower, then something got flubbed up!

For SSIM, the closer the result to 1.0, the better.