Opened 11 years ago

Closed 11 years ago

#3542 closed defect (fixed)

Changing channel layout from downmix to stereo fails

Reported by: Carl Eugen Hoyos Owned by:
Priority: important Component: swresample
Version: git-master Keywords: regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

This is closely related to ticket #2859.
Switching the channel layout from downmix to stereo using swresample fails since c56d4dab

$ ffmpeg -f s24le -ac 2 -i /dev/zero -t 1 -channel_layout DL+DR -acodec copy out.wav
$ ffmpeg -i out.wav -channel_layout stereo out2.wav
ffmpeg version N-62299-g60ef0c6 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr  9 2014 15:01:30 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 75.100 / 52. 75.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 36.102 / 55. 36.102
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, wav, from 'out.wav':
  Metadata:
    encoder         : Lavf55.36.102
  Duration: 00:00:01.02, bitrate: 2117 kb/s
    Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 44100 Hz, downmix, s32, 2116 kb/s
[auto-inserted resampler 0 @ 0x24704c0] [SWR @ 0x24440c0] Input channel layout 'downmix' is not supported
[auto-inserted resampler 0 @ 0x24704c0] Failed to configure output pad on auto-inserted resampler 0
Error opening filters!

Work-around is to force the input channel layout:

$ ffmpeg -channel_layout stereo -i out.wav out2.wav

Generally, this is an issue when extracting a downmix stream from a mov file to 24bit wav: The resulting wav file will not play in QT since QT doesn't like the wav channel layout "downmix".

Change History (4)

comment:1 by Carl Eugen Hoyos, 11 years ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 11 years ago

Since I am not so sure if it is valid at all to write "downmix" to a wav file, here is a more realistic alternative:

$ ffmpeg -f s16be -ac 2 -channel_layout DL+DR -i /dev/zero -t 1 -acodec pcm_s16be out.mov
$ ffmpeg -i out.mov -channel_layout stereo -acodec pcm_s16be out2.mov
ffmpeg version N-62299-g60ef0c6 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr  9 2014 15:01:30 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 75.100 / 52. 75.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 36.102 / 55. 36.102
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf55.19.104
  Duration: 00:00:01.00, start: 0.000000, bitrate: 1416 kb/s
    Stream #0:0(eng): Audio: pcm_s16be (twos / 0x736F7774), 44100 Hz, downmix, s16, 1411 kb/s (default)
    Metadata:
      handler_name    : DataHandler
[auto-inserted resampler 0 @ 0x2c99160] [SWR @ 0x2c99580] Input channel layout 'downmix' is not supported
[auto-inserted resampler 0 @ 0x2c99160] Failed to configure output pad on auto-inserted resampler 0
Error opening filters!

comment:3 by speedyrazor, 11 years ago

I am having the same issues with this line, looking for a workarround:

ffmpeg -guess_layout_max 0 -i 5.1_Stereo_test.mov -map 0:1 -acodec pcm_s24le -y test_01_Mono.wav -map 0:2 -acodec pcm_s24le -y test_02_Mono.wav -map 0:3 -acodec pcm_s24le -y test_03_Mono.wav -map 0:4 -acodec pcm_s24le -y test_04_Mono.wav -map 0:5 -acodec pcm_s24le -y test_05_Mono.wav -map 0:6 -acodec pcm_s24le -y test_06_Mono.wav -channel_layout stereo -map 0:7 -acodec pcm_s24le test_07_Stereo.wav
$ ffmpeg -guess_layout_max 0 -i 5.1_Stereo_test.mov -map 0:1 -acodec pcm_s24le -y test_01_Mono.wav -map 0:2 -acodec pcm_s24le -y test_02_Mono.wav -map 0:3 -acodec pcm_s24le -y test_03_Mono.wav -map 0:4 -acodec pcm_s24le -y test_04_Mono.wav -map 0:5 -acodec pcm_s24le -y test_05_Mono.wav -map 0:6 -acodec pcm_s24le -y test_06_Mono.wav -channel_layout stereo -map 0:7 -acodec pcm_s24le test_07_Stereo.wav
ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 22 2014 06:02:12 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '5.1_Stereo_test.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2014-03-06 11:25:34
  Duration: 00:01:03.48, start: 0.000000, bitrate: 153967 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x1080, 144704 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbc (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FL), s32, 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FR), s32, 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (LFE), s32, 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BL), s32, 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BR), s32, 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, downmix, s32, 2304 kb/s (default)
    Metadata:
      creation_time   : 2014-03-06 11:25:34
      handler_name    : Apple Alias Data Handler
    Stream #0:8(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-03-06 11:26:04
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[auto-inserted resampler 0 @ 0x7f85e2e1ad40] [SWR @ 0x7f85e411bc00] Input channel layout 'downmix' is not supported
[auto-inserted resampler 0 @ 0x7f85e2e1ad40] Failed to configure output pad on auto-inserted resampler 0

comment:4 by Michael Niedermayer, 11 years ago

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