Opened 11 years ago

Closed 11 years ago

#2899 closed defect (fixed)

-map_channel / -af pan are not processing 12 channel audio inputs (af_pan does not support streams with unknown channel layout yet)

Reported by: Roman Gaufman Owned by:
Priority: important Component: avfilter
Version: git-master Keywords: pan regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Here is a wav file, it is 12 channels: http://itstar.co.uk/test.wav

I need to be able to get just 1 specific channel out of it with FFMPEG. All the documented methods including -af pan and -map_channel are not working and producing an empty output file.

Examples of commands I tried include:

ffmpeg -i test.wav -af "pan=0x4|c0=c4" -y c4.wav

ffmpeg -i test.wav -map_channel 0.0.5 -y c5.wav

for i in 0 1 2 3 4 5 6 7 8 9 10 11; do ffmpeg -i test.wav -af "pan=1|c0=c${i}" -y ch${i}.wav; done

All of the above produce empty/silence output wav files.

Any ideas?

Change History (9)

comment:1 by Roman Gaufman, 11 years ago

Summary: FFMPEG -af pan not processing 12 channel audio inputs-map_channel / -af pan are not processing 12 channel audio inputs

comment:2 by Roman Gaufman, 11 years ago

Also note that ffmpeg version: N-35295-gb55dd10, built on Nov 30 2011 00:52:52 with gcc 4.6.2 works fine, but latest trunk is broken.

comment:3 by Cigaes, 11 years ago

Component: undeterminedavfilter
Reproduced by developer: set
Status: newopen

af_pan does not support streams with unknown channel layout yet. It should fail with a clearer error return, though.

In the meantime, you can get it to work by setting a dummy channel layout to the input, using aformat=channel_layouts=0xFFF for example.

comment:4 by Roman Gaufman, 11 years ago

This was working in 2011-11 and was already broken in 2012-10 - I have tried your suggestion but it still results in an empty file. This is the full command with the debug output:

root@XanBox:/home/deployer# ffmpeg -v debug -i test.wav -filter:a aformat=channel_layouts=0xFFF -af "pan=0x4|c0=c4" -y ch4.wav
ffmpeg version N-55065-g6b68e2a Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul 29 2013 20:46:32 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --enable-pic --enable-shared --extra-ldflags=-ldl --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --extra-cflags=-fPIC --extra-ldflags=-fPIC
  libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 19.100 / 55. 19.100
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input file with argument 'test.wav'.
Reading option '-filter:a' ... matched as option 'filter' (set stream filtergraph) with argument 'aformat=channel_layouts=0xFFF'.
Reading option '-af' ... matched as option 'af' (set audio filters) with argument 'pan=0x4|c0=c4'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'ch4.wav' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file test.wav.
Successfully parsed a group of options.
Opening an input file: test.wav.
[wav @ 0x13018c0] Format wav probed with size=2048 and score=99
[wav @ 0x13018c0] File position before avformat_find_stream_info() is 80
[wav @ 0x13018c0] parser not found for codec pcm_s16le, packets or times may be invalid.
[wav @ 0x13018c0] probing stream 0 pp:4
[wav @ 0x13018c0] probing stream 0 pp:3
[wav @ 0x13018c0] probing stream 0 pp:2
[wav @ 0x13018c0] probing stream 0 pp:1
[wav @ 0x13018c0] probed stream 0
[wav @ 0x13018c0] parser not found for codec pcm_s16le, packets or times may be invalid.
[wav @ 0x13018c0] Probe buffer size limit of 5000000 bytes reached
[wav @ 0x13018c0] File position after avformat_find_stream_info() is 5002160
Input #0, wav, from 'test.wav':
  Metadata:
    encoder         : Lavf55.12.102
  Duration: 00:00:10.89, bitrate: 9216 kb/s
    Stream #0:0, 1226, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 12 channels, s16, 9216 kb/s
Successfully opened the file.
Parsing a group of options: output file ch4.wav.
Applying option filter:a (set stream filtergraph) with argument aformat=channel_layouts=0xFFF.
Applying option af (set audio filters) with argument pan=0x4|c0=c4.
Successfully parsed a group of options.
Opening an output file: ch4.wav.
Successfully opened the file.
detected 4 logical cores
[Parsed_pan_0 @ 0x17f72a0] compat: called with args=[0x4|c0=c4]
[Parsed_pan_0 @ 0x17f72a0] Setting 'args' to value '0x4|c0=c4'
[graph 0 input from stream 0:0 @ 0x17f7680] Setting 'time_base' to value '1/48000'
[graph 0 input from stream 0:0 @ 0x17f7680] Setting 'sample_rate' to value '48000'
[graph 0 input from stream 0:0 @ 0x17f7680] Setting 'sample_fmt' to value 's16'
[graph 0 input from stream 0:0 @ 0x17f7680] Setting 'channels' to value '12'
[graph 0 input from stream 0:0 @ 0x17f7680] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:(null)
[audio format for output stream 0:0 @ 0x17f8d60] Setting 'sample_fmts' to value 's16'
[Parsed_pan_0 @ 0x17f72a0] auto-inserting filter 'auto-inserted resampler 0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_pan_0'
[AVFilterGraph @ 0x17f6880] query_formats: 4 queried, 7 merged, 3 already done, 0 delayed
[auto-inserted resampler 0 @ 0x17f9a80] ch:12 chl:12 channels fmt:s16 r:48000Hz -> ch:12 chl:12 channels fmt:s16 r:48000Hz
[Parsed_pan_0 @ 0x17f72a0] o0 =
[Parsed_pan_0 @ 0x17f72a0] Pure channel mapping detected: M
Output #0, wav, to 'ch4.wav':
  Metadata:
    ISFT            : Lavf55.12.102
    Stream #0:0, 0, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x17f7860] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
size=    1021kB time=00:00:10.89 bitrate= 768.1kbits/s
video:0kB audio:1021kB subtitle:0 global headers:0kB muxing overhead 0.007650%
3076 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x17f6600] Statistics: 4 seeks, 3079 writeouts
[AVIOContext @ 0x1309fc0] Statistics: 12549584 bytes read, 0 seeks

Any ideas? - Am I not using the channel_layouts correctly?

in reply to:  4 comment:5 by Cigaes, 11 years ago

Old versions did not handle channel layouts very cleanly. If it worked (I find it surprising, the date you give is before the addition of channel mappings), it was by chance.

The command you show does not work because you add two audio filter chains: the second one overrides the first one. You have to use a single filter chain.

comment:6 by Roman Gaufman, 11 years ago

Ah, my bad, you are right. This command works, thank you very much!

ffmpeg -i test.wav -filter:a "aformat=channel_layouts=0xFFF,pan=1|c0=c${i}" -y ch${i}.wav

comment:7 by Carl Eugen Hoyos, 11 years ago

Keywords: pan regression added

Regression since e387c9d.

comment:8 by Michael Niedermayer, 11 years ago

Summary: -map_channel / -af pan are not processing 12 channel audio inputs-map_channel / -af pan are not processing 12 channel audio inputs (af_pan does not support streams with unknown channel layout yet)

comment:9 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Fixed by Nicolas in 7b0a5873

Note: See TracTickets for help on using tickets.