Opened 15 years ago
Closed 2 years 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)
Change History (8)
by , 15 years ago
| Attachment: | MPEG30B.caf added |
|---|
by , 15 years ago
| Attachment: | patchMPEG30Blayout.diff added |
|---|
comment:1 by , 14 years ago
| Analyzed by developer: | set |
|---|---|
| Reproduced by developer: | set |
| Status: | new → open |
| Type: | enhancement → defect |
| Version: | git → git-master |
comment:2 by , 13 years ago
| Keywords: | chan added; pcm channel order layout removed |
|---|
comment:3 by , 11 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:5 by , 5 years ago
Is not that like this done here https://github.com/FFmpeg/FFmpeg/blob/a0ac49e38ee1d1011c394d7be67d0f08b2281526/libavformat/mov_chan.c#L177 and
maybe it should be here https://github.com/FFmpeg/FFmpeg/blob/904ab5365cf4881eae1e5cac980f3c4f252b69cd/libavformat/isom.c#L711 after 91b782720fd0df5571775b6591bc41797d6ecf78
comment:6 by , 2 years ago
| Resolution: | → fixed |
|---|---|
| Status: | open → closed |
Fixed in e6c2c8703732bc46395c65c530038c8146df0deb.



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 specifiedI sent a patch last year to fix this ticket:
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/132789