Hi, While playing around with the psnr/ssim calculations in ffmpeg I noticed that the average presented is different from what I would expect.
The columns below are the psnr-values calculated by my own tool, ffmpeg and tiny_ssim.c (sorry for the formatting but gmail screws up the alignment, see http://pastebin.com/B6BkwcVA) Y-component ycbcr.py ffmpeg tiny_ssim 26.194 26.19 26.194 25.950652 25.95 25.951 25.73425 25.73 25.734 26.296376 26.3 26.296 26.298215 26.3 26.298 26.324584 26.32 26.325 26.671997 26.67 26.672 26.365405 26.37 26.365 26.250325 26.25 26.25 26.915763 26.92 26.916 26.747261 26.75 26.747 26.774038 26.77 26.774 27.126952 27.13 27.127 27.597209 27.6 27.597 27.794023 27.79 27.794 28.070067 28.07 28.07 27.949201 27.95 27.949 27.996252 28 27.996 28.066139 28.07 28.066 28.084215 28.08 28.084 27.970032 27.97 27.97 27.958326 27.96 27.958 28.030713 28.03 28.031 28.190591 28.19 28.191 28.079677 28.08 28.08 28.285431 28.29 28.285 28.113496 28.11 28.113 28.342119 28.34 28.342 28.502148 28.5 28.502 28.268838 28.27 28.269 28.391678 28.39 28.392 28.417471 28.42 28.417 My calculated average: 28.417471 28.42 28.417 As you can see the psnr-values for each frame are the same and the average for the data above is the same. However when I run ffmpeg, using (the data in the pastebin and the ffmpeg-column above comes from the stats_{psnr,ssim}.log files created below) ffmpeg -s 1920x1080 -i F1.yuv -s 1920x1080 -i F2.yuv -lavfi "ssim="stats_file=stats_ssim.log";[0:v]1:v]"psnr="stats_psnr.log" -f null - I get this: [Parsed_ssim_0 @ 0x373bdc0] SSIM Y:0.836733 (7.871019) U:0.929458 (11.515509) V:0.953007 (13.279697) All:0.871566 (8.913210) [Parsed_psnr_1 @ 0x373c960] PSNR y:27.339519 u:37.820406 v:40.238118 average:28.916038 min:27.338981 max:30.077372 tiny_ssim.c: Total 32 frames | PSNR Y:27.340 U:37.820 V:40.238 All:28.950 | SSIM Y:0.83673 U:0.92946 V:0.95301 All:0.87157 (8.91322) Here ffmpeg/tiny_ssim reports the average for the Y-component as ~27.34. This I don't get. The same behavior is seen for the ssim calculations. The average I get by taking the value for each frame is not the same as reported by ffmpeg/tiny_ssim. Have I misunderstood something about how the averaging in ffmpeg is done and what is the correct way of getting the average? cheers /Fredrik _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
