If you have original yuv-sequence and encoded h264 file (or h265), you can compute total PSNR,SSIM and VIF statistics with ‘-filter-complex‘ of ffmpeg tool.
- the following command computes total PSNR statistics:
Example: Check psnr of the first 200 frames:
ffmpeg.exe -i crowd.h264 -s 1920×1080 -i crowd_1920x1080_50fps.yuv -filter_complex “psnr” -frames 200 -f null –
….
PSNR y:33.293567 u:36.664940 v:37.336638 average:34.213823 min:23.696606 max:43.488406
PSNR y – average PSNR of Y-component (PSNR y:33.293567)
PSNR u – average PSNR of U-component (chroma)
PSNR v – average PSNR of V-component (chroma)
- the following command computes total ssim statistics for the first 200 frames:
ffmpeg.exe -i crowd.h264 -s 1920×1080 -i crowd_1920x1080_50fps.yuv -filter_complex “ssim” -frames 200 -f null –
….
SSIM Y:0.915767 (10.745194) U:0.893551 (9.728601) V:0.905034 (10.224307) All:0.910276 (10.470902)
- the following command computes total VIF statistics for the first 200 frames, VIF (Visual Information Fidelity) is one of human vision adapted metrics:
ffmpeg.exe -i crowd.h264 -s 1920×1080 -i crowd_1920x1080_50fps.yuv -filter_complex “vif” -frames 200 -f null –
..
[Parsed_vif_0 @ 000001fc04312940] VIF scale=0 average:0.442250 min:0.386250: max:0.793647
[Parsed_vif_0 @ 000001fc04312940] VIF scale=1 average:0.877654 min:0.827078: max:0.988949
[Parsed_vif_0 @ 000001fc04312940] VIF scale=2 average:0.938070 min:0.906706: max:0.994823
[Parsed_vif_0 @ 000001fc04312940] VIF scale=3 average:0.964298 min:0.943639: max:0.996984
Note:
- Good HVS-correlated metrics (like VIF) are unable to provide real-time measurement of video quality, since they are too complex.
- SSIM criterion are successful in estimation of still image quality, but not in video.
- It’s worth mentioning that almost all visual quality algorithm (incl. VMAF) doesn’t model temporal masking effects (e.g. the scene-cut masking). The score of each frame is measured independently from the score of previous and next frames. However, the human visual system does not work in that way.
- SSIM is slightly better PSNR in correlation to subjective quality, in the paper “Quality Assessment of Deblocked Images“, by Changhoon Yim, et al.2011, the linear correlation (or Pearson) coefficient of PSNR vs. SIS (subjective impairment score, which is produced according to ITU-R BT.500-11) is 0.8, while the linear correlation coefficient of SSIM vs. SIS is 0.85 (see Fig. 9 in the above mentioned paper).
23+ years’ programming and theoretical experience in the computer science fields such as video compression, media streaming and artificial intelligence (co-author of several papers and patents).
the author is looking for new job, my resume