Opened 14 years ago

Closed 8 months ago

#98 closed defect (fixed)

Channel reordering in pcm files

Reported by: Carl Eugen Hoyos Owned by:
Priority: minor Component: undetermined
Version: git-master Keywords: chan
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

I will attach a three channel pcm caf file. The file contains left, center and right stream, FFmpeg currently warns that the channel layout is unsupported. It is simple to set the correct channel layout (trivial patch attached), but the problem is that the file has channel order "center, left, right" (MPEG-3-0-B), so that FFmpeg maps the left channel to the right, the right channel to center and the center channel to the left channel on decoding.

How can a demuxer tell the pcm decoder that the decoder has to reorder channels?

ffmpeg -i MPEG30B.caf
FFmpeg version git-N-29301-gab15726, Copyright (c) 2000-2011 the FFmpeg developers
  built on Apr 23 2011 10:48:07 with gcc 4.5.2
  configuration: --cc=/usr/local/gcc-4.5.2/bin/gcc --enable-gpl --enable-libcelt
  libavutil    51.  0. 0 / 51.  0. 0
  libavcodec   53.  1. 0 / 53.  1. 0
  libavformat  53.  0. 1 / 53.  0. 1
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  0. 0 /  2.  0. 0
  libswscale    0. 13. 0 /  0. 13. 0
[caf @ 0x12a0ae0] Unknown channel layout.
[caf @ 0x12a0ae0] Estimating duration from bitrate, this may be inaccurate
Input #0, caf, from 'MPEG30B.caf':
  Duration: 00:00:10.66, start: 0.000000, bitrate: 1151 kb/s
    Stream #0.0: Audio: pcm_s8, 48000 Hz, 3 channels, u8, 1152 kb/s
At least one output file must be specified

Attachments (2)

MPEG30B.caf (1.5 MB ) - added by Carl Eugen Hoyos 14 years ago.
patchMPEG30Blayout.diff (894 bytes ) - added by Carl Eugen Hoyos 14 years ago.

Download all attachments as: .zip

Change History (8)

by Carl Eugen Hoyos, 14 years ago

Attachment: MPEG30B.caf added

by Carl Eugen Hoyos, 14 years ago

Attachment: patchMPEG30Blayout.diff added

comment:1 by Carl Eugen Hoyos, 12 years ago

Analyzed by developer: set
Reproduced by developer: set
Status: newopen
Type: enhancementdefect
Version: gitgit-master

This is now a bug because FFmpeg incorrectly reports "3.0" instead of "3 channels, unknown layout".

$ ffmpeg -i MPEG30B.caf
ffmpeg version N-44712-g7200fec Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 23 2012 21:08:48 with gcc 4.5.3 (GCC)
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 58.100 / 54. 58.100
  libavformat    54. 28.100 / 54. 28.100
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[caf @ 0x14f4240] Estimating duration from bitrate, this may be inaccurate
Input #0, caf, from 'MPEG30B.caf':
  Duration: 00:00:10.66, start: 0.000000, bitrate: 1151 kb/s
    Stream #0:0: Audio: pcm_s8 (lpcm / 0x6D63706C), 48000 Hz, 3.0, u8, 1152 kb/s
At least one output file must be specified

I sent a patch last year to fix this ticket:
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/132789

comment:2 by Carl Eugen Hoyos, 12 years ago

Keywords: chan added; pcm channel order layout removed

comment:3 by Michael Niedermayer, 9 years ago

more possible solutions: (not saying they are better or not than what was suggested)
the demxuer could just reorder chanels
the demuxer could pass the channel order through extradata or sidedata to the decoder

comment:4 by Elon Musk, 9 years ago

Proper way is having more generic channels layout representation.

comment:6 by Marton Balint, 8 months ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.