Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#200 closed defect (fixed)

aac - failure decoding audio stream when audio configuration changes

Reported by: Glenn Callow Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

After testing early Freeview HD support with MythTV, on some recordings on audio would stop partway through the recording. This typically happens on program start/end and the following error is reported:

[aac_latm @ 0xf13bc0]channel element 0.0 is not allocated

Using a recorded file, both VLC and Mplayer exhibit the same problem, which indicates FFMpeg as the likely source. What appears to happen is there is a change in audio configuration in some of the streams from stereo to six speakers and back again. FFMpeg can decode both configurations fine, but fails if a transition occurs mid-stream.

I've posted a 50MB clip that exhibits the problem at:

http://www.mediafire.com/?5zx2x3zv2g6hxys

The audio decodes fine for the first three quarters of the clip, and then fails when the program starts.

Attachments (3)

stereo51.aac (389.5 KB ) - added by Carl Eugen Hoyos 13 years ago.
stereomono.aac (86.5 KB ) - added by Carl Eugen Hoyos 13 years ago.
stereo51.loas (884.7 KB ) - added by Carl Eugen Hoyos 12 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Carl Eugen Hoyos, 13 years ago

Component: undeterminedavcodec
Reproduced by developer: set
Status: newopen
Summary: aac_latm - failure decoding audio stream when audio configuration changesaac - failure decoding audio stream when audio configuration changes
Version: unspecifiedgit-master

I will attach two non-latm samples that show the problem:

$ ffmpeg -i stereomono.aac out1.wav
ffmpeg version git-N-29973-gf2962ac, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 17 2011 01:56:25 with gcc 4.5.3
  configuration: --cc='/usr/local/gcc-4.5.3/bin/gcc -m32' --enable-gpl
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  1. 0 / 53.  1. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  5. 0 /  2.  5. 0
  libswscale    0. 14. 0 /  0. 14. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[NULL @ 0x8ca3b20] Format aac detected only with low score of 25, misdetection possible!
[aac @ 0x8ca5960] channel element 3.3 is not allocated
[aac @ 0x8ca3b20] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'stereomono.aac':
  Duration: 00:00:05.47, bitrate: 129 kb/s
    Stream #0.0: Audio: aac, 48000 Hz, stereo, s16, 129 kb/s
Output #0, wav, to 'out1.wav':
  Metadata:
    encoder         : Lavf53.1.0
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
[aac @ 0x8ca5960] channel element 3.3 is not allocated
Error while decoding stream #0.0
[aac @ 0x8ca5960] channel element 0.0 is not allocated
Error while decoding stream #0.0
Error while decoding stream #0.0

...

Error while decoding stream #0.0
Error while decoding stream #0.0
    Last message repeated 167 times
size=     248kB time=1.32 bitrate=1536.3kbits/s    ^M
video:0kB audio:248kB global headers:0kB muxing overhead 0.017326%

out1.wav contains one second of stereo sound, mplayer -ac ffaac -sb 31500 stereomono.aac plays the remaining >3 seconds of mono.

$ ffmpeg -i stereo51.aac out2.wav
ffmpeg version git-N-29973-gf2962ac, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 17 2011 01:56:25 with gcc 4.5.3
  configuration: --cc='/usr/local/gcc-4.5.3/bin/gcc -m32' --enable-gpl
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  1. 0 / 53.  1. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  5. 0 /  2.  5. 0
  libswscale    0. 14. 0 /  0. 14. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[aac @ 0x8ca5960] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x8ca5960] channel element 3.1 is not allocated
[aac @ 0x8ca3b20] max_analyze_duration reached
[aac @ 0x8ca3b20] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'stereo51.aac':
  Duration: 00:00:17.98, bitrate: 177 kb/s
    Stream #0.0: Audio: aac, 48000 Hz, stereo, s16, 177 kb/s
Output #0, wav, to 'out2.wav':
  Metadata:
    encoder         : Lavf53.1.0
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
[aac @ 0x8ca5960] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x8ca5960] channel element 3.1 is not allocated
Error while decoding stream #0.0
[aac @ 0x8ca5960] Not evaluating a further program_config_element as this construct is dubious at best.
[aac @ 0x8ca5960] channel element 0.0 is not allocated
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
    Last message repeated 22 times
[aac @ 0x8ca5960] Not evaluating a further program_config_element as this construct is dubious at best.
[aac @ 0x8ca5960] channel element 0.0 is not allocated
Error while decoding stream #0.0
Error while decoding stream #0.0

...

Error while decoding stream #0.0
Error while decoding stream #0.0
    Last message repeated 22 times
[aac @ 0x8ca5960] Not evaluating a further program_config_element as this construct is dubious at best.
[aac @ 0x8ca5960] channel element 0.0 is not allocated
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
Error while decoding stream #0.0
    Last message repeated 13 times
size=    1368kB time=7.30 bitrate=1536.0kbits/s    ^M
video:0kB audio:1368kB global headers:0kB muxing overhead 0.003141%

out2.wav contains 7 seconds of stereo sound, mplayer -ac ffaac -channels 6 -sb 180000 stereo51.aac plays four (more) seconds of 5.1 sound.

by Carl Eugen Hoyos, 13 years ago

Attachment: stereo51.aac added

by Carl Eugen Hoyos, 13 years ago

Attachment: stereomono.aac added

comment:2 by Michael Niedermayer, 12 years ago

Resolution: fixed
Status: openclosed

comment:3 by Carl Eugen Hoyos, 12 years ago

Resolution: fixed
Status: closedreopened

The original sample still fails (parse_adts_frame_header is never called)

$ ffmpeg -i stereo51.loas out.ac3
ffmpeg version N-32813-g6d789f5, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 23 2011 09:28:25 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc
  libavutil    51. 17. 0 / 51. 17. 0
  libavcodec   53. 17. 0 / 53. 17. 0
  libavformat  53. 13. 0 / 53. 13. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 3 /  2. 43. 3
  libswscale    2.  1. 0 /  2.  1. 0
[loas @ 0x12b8780] max_analyze_duration 5000000 reached at 5013333
[loas @ 0x12b8780] Estimating duration from bitrate, this may be inaccurate
Input #0, loas, from 'stereo51.loas':
  Duration: N/A, bitrate: N/A
    Stream #0.0: Audio: aac_latm, 48000 Hz, stereo, s16
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
Output #0, ac3, to 'out.ac3':
  Metadata:
    encoder         : Lavf53.13.0
    Stream #0.0: Audio: ac3, 48000 Hz, stereo, flt, 128 kb/s
Stream mapping:
  Stream #0.0 -> #0.0 (aac_latm -> ac3)
Press [q] to stop, [?] for help
[aac_latm @ 0x12beb20] channel element 0.0 is not allocated
Error while decoding stream #0.0
Error while decoding stream #0.0

...

Error while decoding stream #0.0
Error while decoding stream #0.0
    Last message repeated 692 times
size=     308kB time=00:00:19.68 bitrate= 128.0kbits/s
video:0kB audio:308kB global headers:0kB muxing overhead 0.000000%

by Carl Eugen Hoyos, 12 years ago

Attachment: stereo51.loas added

comment:4 by Michael Niedermayer, 12 years ago

Resolution: fixed
Status: reopenedclosed

2nd try

comment:5 by Hendrik, 12 years ago

Sadly the fix for this issue caused some other files to decode corrupted.
See Issue574 for details.

Note: See TracTickets for help on using tickets.