[Ffmpeg-devel] Problems with MPEG quality

Rick Harris rickharris
Mon Dec 25 09:01:32 CET 2006


Hi all,

I'm having some problems with the latest SVN and the quality of mpeg1 and 
mpeg2 video streams it produces when encoding from a stream of images.

This is a recent problem that first surfaced around the middle of October, 
disappeared in a subsequent SVN update and now is back in the latest SVN.

FFmpeg produces a strange pulsating effect where to the eye, the video bitrate 
seems to momentarily dip down drastically for a couple of frames and then 
dips back up to the specified bitrate (5000k in the following case).

Using FFmpeg to create a video stream of around 100 frames from a static 
image.
The image can be downloaded here:
http://mightylegends.org/downloads/test01.ppm

The video stream can be downloaded here:
http://mightylegends.org/downloads/test.m2v


Command-line used:
~ # cp test01.ppm test02.ppm

~ # ffmpeg -y -r 1/5 -f image2 -i test%02d.ppm -b 5000k -bufsize 224k -maxrate 
7000k -r pal -f mpeg2video test.m2v

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2006 Fabrice Bellard, et al.
  
configuration:  --prefix=/usr --enable-shared --mandir=/usr/share/man --disable-altivec --disable-debug --disable-dv1394 --enable-a52 --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-amr_if2 --enable-dts --enable-mp3lame --enable-libogg --enable-vorbis --enable-x264 --enable-xvid --enable-gpl --enable-pp --disable-opts
  libavutil version: 49.1.0
  libavcodec version: 51.28.0
  libavformat version: 51.7.0
  built on Dec 25 2006 14:05:43, gcc: 4.1.1 (Gentoo 4.1.1-r1)
Input #0, image2, from 'test%02d.ppm':
  Duration: 00:00:10.0, start: 0.000000, bitrate: N/A
  Stream #0.0: Video: ppm, rgb24, 720x576,  0.20 fps(r)
Output #0, mpeg2video, to 'test.m2v':
  Stream #0.0: Video: mpeg2video, yuv420p, 720x576, q=2-31, 5000 kb/s, 25.00 
fps(c)
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=  125 q=7.0 Lsize=     575kB time=5.0 bitrate= 949.0kbits/s
video:19kB audio:0kB global headers:0kB muxing overhead 2956.040303%

~ # ffplay test.m2v


An alternative command-line test:
~ # ppmtoy4m -n125 -F 25:1 -r test01.ppm -S 420mpeg2 2> /dev/null | 
ffmpeg -y -i - -b 5000k -bufsize 224k -maxrate 7000k -f mpeg2video test.m2v

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2006 Fabrice Bellard, et al.
  
configuration:  --prefix=/usr --enable-shared --mandir=/usr/share/man --disable-altivec --disable-debug --disable-dv1394 --enable-a52 --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-amr_if2 --enable-dts --enable-mp3lame --enable-libogg --enable-vorbis --enable-x264 --enable-xvid --enable-gpl --enable-pp --disable-opts
  libavutil version: 49.1.0
  libavcodec version: 51.28.0
  libavformat version: 51.7.0
  built on Dec 25 2006 14:05:43, gcc: 4.1.1 (Gentoo 4.1.1-r1)
Input #0, yuv4mpegpipe, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0.0: Video: rawvideo, yuv420p, 720x576, 25.00 fps(r)
Output #0, mpeg2video, to 'test.m2v':
  Stream #0.0: Video: mpeg2video, yuv420p, 720x576, q=2-31, 5000 kb/s, 25.00 
fps(c)
Stream mapping:
  Stream #0.0 -> #0.0
frame=  125 q=7.0 Lsize=     571kB time=5.0 bitrate= 943.3kbits/s
video:571kB audio:0kB global headers:0kB muxing overhead 0.000000%

~ # ffplay test.m2v

Converting the image to another format such as PNG has no effect.
Initially I thought that it maybe a problem with the way the image was created 
(using Imagemagick), but the problem also presents itself when reading from 
MythTV's mythtranscode pipes (yuv420p) for example.

Here are the versions I have tested with:
ffmpeg-svn (BAD)
  libavcodec version: 51.28.0

0.4.9_p20061016 (BAD)
  libavcodec version: 51.20.0

0.4.9_p20060816 (GOOD)
  libavcodec version: 51.11.0

Hopefully someone else will be able to reproduce and have better success with 
a fix than I did.
Perhaps there is a new command-line switch that needs to be flipped or 
specified, I'm not sure.


Bests,
Rick




More information about the ffmpeg-devel mailing list