[FFmpeg-user] tiny_psnr typical PSNR values

Takis Issaris t4k1s at yahoo.com
Thu Aug 23 10:26:02 CEST 2012


A colleague asked me for some tips on how to compare the quality of audio streams which have been subjected to errors due to network problems. I suggested using the tiny_psnr tool to compute the PSNR. On the ffmpeg-user maillinglist I noticed an e-mail by Benjamin indicating that a PSNR above 80dB would indicate acceptable quality for some codecs being introducing into FFmpeg. The values I'm getting are _much_ lower though (in the range of 20 to 30 dB). I tried using both the files with WAV headers and files containing just the samples to be sure it wasn't a header problem.


#!/usr/bin/env bash
gcc -O2 tiny_psnr.c -o tiny_psnr
gcc -O2 audiogen.c -o audiogen
./audiogen original.wav 44100 1
for br in 32 128 320
  ffmpeg -y -i original.wav -ab ${br}k enc${br}.mp3
  ffmpeg -y -i enc${br}.mp3 dec${br}.wav
  ffmpeg -y -i enc${br}.mp3 -f s16le -acodec pcm_s16le dec${br}.raw
  echo "PSNR for ${br}"
  ./tiny_psnr original.wav dec${br}.wav s16 0 44
  ./tiny_psnr original.wav dec${br}.raw s16

I checked filesizes to be sure the codec did actually achieve the requested bitrate:
du -sk enc*mp3 |sort -n

PSNR for 32
stddev: 4952.74 PSNR: 22.43 MAXDIFF:52266 bytes:   529156/   529970
stddev: 4952.55 PSNR: 22.43 MAXDIFF:52266 bytes:   529200/   530014
PSNR for 64
stddev: 4024.81 PSNR: 24.23 MAXDIFF:54364 bytes:   529156/   529970
stddev: 4024.65 PSNR: 24.23 MAXDIFF:54364 bytes:   529200/   530014
PSNR for 128
stddev: 2103.94 PSNR: 29.87 MAXDIFF:26850 bytes:   529156/   529970
stddev: 2103.85 PSNR: 29.87 MAXDIFF:26850 bytes:   529200/   530014
PSNR for 256
stddev: 1758.67 PSNR: 31.43 MAXDIFF:21322 bytes:   529156/   529970
stddev: 1758.60 PSNR: 31.43 MAXDIFF:21322 bytes:   529200/   530014
PSNR for 320
stddev: 1752.45 PSNR: 31.46 MAXDIFF:20956 bytes:   529156/   529970
stddev: 1752.38 PSNR: 31.46 MAXDIFF:20956 bytes:   529200/   530014

With friendly regards,

More information about the ffmpeg-user mailing list