[MEncoder-users] [Script] PSNR between two video files

Guillaume POIRIER poirierg at gmail.com
Mon Sep 12 18:37:55 CEST 2005


Hi,

On 8/25/05, Guillaume POIRIER <poirierg at gmail.com> wrote:
> Hi,
> 
> On 8/25/05, Matthias Wieser <mwieser at gmx.de> wrote:
> > Hi,
> >
> > I have created a script (called psnr-video.sh) to calculate the PSNR
> > between two existing video files. The PSNR is calculated frame by frame.
> > Additionally an overall PSNR is calculated.
> >
> > The output file can be used for plots of the frame by frame PSNR.
> >
> > "What's the purpose of this script, as there is already the mencoder
> > option 'psnr'"?
> >
> > mencoder [...]:psnr only shows the psnr of the video codec. Video filters
> > like scaling, denoise3d, pp=fd cannot be tested with this option.
> >
> > psnr-video.sh can be used to
> >
> > * compare different softwarescalers (should I use -sws 1 or -sws 2)
> > * compare different resolutions (is it better to scale down to 640x360 or
> >    to 560x320)
> > * compare different deinterlacers
> > * compare different video codecs
> > * compare video filters (is it better to use -vf hqdn3d or
> >    lavcopts:nr=400)
> > * [...]
> >
> > Example:
> > ./psnr-video.sh ./orig.avi ./test.avi 247
> >
> > Creates a file psnr.dat with the following content:
> >
> > File;Y;Cb;Cr
> > 00000001.ppm;34.23;39.54;40.06;35.426
> > 00000002.ppm;33.03;38.71;39.26;34.271
> > 00000003.ppm;33.45;38.91;39.28;34.655
> > 00000004.ppm;32.72;38.69;38.85;33.972
> > [...]
> > 00000247.ppm;35.55;40.84;42.15;36.785
> > PSNR:;35.9887
> >
> > -------
> >
> > Usage: psnr-video.sh <file1> <file2> [<frames>] [<options1>] [<options2>]
> >
> >  <file1> and <file2> are the video files for which the PSNR should be
> >                      calculated.
> >  [<frames>]          is the number of frames to process, starting from
> >                      frame 1.
> >  [<options1>]        are additional MPlayer options for <file1>
> >  [<options2>]        are additional MPlayer options for <file2>
> >
> >  Be aware that psnr-video.sh needs a lot of temporal space inside /temp/.
> >
> > -------
> >
> > Comments?
> 
> At first, I didn't quite understand how you were able to compute the
> psnr of 2 pictures with only a shell script. Doing such thing in bash
> would probably give you the "master of shell script" crown! :)
> A quick glance at the code shows that you use the tool "pnmpsnr" to do
> the frame-by-frame... so no crown for you today! ;o)
> 
> 
> > If you find it usefull you may add it to [CVS]main/TOOLS/
> 
> I do. I'll add it tonight after some testing, only if nobody objects.

Done. I should have done it sooner, but somehow I got distracted by
some other things.

Thanks!

Guillaume
-- 
Reading doesn't hurt, really!
  -- Dominik 'Rathann' Mierzejewski




More information about the MEncoder-users mailing list