<p>Why not use the <a href="https://ffmpeg.org/ffmpeg-filters.html#channelsplit" rel="nofollow noreferrer">channelsplit</a> filter?</p>
<p>First, get audio streams:</p>
<pre><code>ffprobe &quot;$f&quot; 2&gt;&amp;1 | grep Stream | grep Audio
Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 7.1, s32p (24 bit) (default)
Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
</code></pre>
<p>Choose Stream #0:1 and get layout:</p>
<pre><code>ffmpeg -layouts 2&gt;&amp;1 | grep &quot;7.1&quot;
7.1            FL+FR+FC+LFE+BL+BR+SL+SR
7.1(wide)      FL+FR+FC+LFE+BL+BR+FLC+FRC
7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR
7.1(top)       FL+FR+FC+LFE+BL+BR+TFL+TFR
</code></pre>
<p>Choose:
<code>7.1            FL+FR+FC+LFE+BL+BR+SL+SR</code></p>
<p>Use:</p>
<p><code>&quot;[0:1]channelsplit=channel_layout=7.1[FL][FR][FC][LFE][BL][BR][SL][SR]&quot;</code></p>
<p>Note that stream 0:1 is in <code>[]</code> . This is how to specify a specific stream out of more than one stream. Note that the channel order follows the chosen layout.</p>
<p>Extract channels as W64 wavs. This insures that output files greater than 4GB don't trigger the error '<em>Filesize ####### invalid for wav, output file will be broken</em>' . This format is compatible with most DAWs.</p>
<pre><code>ffmpeg -y -i &quot;$f&quot; -vn -sn -map_chapters -1 \
-filter_complex &quot;[0:1]channelsplit=channel_layout=7.1[FL][FR][FC][LFE][BL][BR][SL][SR]&quot; \
-c:a pcm_s32le -map &quot;[FL]&quot; FL.w64 \
-c:a pcm_s32le -map &quot;[FR]&quot; FR.w64 \
-c:a pcm_s32le -map &quot;[FC]&quot; FC.w64 \
-c:a pcm_s32le -map &quot;[LFE]&quot; LFE.w64 \
-c:a pcm_s32le -map &quot;[BL]&quot; BL.w64 \
-c:a pcm_s32le -map &quot;[BR]&quot; BR.w64 \
-c:a pcm_s32le -map &quot;[SL]&quot; SL.w64 \
-c:a pcm_s32le -map &quot;[SR]&quot; SR.w64

</code></pre>

CC BY-SA 4.0
2023-07-28T16:28:05.297Z
2023-07-28T16:28:05.297Z
hmj6jmh
<p>For me the <code>-map_channel</code> option did the trick:
get the file layout using <code>ffprobe multichannelinputfile.mov</code></p>
<pre><code>ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[aac @ 0x7f903d01fa00] Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'set1permeke.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2019-01-05T22:00:13.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: MacBookPro15,1
    com.apple.quicktime.software: Mac OS X 10.13.6 (17G4015)
    com.apple.quicktime.creationdate: 2019-01-05T21:58:54+0100
  Duration: 00:57:02.28, start: 0.000000, bitrate: 23693 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1040 [SAR 1:1 DAR 24:13], 22756 kb/s, 60 fps, 60 tbr, 6k tbn, 12k tbc (default)
    Metadata:
      creation_time   : 2019-01-05T22:00:13.000000Z
      handler_name    : Core Media Video
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 7.1, fltp, 928 kb/s (default)
    Metadata:
      creation_time   : 2019-01-05T22:00:13.000000Z
      handler_name    : Core Media Audio
[aac @ 0x7f903d019600] Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.`
</code></pre>
<p>I then mapped all the audio channels to separate files for easier editing in my DAW:</p>
<p><code>ffmpeg -i multichannelinputfile.mov -map_channel 0.1.0 ch0.wav -map_channel 0.1.1 ch1.wav -map_channel 0.1.2 ch2.wav -map_channel 0.1.3 ch3.wav</code></p>
<p>and so on producing the required separate wav files.</p>

CC BY-SA 4.0
2019-12-17T16:13:31.697Z
If you have a lot of channels (e.g. 32): `printf -v channelmap " -map_channel 0.1.%s -c copy 'OUTPUT_CHANNEL_%02d.wav'" {0..31}{,}; eval ffmpeg -i INPUT.WAV $channelmap`
Duvrai
CC BY-SA 4.0
2021-02-12T10:34:19.920Z
@kaosbeat Can you show the ffprobe command you actually used, to make your answer stand-alone?
Quantum Mechanic
CC BY-SA 4.0
2021-02-15T09:31:13.047Z
@QuantumMechanic it's just "ffprobe filename.mov", It'll try and update it in the answer
kaosbeat
CC BY-SA 4.0
2023-01-09T15:00:57.843Z
"The -map_channel option is deprecated and will be removed. It can be replaced by the 'pan' filter, or in some cases by combinations of 'channelsplit', 'channelmap', 'amerge' filters."
Валерий Заподовников
CC BY-SA 4.0
2019-01-23T14:01:29.397Z
2022-11-17T16:42:24.640Z
2022-11-17T16:42:24.640Z
kaosbeat
<p>I have this file, and would be cool use ffmpeg for extract all audio channels to separate files..</p>

<p>I know how to extract a single channel at time in a way like:</p>

<pre><code>ffmpeg -i input.mov -map 0:1 -c:a copy output.mov
</code></pre>

<p>However this will work for the first channel only.</p>

<p>Aside with for $i 0 to 15, is there a way to extract all the audio channels at one in a specific directory?</p>

<p>ffprobe says:</p>

<pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\myfile.mov':
  Metadata:
    creation_time   : 2016-04-25T14:10:57.000000Z
    timecode        : 10:00:00:00
  Duration: 01:30:36.32, start: 0.000000, bitrate: 193036 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709, progressive), 1920x1080, 174295 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 t
bc (default)
    Metadata:
      creation_time   : 2016-04-25T14:10:57.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-04-25T14:10:57.000000Z
      handler_name    : Apple Alias Data Handler
      reel_name       : Unnamed
      timecode        : 10:00:00:00
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 16 channels, s32 (24 bit), 18432 kb/s (default)
    Metadata:
      creation_time   : 2016-04-25T14:10:57.000000Z
      handler_name    : Apple Alias Data Handler

Unsupported codec with id 0 for input stream 1
</code></pre>

<p><strong>EDIT:</strong> It should be something like this..</p>

<pre><code>ffmpeg -i input.mov -filter_complex \
"[0:a]pan=mono|c0=c0[a0]; \
 [0:a]pan=mono|c0=c1[a1]; \
 [0:a]pan=mono|c0=c2[a2]; \
 [0:a]pan=mono|c0=c3[a3]; \
 [0:a]pan=mono|c0=c4[a4]; \
 [0:a]pan=mono|c0=c5[a5]; \
 [0:a]pan=mono|c0=c6[a6]; \
 [0:a]pan=mono|c0=c7[a7]; \
 [0:a]pan=mono|c0=c8[a8]; \
 [0:a]pan=mono|c0=c9[a9]; \
 [0:a]pan=mono|c0=c10[a10]; \
 [0:a]pan=mono|c0=c11[a11]" \
 [0:a]pan=mono|c0=c12[a12]" \
 [0:a]pan=mono|c0=c13[a13]" \
 [0:a]pan=mono|c0=c14[a14]" \
 [0:a]pan=mono|c0=c15[a15]" \

-c copy -c:a pcm_s24le
-map 0 -map -0:a -map "[a0]" audio_00.wav -map "[a1]" audio_01.wav -map "[a2]" audio_02.wav -map "[a3]" audio_03.wav \
-map "[a4]" audio_04.wav -map "[a5]" audio_05.wav -map "[a6]" audio_06.wav -map "[a7]" audio_07.wav \
-map "[a8]" audio_08.wav -map "[a9]" audio_09.wav -map "[a10]" audio_10.wav -map "[a11]" audio_11.wav
-map "[a12]" audio_12.wav -map "[a13]" audio_13.wav -map "[a14]" audio_14.wav -map "[a15]" audio_15.wav
</code></pre>

CC BY-SA 3.0
2017-08-02T05:01:40.067Z
Not possible...
Gyan
CC BY-SA 3.0
2017-08-02T09:05:24.467Z
@Mulvya hello Mulvya, it seems to be possible looking this answer: https://superuser.com/questions/964629/splitting-one-stream-12-channel-audio-into-separate-mono-channels
user3450548
CC BY-SA 3.0
2017-08-02T10:03:43.390Z
Sorry, I didn't understand at first. I thought you wanted an automatic way to route separate streams into separate outputs. Your example command uses `-map 0:1` which maps a stream, not a channel. There's `-map_channel` which just calls `pan`. You still have to manually probe # of channels and compose the filtergraph.
Gyan
CC BY-SA 3.0
2017-08-02T10:09:17.917Z
@Mulvya I see, so I should write in another language a script that could match the # of channels and write the ffmpeg command to be executed, ffmpeg can't do it by itself, is that what you meant ?
user3450548
CC BY-SA 3.0
2017-08-02T10:10:10.180Z
Yes, that's right.
Gyan
CC BY-SA 3.0
2017-08-02T10:18:02.187Z
@Mulvya ok probably I will create it, however could you help me with an example of map_channels or map to different files ? I wrote an example in the main question, please give a look at it :) ( i wonder about the map_channels solution tho )
user3450548
<ffmpeg><audio>
Extract all audio channels as separate wave file from a multichannel file
user3450548
# Extract all audio channels as separate wave file from a multichannel file

(Asked by: username_0 on 2017-08-01)

I have this file, and would be cool use ffmpeg for extract all audio channels to separate files..
I know how to extract a single channel at time in a way like:
ffmpeg -i input.mov -map 0:1 -c:a copy output.mov

However this will work for the first channel only.
Aside with for $i 0 to 15, is there a way to extract all the audio channels at one in a specific directory?
ffprobe says:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\myfile.mov':
  Metadata:
    creation_time   : 2016-04-25T14:10:57.000000Z
    timecode        : 10:00:00:00
  Duration: 01:30:36.32, start: 0.000000, bitrate: 193036 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709, progressive), 1920x1080, 174295 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 t
bc (default)
    Metadata:
      creation_time   : 2016-04-25T14:10:57.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-04-25T14:10:57.000000Z
      handler_name    : Apple Alias Data Handler
      reel_name       : Unnamed
      timecode        : 10:00:00:00
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 16 channels, s32 (24 bit), 18432 kb/s (default)
    Metadata:
      creation_time   : 2016-04-25T14:10:57.000000Z
      handler_name    : Apple Alias Data Handler

Unsupported codec with id 0 for input stream 1

EDIT: It should be something like this..
ffmpeg -i input.mov -filter_complex \
"[0:a]pan=mono|c0=c0[a0]; \
 [0:a]pan=mono|c0=c1[a1]; \
 [0:a]pan=mono|c0=c2[a2]; \
 [0:a]pan=mono|c0=c3[a3]; \
 [0:a]pan=mono|c0=c4[a4]; \
 [0:a]pan=mono|c0=c5[a5]; \
 [0:a]pan=mono|c0=c6[a6]; \
 [0:a]pan=mono|c0=c7[a7]; \
 [0:a]pan=mono|c0=c8[a8]; \
 [0:a]pan=mono|c0=c9[a9]; \
 [0:a]pan=mono|c0=c10[a10]; \
 [0:a]pan=mono|c0=c11[a11]" \
 [0:a]pan=mono|c0=c12[a12]" \
 [0:a]pan=mono|c0=c13[a13]" \
 [0:a]pan=mono|c0=c14[a14]" \
 [0:a]pan=mono|c0=c15[a15]" \

-c copy -c:a pcm_s24le
-map 0 -map -0:a -map "[a0]" audio_00.wav -map "[a1]" audio_01.wav -map "[a2]" audio_02.wav -map "[a3]" audio_03.wav \
-map "[a4]" audio_04.wav -map "[a5]" audio_05.wav -map "[a6]" audio_06.wav -map "[a7]" audio_07.wav \
-map "[a8]" audio_08.wav -map "[a9]" audio_09.wav -map "[a10]" audio_10.wav -map "[a11]" audio_11.wav
-map "[a12]" audio_12.wav -map "[a13]" audio_13.wav -map "[a14]" audio_14.wav -map "[a15]" audio_15.wav

**Tags:** ffmpeg, audio

> **Comments:**
> **username_1**: Not possible...  
> **username_0**: @Mulvya hello Mulvya, it seems to be possible looking this answer: https://superuser.com/questions/964629/splitting-one-stream-12-channel-audio-into-separate-mono-channels  
> **username_1**: Sorry, I didn't understand at first. I thought you wanted an automatic way to route separate streams into separate outputs. Your example command uses `-map 0:1` which maps a stream, not a channel. There's `-map_channel` which just calls `pan`. You still have to manually probe # of channels and compose the filtergraph.  
> **username_0**: @Mulvya I see, so I should write in another language a script that could match the # of channels and write the ffmpeg command to be executed, ffmpeg can't do it by itself, is that what you meant ?  
> **username_1**: Yes, that's right.  
> **username_0**: @Mulvya ok probably I will create it, however could you help me with an example of map_channels or map to different files ? I wrote an example in the main question, please give a look at it :) ( i wonder about the map_channels solution tho )  

---

## 2 answers

### Answer by username_2 on 2023-07-28. Score: 1 | Accepted answer

Why not use the channelsplit filter?
First, get audio streams:
ffprobe "$f" 2>&1 | grep Stream | grep Audio
Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 7.1, s32p (24 bit) (default)
Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s

Choose Stream #0:1 and get layout:
ffmpeg -layouts 2>&1 | grep "7.1"
7.1            FL+FR+FC+LFE+BL+BR+SL+SR
7.1(wide)      FL+FR+FC+LFE+BL+BR+FLC+FRC
7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR
7.1(top)       FL+FR+FC+LFE+BL+BR+TFL+TFR

Choose:
7.1            FL+FR+FC+LFE+BL+BR+SL+SR
Use:
"[0:1]channelsplit=channel_layout=7.1[FL][FR][FC][LFE][BL][BR][SL][SR]"
Note that stream 0:1 is in [] . This is how to specify a specific stream out of more than one stream. Note that the channel order follows the chosen layout.
Extract channels as W64 wavs. This insures that output files greater than 4GB don't trigger the error 'Filesize ####### invalid for wav, output file will be broken' . This format is compatible with most DAWs.
ffmpeg -y -i "$f" -vn -sn -map_chapters -1 \
-filter_complex "[0:1]channelsplit=channel_layout=7.1[FL][FR][FC][LFE][BL][BR][SL][SR]" \
-c:a pcm_s32le -map "[FL]" FL.w64 \
-c:a pcm_s32le -map "[FR]" FR.w64 \
-c:a pcm_s32le -map "[FC]" FC.w64 \
-c:a pcm_s32le -map "[LFE]" LFE.w64 \
-c:a pcm_s32le -map "[BL]" BL.w64 \
-c:a pcm_s32le -map "[BR]" BR.w64 \
-c:a pcm_s32le -map "[SL]" SL.w64 \
-c:a pcm_s32le -map "[SR]" SR.w64


---

### Answer by username_3 on 2019-01-23. Score: 4

For me the -map_channel option did the trick:
get the file layout using ffprobe multichannelinputfile.mov
ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[aac @ 0x7f903d01fa00] Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'set1permeke.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2019-01-05T22:00:13.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: MacBookPro15,1
    com.apple.quicktime.software: Mac OS X 10.13.6 (17G4015)
    com.apple.quicktime.creationdate: 2019-01-05T21:58:54+0100
  Duration: 00:57:02.28, start: 0.000000, bitrate: 23693 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1040 [SAR 1:1 DAR 24:13], 22756 kb/s, 60 fps, 60 tbr, 6k tbn, 12k tbc (default)
    Metadata:
      creation_time   : 2019-01-05T22:00:13.000000Z
      handler_name    : Core Media Video
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 7.1, fltp, 928 kb/s (default)
    Metadata:
      creation_time   : 2019-01-05T22:00:13.000000Z
      handler_name    : Core Media Audio
[aac @ 0x7f903d019600] Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.`

I then mapped all the audio channels to separate files for easier editing in my DAW:
ffmpeg -i multichannelinputfile.mov -map_channel 0.1.0 ch0.wav -map_channel 0.1.1 ch1.wav -map_channel 0.1.2 ch2.wav -map_channel 0.1.3 ch3.wav
and so on producing the required separate wav files.

> **Comments:**
> **username_4**: If you have a lot of channels (e.g. 32): `printf -v channelmap " -map_channel 0.1.%s -c copy 'OUTPUT_CHANNEL_%02d.wav'" {0..31}{,}; eval ffmpeg -i INPUT.WAV $channelmap`  
> **username_5**: @username_3 Can you show the ffprobe command you actually used, to make your answer stand-alone?  
> **username_3**: @QuantumMechanic it's just "ffprobe filename.mov", It'll try and update it in the answer  
> **username_6**: "The -map_channel option is deprecated and will be removed. It can be replaced by the 'pan' filter, or in some cases by combinations of 'channelsplit', 'channelmap', 'amerge' filters."  

---

