Opened 10 years ago

Last modified 8 years ago

#3776 open defect

Decoding bug when playing some MPEG-4 ALS streams

Reported by: olderz Owned by: Thilo Borgmann
Priority: normal Component: undetermined
Version: git-master Keywords: als
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

When I play some mp4/als streams with ffplay (and others players based on it) at the end of playback it produces an artificial sound like a buzz, it doesn't happen using ffmpeg.
I use mp4alsRM22rev2 for encoding (since RM23 version produces outputs not fully compatibile with FFmpeg).
I attach some files with this problem, the encoding parameters used are these:
"The Velvet Machina.mp4": -7 -g4 -p -t2 -o127 -r-1
"Starbeam Antarctica.mp4": -7 -g5 -t2 -o127 -n1800 -r-1
"Crushcrushcrush.mp4": -r-1
The bug occur with a 1/3 of encoded files.
I tried too with the latest ffplay & ffmpeg builds out today, but the problem persist.
Thanks in advance.

Attachments (3)

buzz.mp4 (2.1 MB ) - added by olderz 10 years ago.
mp4alsrm22[works].mp4 (1.7 MB ) - added by olderz 10 years ago.
mp4alsrm23[bad].mp4 (1.7 MB ) - added by olderz 10 years ago.

Change History (10)

in reply to:  description ; comment:1 by Carl Eugen Hoyos, 10 years ago

Replying to olderz:

(since RM23 version produces outputs not fully compatibile with FFmpeg)

Don't you agree that this is a magnitude more important than an issue with ffplay that I suspect is already described in ticket #2289?

in reply to:  1 comment:2 by olderz, 10 years ago

Replying to cehoyos:

Replying to olderz:

(since RM23 version produces outputs not fully compatibile with FFmpeg)

Don't you agree that this is a magnitude more important than an issue with ffplay that I suspect is already described in ticket #2289?

The file is too big to attach, i uploaded it in mediafire: http://www.mediafire.com/download/p8qubro1117t3ti/bugged+als.7z
RM23 version introduces the support to infinites sample rate, the coefficients table is changed, so I think is this the reason whereby ffmpeg doesn't fully support it.
Yes, it's more important, but none seems interested about als, so I didn't want to sound pretentious requesting an update for alsdec.

comment:3 by Thilo Borgmann, 10 years ago

We are still interested in ALS :)

Please produce a small sample showing the buzzing problem you're talking about.
You might use ffmpeg to crop your audio input and take 2s or something and encode it using RM22 _and_ RM23 (both would really be beneficial)

Thanks for reporting!

comment:4 by Carl Eugen Hoyos, 10 years ago

Component: ffplayundetermined
Keywords: als added
Reproduced by developer: set
Status: newopen

Samples uploaded to http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3776/
For future tickets: Please read https://ffmpeg.org/bugreports.html (neither 7z nor mediafire are appreciated) and please always provide command line and console output.

$ ffplay Starbeam\ Antarctica.mp4 -autoexit
ffplay version N-64723-g88f038a Copyright (c) 2003-2014 the FFmpeg developers
  built on Jul 17 2014 16:04:34 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 92.101 / 52. 92.101
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.101 / 55. 48.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.102 /  4. 11.102
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Starbeam Antarctica.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2014-07-17 08:16:13
  Duration: 00:03:53.91, start: 0.000000, bitrate: 1121 kb/s
    Stream #0:0(und): Audio: mp4als (mp4a / 0x6134706D), 44100 Hz, 2 channels, s16, 1121 kb/s (default)
    Metadata:
      creation_time   : 2014-07-17 08:16:13
[als @ 0x7f9384001fa0] Damaged channel data.  0KB sq=    0B f=0/0
[als @ 0x7f9384001fa0] Reading frame data failed. Skipping RA unit.
 234.03 M-A:  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
$ ffmpeg -i Starbeam\ Antarctica.mp4 out.wav
ffmpeg version N-64723-g88f038a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul 17 2014 16:04:34 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 92.101 / 52. 92.101
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.101 / 55. 48.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.102 /  4. 11.102
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Starbeam Antarctica.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2014-07-17 08:16:13
  Duration: 00:03:53.91, start: 0.000000, bitrate: 1121 kb/s
    Stream #0:0(und): Audio: mp4als (mp4a / 0x6134706D), 44100 Hz, 2 channels, s16, 1121 kb/s (default)
    Metadata:
      creation_time   : 2014-07-17 08:16:13
Output #0, wav, to 'out.wav':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    ISFT            : Lavf55.48.101
    Stream #0:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s (default)
    Metadata:
      creation_time   : 2014-07-17 08:16:13
      encoder         : Lavc55.69.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (mp4als (als) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=   40294kB time=00:03:53.90 bitrate=1411.2kbits/s
video:0kB audio:40294kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000189%

by olderz, 10 years ago

Attachment: buzz.mp4 added

by olderz, 10 years ago

Attachment: mp4alsrm22[works].mp4 added

by olderz, 10 years ago

Attachment: mp4alsrm23[bad].mp4 added

comment:5 by olderz, 10 years ago

I forgot to say that the buzz bug occurs only skipping during playback.
Thanks for the patience, hereafter I'll only use the attachments function.
I attached three files, here the logs:

$ c:/a/ffplay 'c:/Users/olderz/Documents/Download/bugged als/buzz.mp4'
ffplay version N-64711-gfa6716c Copyright (c) 2003-2014 the FFmpeg developers
  built on Jul 16 2014 22:02:05 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.101 / 55. 48.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c:/Users/olderz/Documents/Download/bugged als/buzz.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2014-07-17 13:50:45
  Duration: 00:00:16.89, start: 0.000000, bitrate: 1055 kb/s
    Stream #0:0(und): Audio: mp4als (mp4a / 0x6134706D), 44100 Hz, 2 channels, s16, 1054 kb/s (default)
    Metadata:
      creation_time   : 2014-07-17 13:50:45
Seek to 91% ( 0:00:14) of total duration ( 0:00:16)       B f=0/0
[als @ 039d75c0] Damaged channel data. vq=    0KB sq=    0B f=0/0
[als @ 039d75c0] Reading frame data failed. Skipping RA unit.
$ c:/a/ffmpeg -i 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm23[bad].mp4' -c:a pcm_s24le 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm23[bad].wav'
ffmpeg version N-64711-gfa6716c Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul 16 2014 22:02:05 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.101 / 55. 48.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : 5.1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm23[bad].mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.48.101
  Duration: 00:00:05.12, start: 0.066000, bitrate: 2855 kb/s
    Stream #0:0(und): Audio: mp4als (mp4a / 0x6134706D), 48000 Hz, 6 channels, s32, 2853 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm23[bad].wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm23[bad].wav':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    ISFT            : Lavf55.48.101
    Stream #0:0(und): Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32, 6912 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc55.69.100 pcm_s24le
Stream mapping:
  Stream #0:0 -> #0:0 (mp4als (als) -> pcm_s24le (native))
Press [q] to stop, [?] for help
[als @ 03a1dae0] Invalid channel pair.
    Last message repeated 1 times
[als @ 03a1dae0] quant_cof 4294967173 is out of range.
[als @ 03a1dae0] Reading frame data failed. Skipping RA unit.
[als @ 03a1dae0] Invalid master channel.
[als @ 03a1dae0] Reading frame data failed. Skipping RA unit.
size=    4320kB time=00:00:05.12 bitrate=6912.2kbits/s
video:0kB audio:4320kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002306%
$ c:/a/ffmpeg -i 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm22[works].mp4' -c:a pcm_s24le 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm22[works].wav'
ffmpeg version N-64711-gfa6716c Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul 16 2014 22:02:05 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.101 / 55. 48.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : 5.1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm22[works].mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.47.100
  Duration: 00:00:05.12, start: 0.066000, bitrate: 2856 kb/s
    Stream #0:0(und): Audio: mp4als (mp4a / 0x6134706D), 48000 Hz, 6 channels, s32, 2855 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm22[works].wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'c:/Users/olderz/Documents/Download/bugged als/mp4alsrm22[works].wav':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    ISFT            : Lavf55.48.101
    Stream #0:0(und): Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32, 6912 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc55.69.100 pcm_s24le
Stream mapping:
  Stream #0:0 -> #0:0 (mp4als (als) -> pcm_s24le (native))
Press [q] to stop, [?] for help
size=    4320kB time=00:00:05.12 bitrate=6912.2kbits/s
video:0kB audio:4320kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002306%
Last edited 10 years ago by olderz (previous) (diff)

comment:6 by muken, 10 years ago

The libavcodec's ALS decoder has the frame counter (frame_id) to omit the last extra samples.
Unfortunately, this counter is reset to 0 when flushing buffers.
And any demuxer can't access to reset the counter in the private data.
So, the decoder can't omit last extra samples and makes a noisy sound when seeking to non-first frames.

To resolve this issue, add any method to access the counter from the externals.

comment:7 by Thilo Borgmann, 8 years ago

Owner: set to Thilo Borgmann
Note: See TracTickets for help on using tickets.