[FFmpeg-devel] Bugtracker issue 1219, found svn rev breaking mp2/3 audio decoding in certain files

Chris Kennedy ivtv
Thu Jun 25 02:04:14 CEST 2009

I have issue 1219 opened in the bugtracker, I found the change in SVN
which causes this (garbled bad slow audio when decoding certain MPEG2 
files from a Hauppauge PVR500 encoder capture card).  It's this change,
SVN 18741:

r18741 | michael | 2009-05-05 08:46:50 -0500 (Tue, 05 May 2009) | 4 lines

Do not discard mp3 frames in the parser after a broken frame.
Fixes issue1044.
This may cause regressions with broken streams, if you find any, please report!

Index: libavcodec/mpegaudio_parser.c
--- libavcodec/mpegaudio_parser.c       (revision 18740)
+++ libavcodec/mpegaudio_parser.c       (revision 18741)
@@ -223,10 +223,8 @@

         if(s->frame_size > 0 && buf_ptr - buf == s->inbuf_ptr - s->inbuf
            && buf_size + buf_ptr - buf >= s->frame_size){
-            if(s->header_count > 0){
                 *poutbuf = buf;
                 *poutbuf_size = s->frame_size;
-            }
             buf_ptr = buf + s->frame_size;
             s->inbuf_ptr = s->inbuf;
             s->frame_size = 0;
@@ -236,10 +234,8 @@
         //    next_data:
         if (s->frame_size > 0 &&
             (s->inbuf_ptr - s->inbuf) >= s->frame_size) {
-            if(s->header_count > 0){
                 *poutbuf = s->inbuf;
                 *poutbuf_size = s->inbuf_ptr - s->inbuf;
-            }
             s->inbuf_ptr = s->inbuf;
             s->frame_size = 0;

Well I've got a broken stream to show this causing a problem, at:

And the output log/command line from the console when playing it:

I'm using the newest ffmpeg SVN version from today, which causes this problem, all the
way back to r18741, before that revision it's good.

This happens randomly it seems, not all files exibit the issue, they are chopped segments of a 
few minutes at the MPEG2 GOP.  Without this change, all revisions of FFMPEG do fine and don't
spit out errors, with this change it ruins the encoding to any codec and spits out the errors
in the .txt file link above.  It seems like it's trying to seek back beyond the start of the
file or something, just a guess.  With -async 1 it is different than without it, without it
the file is really too large and terrible audio/video, with it the file is the normal size/time
length but audio is slow and weird.


Chris Kennedy
ivtv at groovy.org

More information about the ffmpeg-devel mailing list