Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5319 closed defect (fixed)

ac3 decoder can become "broken from then on" if fed certain corrupted input

Reported by: rogerdpack Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: ac3 regression
Cc: jsantiago@fastmail.us Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug: While decoding some ac3 data received from a "live" source (i.e. with some small packet loss), the decoder can enter a state where it just outputs "junk" from then on and forever (i.e. doesn't recover).

How to reproduce:

% /ffmpeg -i 7mate.small.ts -y out.wav
ffmpeg version N-78986-ga62d768 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-libx264 --enable-gpl
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.100 / 57. 28.100
  libavformat    57. 28.100 / 57. 28.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpegts, from '7mate.small.ts':
  Duration: 00:00:28.06, start: 1.400000, bitrate: 412 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 384 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf57.28.100
    Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc57.28.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (ac3 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[ac3 @ 0x7fdef1095400] exponent -1 is out-of-range
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] delta bit allocation strategy reserved
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] exponent 25 is out-of-range
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] delta bit allocation strategy reserved
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
Input stream #0:0 frame changed from rate:48000 fmt:fltp ch:2 chl:stereo to rate:44100 fmt:fltp ch:2 chl:stereo
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
Input stream #0:0 frame changed from rate:44100 fmt:fltp ch:2 chl:stereo to rate:48000 fmt:fltp ch:2 chl:stereo
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] exponent 26 is out-of-range
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] invalid coupling range (9 >= 5)
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] exponent -1 is out-of-range
[ac3 @ 0x7fdef1095400] error decoding the audio block
Input stream #0:0 frame changed from rate:48000 fmt:fltp ch:2 chl:stereo to rate:32000 fmt:fltp ch:4 chl:quad(side)
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
Input stream #0:0 frame changed from rate:32000 fmt:fltp ch:4 chl:quad(side) to rate:48000 fmt:fltp ch:2 chl:stereo
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block

...

[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0

...

[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] new coupling strategy must be present in block 0
[ac3 @ 0x7fdef1095400] error decoding the audio block
[ac3 @ 0x7fdef1095400] incomplete frame
size=    4823kB time=00:00:28.09 bitrate=1406.2kbits/s speed= 409x

full output (which has many repeated lines) here: https://gist.github.com/rdp/85f7273c59bb692f10d1

You'll notice the audio "conks out" after about 10s.

However, if you skip past 10s, it successfully decodes the audio after that point.

./ffmpeg -ss 10 -i 7mate.small.ts 7mate.after.wav
ffmpeg version N-78986-ga62d768 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-libx264 --enable-gpl
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.100 / 57. 28.100
  libavformat    57. 28.100 / 57. 28.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpegts, from '7mate.small.ts':
  Duration: 00:00:28.06, start: 1.400000, bitrate: 412 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 384 kb/s
Output #0, wav, to '7mate.after.wav':
  Metadata:
    ISFT            : Lavf57.28.100
    Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc57.28.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (ac3 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[ac3 @ 0x7fcc12888600] exponent -1 is out-of-range
[ac3 @ 0x7fcc12888600] error decoding the audio block
[ac3 @ 0x7fcc12888600] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fcc12888600] exponent -1 is out-of-range
[ac3 @ 0x7fcc12888600] error decoding the audio block
[ac3 @ 0x7fcc12888600] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fcc12888600] exponent -1 is out-of-range
[ac3 @ 0x7fcc12888600] error decoding the audio block
[ac3 @ 0x7fcc12888600] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fcc12888600] exponent 25 is out-of-range
[ac3 @ 0x7fcc12888600] error decoding the audio block
[ac3 @ 0x7fcc12888600] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
[ac3 @ 0x7fcc12888600] incomplete frame
size=    3237kB time=00:00:18.09 bitrate=1465.4kbits/s speed= 609x
video:0kB audio:3237kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002353%

It seems something at around 10s is somehow poison pilling the rest of the output and from then on it no longer recovers or decodes anything, even though there is some valid ac3 data there.

Attachments (1)

7mate.small.ts (1.4 MB) - added by rogerdpack 3 years ago.
contains the offending ac3 blip

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by rogerdpack

contains the offending ac3 blip

comment:1 Changed 3 years ago by rogerdpack

(as a note, VLC seems able to decode/play the clip OK...not sure what decoder they're using...)

comment:2 Changed 3 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords ac3 regression added
  • Priority changed from normal to important
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from unspecified to git-master

See also ticket #5225.

Regression since 252f5663 / 97de206b
Workaround is to specify --disable-decoder=eac3 or -err_detect crccheck

comment:3 Changed 3 years ago by cehoyos

Using -er 0 this is a regression since ca6e7708

comment:4 Changed 3 years ago by jlsantiago0

  • Cc jsantiago@fastmail.us added

comment:5 Changed 3 years ago by michael

  • Resolution set to fixed
  • Status changed from open to closed

comment:6 Changed 3 years ago by rogerdpack

seems working here at least on the sample, thank you very much!

Note: See TracTickets for help on using tickets.