#9964 closed defect (fixed)

Wrong channel mapping in decoded 5.1 ATRAC3plus stream

Reported by: ptalarbvorm Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: atrac3p channel_layout
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description (last modified by ptalarbvorm)

Summary of the bug:

When decoding a 5.1 atrac3plus stream (container = .WAV),
ffplay sends the last 3 channels to the wrong speakers:
the back-left channel is sent to the LFE speaker, the back-right channel to the back-left speaker, and the LFE channel goes to the back-right speaker.
I've uploaded an archive containing a test file and its uncompressed-PCM source to MediaFire:

https://www.mediafire.com/file/qazbkif0xwf60fp/atrac3plus-multichsample.7z/file

How to reproduce:

% ffplay ATRAC3plus-5p1.wav -autoexit
ffplay version N-108492-gb92e14147f-20221004 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32-
 --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enabl
e-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig -
-enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-liba
om --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cu
da-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3la
me --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-l
ibmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enab
le-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-
libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-
libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags
=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20221004

  libavutil      57. 38.100 / 57. 38.100
  libavcodec     59. 50.100 / 59. 50.100
  libavformat    59. 34.100 / 59. 34.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, wav, from 'ATRAC3plus-5p1.wav':=    0KB sq=    0B f=0/0
  Duration: 00:00:05.84, bitrate: 517 kb/s
  Stream #0:0: Audio: atrac3p, 48000 Hz, 5.1, fltp, 513 kb/s
   5.82 M-A: -0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

P.S.: I have just decompressed the test file with ffmpeg and confirmed that the result also has a wrong channel-mapping, whereas the ""official"" decoder PS3at3tool.exe (by Sony) preserves the correct channel-mapping of the original uncompressed source.

ffmpeg -i ATRAC3plus-5p1.wav out.wav
ffmpeg version 5.1.1-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --
enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enabl
e-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --
enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --en
able-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-m
ediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab
--enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nven
c --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enab
le-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libsh
ine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb -
-enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --ena
ble-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, wav, from 'ATRAC3plus-5p1.wav':
  Duration: 00:00:05.84, bitrate: 517 kb/s
  Stream #0:0: Audio: atrac3p, 48000 Hz, 5.1, fltp, 513 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (atrac3p (atrac3plus) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf59.27.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s16, 4608 kb/s
    Metadata:
      encoder         : Lavc59.37.100 pcm_s16le
size=    3312kB time=00:00:05.88 bitrate=4608.1kbits/s speed=71.4x
video:0kB audio:3312kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003008%

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

ATRAC3plus-5p1.wav (368.8 KB ) - added by mkver 19 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 by ptalarbvorm, 19 months ago

Description: modified (diff)

comment:2 by ptalarbvorm, 19 months ago

Summary: ffplay: wrong channel mapping in decoded 5.1 ATRAC3plus streamWrong channel mapping in decoded 5.1 ATRAC3plus stream

comment:3 by mkver, 19 months ago

I uploaded your file here to preserve it in case the mediafire links die.

Last edited 19 months ago by mkver (previous) (diff)

by mkver, 19 months ago

Attachment: ATRAC3plus-5p1.wav added

comment:4 by Carl Eugen Hoyos, 19 months ago

Keywords: atrac3p added; atrac3plus multichannel channel-layout removed
Version: unspecifiedgit-master

comment:5 by Carl Eugen Hoyos, 19 months ago

Keywords: channel_layout added

comment:6 by ptalarbvorm, 19 months ago

Status: newopen

comment:8 by James, 18 months ago

Analyzed by developer: set
Reproduced by developer: set
Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.