[Ffmpeg-devel] BUG REPORT: Garbled audio when AC3 stream changes channel count

Norman Ramsey nr
Sun Dec 18 19:23:46 CET 2005


FFmpeg becomes confused when transcoding certain audio files.
The resulting audio files are OK up to a point, after which everything
sounds like chipmunks.  I suspect that the problem is an A/52 (AC3)
audio stream that changes between 5.1 channels and 2 channels in the
middle of the stream.  Details follow.


I am using the CVS version of FFmpeg compiled today, 18 Dec 2005.

    * What I am trying to accomplish: transcode US ATSC
      high-definition television broadcast (MPEG-2 TS) to MPEG-2 file
      suitable for passing to dvdauthor and burning to DVD.

    * The problem I encountered: at some point partway through a file,
      audio suddenly sounds like 'the chipmunks': it is very
      high-pitched, unintelligble, and no longer synchronized with
      video.  Audio typically then finishes well before video.

    * The exact command line I was using:

         myffmpeg -i bud-light.ts -target ntsc-dvd -b 4000 -bufsize 400 -ab 384 \
           -maxrate 7000 -mbd 2 -trell zzz -acodec ac3 ffm-bud-light.mpg

      N.B. 'myffmpeg' is my version compiled from CVS (as opposed to
      the Debian version in /usr/bin/ffmpeg).

    * The console output provided by FFmpeg:

        ffmpeg version CVS, build 3342336, Copyright (c) 2000-2004 Fabrice Bellard
          configuration:  --enable-gpl --enable-a52 
          built on Dec 18 2005 12:48:26, gcc: 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)
        Input #0, mpegts, from 'bud-light.ts':
          Duration: 00:00:25.3, start: 17010.607378, bitrate: 17551 kb/s
          Stream #0.0[0x31], 59.94 fps(r): Video: mpeg2video, yuv420p, 1280x720, 16800 kb/s
          Stream #0.1[0x34](eng): Audio: ac3, 48000 Hz, 5:1, 384 kb/s
        Output #0, dvd, to 'ffm-bud-light.mpg':
          Stream #0.0, 29.97 fps(c): Video: mpeg2video (hq), yuv420p, 720x480, q=2-31, 4000 kb/s
          Stream #0.1: Audio: ac3, 48000 Hz, 5:1, 384 kb/s
        Stream mapping:
          Stream #0.0 -> #0.0
          Stream #0.1 -> #0.1
        Press [q] to stop encoding
        [mpeg2video @ 0x833d388]Warning MVs not available
        [mpeg2video @ 0x833d388]concealing 3320 DC, 3320 AC, 3320 MV errors
        frame=  763 q=0.0 Lsize=   12572kB time=18.0 bitrate=5737.0kbits/s    
        video:11304kB audio:842kB global headers:0kB muxing overhead 3.515292%

      N.B. Although the clip runs 25 seconds, FFmpeg reports only 18
      seconds.  This report is consistent with the output file, which
      contains 25 seconds of video and 18 seconds of audio.


It is not useful to run ffmpeg_g, because ffmpeg completes execution
without errors---only the output is bad.

Sample media illustrating the problem may be found at 

  http://http://www.eecs.harvard.edu/~nr/ffmpeg/chipmunks/bud-light.ts

This bug report may be found as file README in that directory.  I will
be happy to upload this file to ftp.mplayerhq.hu, but even this
25-second clip is 53MB (greater than the recommended 10MB).  
HD files are large :-(

I suspect this bug might be a fairly easy one to fix, if only I knew
the code base.  Probably the audio decoder is assuming that the format
of the AC3 stream remains unchanged.  Perhaps the problem could be
fixed by borrowing a more pessimistic decoder from the 'a52dec'
package.  The 'a52dec' application plays the AC3 stream correctly.



Norman Ramsey





More information about the ffmpeg-devel mailing list