Tutorial

Calculate the PSNR value of a video file with ffmpeg

Install FFmpeg (if not already installed):

Opening a Command Prompt or Terminal

Open a command prompt or terminal and navigate to the folder where the video you want to convert is located.

Calculate PSNR value with ffmpeg:

ffmpeg -i src.mp4 -i compressed.mp4 -lavfi psnr -f null -
  • PSNR y gives the PSNR value for the luminance (Y) channel. Luminance is the brightness value of an image.
  • PSNR u gives the PSNR value for the chrominance channel U.
  • PSNR v gives the PSNR value for the chrominance channel V.
  • average:48.561921 gives the average PSNR value for Y, U and V.
  • min gives the lowest PSNR value of all color channels.
  • max gives the highest PSNR value of all color channels.

The PSNR value is given in dB (decibels). A higher value means that the original video and the reference video are more similar, while a lower value indicates greater differences between the two videos. An ideal PSNR value is 48 dB.

Note: The PSNR value is not always a good indicator of the visual quality of the video, as it only takes into account the quantitative differences between the original and reference video and not the viewer's subjective perception.