[FFmpeg-user] Problem with ffmpeg psnr calculate filter when image file applied

anshul anshul.ffmpeg at gmail.com
Thu Dec 19 07:28:46 CET 2013

On 12/18/2013 11:49 PM, Stefano Sabatini wrote:
> On date Tuesday 2013-12-17 22:35:55 +0800, 肖谋 wrote:
>> Dear all,
>>     I would like to calculate the PSNR of two images or two videos. I found
>> that the new psnr filter worked well for video files which have at less two
>> frames, but not for one frame, or image files.
>> ffmpeg version is 2.0.2
>> generate the files to be compared
>> two frames video: ./ffmpeg -i test.mkv -vframes 2 -vcodec libx264 -an
>> frame2.mkv
>> one frames video: ./ffmpeg -i test.mkv -vframes 1 -vcodec libx264 -an
>> frame1.mkv
>> this one does not work:
>> ./ffmpeg -i test.mkv -vframes 1 -vcodec rawvideo -filter:v
>> "movie=frame1.mkv,setpts=PTS-STARTPTS[main];[in][main]psnr=f=c.log" -f
>> rawvideo -y /dev/null
>> this one works:
>> ./ffmpeg -i test.mkv -vframes 1 -vcodec rawvideo -filter:v
>> "movie=frame2.mkv,setpts=PTS-STARTPTS[main];[in][main]psnr=f=c.log" -f
>> rawvideo -y /dev/null
>> This situation can also be reproduced using image files.
>> I looked into the vf_psnr.c. The do_psnr is not called.
>> I think this might be a bug for filter process? any suggestions to fix this?
> Are you able to reproduce the problem with latest git (2.0.2 is a bit
> old and we had some fixes which may be relevant).
> Also you could file a bug report.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
I have not seen the source code about the implementation of PSNR calculation
but as far as I knew psnr is calculated by comaring original(no noise) 
and  lossy compressed(noise)
image, I dont get why you are trying to calculate psnr of one frame

More information about the ffmpeg-user mailing list