2

I am getting generated mp4 video stream from input stream (mxf or mov), and when doing this I am using -psnr as H264 parameter. The result is approx. 40 or 41.

Then I am comparing input and output with psnr (or ssim) filter. Results approx. 20 or 21. It is a big difference. Is there anyone know the reason of this difference?

Note: ssim result is similar. First is ~0.97, the second is ~0.83

PSNR

ffmpeg -i input.mov -codec:v libx264 -psnr -f mp4 output.mp4
PSNR (~40)

ffmpeg -i output.mp4 -i input.mov -filter_complex psnr -f mp4 /dev/null
PSNR (~20)

SSIM

ffmpeg -i input.mov -codec:v libx264 -ssim -f mp4 output.mp4
SSIM (~0.98...)

ffmpeg -i output.mp4 -i input.mov -filter_complex ssim -f mp4 /dev/null
PSNR (~0.83...)
llogan
  • 121,796
  • 28
  • 232
  • 243
Ceyhun Çakar
  • 29
  • 1
  • 2

2 Answers2

7

Probably because the timestamps of the two videos don't line up correctly. You should be able to confirm that by providing the full output of the commands you're running, and then looking at the timebase of the two input streams.

[Edit] After some playing, here's a way to get it to ignore timestamps and just do 1:1 frame comparisons:

ffmpeg -i file1 -i file2 \
    -lavfi '[0:v]setpts=N[out0];[1:v]setpts=N[out1];[out0][out1]psnr' \
    -f null -v info -

It may complain somewhat about invalid timestamps, but you can safely ignore these error messages.

Ronald S. Bultje
  • 10,828
  • 26
  • 47
0

That's the ffmpeg psnr filter modle's problem.Even we align the timestamp and framerate between ref and dis streams,we'll also get the different psnr&ssim values. The following are the test result in my side,one is come from libx264 log output,the other is calculated by ffmpeg psnr filter.

libx264 log stuff:

[libx264 @ 0x4840c20] PSNR Mean Y:32.345 U:39.530 V:39.383 Avg:33.687 Global:33.326 kb/s:943.62

ffmpeg psnr filter test result:

[Parsed_psnr_0 @ 0x33b41e0] PSNR y:32.067442 u:39.500521 v:39.372329 average:33.447532 min:31.125177 max:37.774371

Sometimes,we use 3rd part tools to calculate psnr&ssim values,and should make sure the test tools are the same.