[FFmpeg-devel] [PATCH] libavfilter: created a new filter that obtains the average peak signal-to-noise ratio (PSNR) of two input video files in YUV format.
Mark Himsley
mark at mdsh.com
Fri Jun 10 17:22:29 CEST 2011
On 10/06/11 00:24, Stefano Sabatini wrote:
> On date Tuesday 2011-06-07 17:16:42 +0100, Mark Himsley encoded:
>> On 07/06/11 13:03, Roger Pau Monné wrote:
> [...]
>>> + if (psnr->vstats_file) {
>>> + if(psnr->is_yuv)
>>> + fprintf(psnr->vstats_file,
>>> + "Frame:%d Y:%0.2fdB Cb:%0.2fdB Cr:%0.2fdB PSNR:%0.2fdB\n",
>>> + psnr->nb_frames,
>>> + get_psnr(mse[0], 1, psnr->max[0]),
>>> + get_psnr(mse[1], 1, psnr->max[1]),
>>> + get_psnr(mse[2], 1, psnr->max[2]),
>>> + get_psnr(mse_t, 1, psnr->average_max));
>>> + if(psnr->is_rgb) {
>>> + fprintf(psnr->vstats_file,
>>> + "Frame:%d R:%0.2fdB G:%0.2fdB B:%0.2fdB ",
>>> + psnr->nb_frames,
>>> + get_psnr(mse[0], 1, psnr->max[0]),
>>> + get_psnr(mse[1], 1, psnr->max[1]),
>>> + get_psnr(mse[2], 1, psnr->max[2]));
>>> + if(av_pix_fmt_descriptors[inlink->format].nb_components> 3)
>>> + fprintf(psnr->vstats_file,
>>> + "A:%0.2fdB ",
>>> + get_psnr(mse[3], 1, psnr->max[3]));
>>> + fprintf(psnr->vstats_file,
>>> + "PSNR:%0.2fdB\n",
>>> + get_psnr(mse_t, 1, psnr->average_max));
>>> + }
>>> + }
>>> + }
>>
>
>> Would it be possible to output as a csv, similar to qpsnr, so it
>
> Here's the link:
> http://qpsnr.youlink.org/
>
> Mark, can you show a sample so we don't have to download and compile
> it to check?
Sure:
the command qpsnr -r direct_35.mxf viasd_35.cqp18.ts.mxf > qpsnr.csv
compares the file viasd_35.cqp18.ts.mxf file against the reference file
direct_35.mxf
The output of that command is:
Sample,viasd_35.cqp18.ts.mxf,
1,46.0744,
2,45.2861,
3,44.9394,
4,44.9709,
5,44.9848,
6,44.9655,
7,44.7984,
8,44.7304,
9,44.8806,
10,44.6229,
11,44.4063,
12,44.3069,
13,44.7139,
[...]
The output being:
line 1 == a text comment for first row of every column
line 2...n == frame_number,[psnr,]...
fyi1, qpsnr allows many different files to be compared to the reference
in one run, hence each line of output may have more than one psnr value
fyi2, qpsnr appears to use libav.
>> could be quickly imported into a spreadsheet and a graph drawn
>> without the need to pre-process your output file ?
>
> Maybe psnr=vstats_file:fmt=qpsnr
>
> we may add an optional argument for setting the output driver (note
> this can be done as a separate patch, so no need to block this one if
> the contributor don't want to implement it).
More information about the ffmpeg-devel
mailing list