2

I have a 12 channel QuickTime single audio stream which I am attempting to split into separate 12 audio streams in one output file. From MediaInfo my source audio configuration looks like the following:

ID                                       : 2
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : lpcm
Duration                                 : 1mn 40s
Bit rate mode                            : Constant
Bit rate                                 : 12.8 Mbps
Channel(s)                               : 12 channels

I have done this successfully with 6 channels but not sure how to do this with 12 channels. The 6 channel command likes like the following:

ffmpeg -i "C:\FFMPEG\bin\SomeTestFile.mov" -filter_complex "channelsplit=channel_layout=5.1[0:2][0:3][0:4][0:5][0:6]" -map "[0:2]" -acodec pcm_s16le -ar 44.1k -ac 1 -map "[0:3]" -acodec pcm_s16le -ar 44.1k -ac 1 -map "[0:4]" -acodec pcm_s16le -ar 44.1k -ac 1 -map "[0:5]" -acodec pcm_s16le -ar 44.1k -ac 1 -map "[0:6]" -acodec pcm_s16le -ar 44.1k -ac 1 -threads 1 "Output.mov"

But from the layout parameters list in ffmpeg this doesn't seem possible as it only goes up to 8.1. I tried to change the "channel_layout=11.1" and adding the additional mapping parameters but I get:

[Parsed_channelsplit_0 @ 0000000000338820] Error parsing channel layout '12.0'.
[AVFilterGraph @ 0000000000352420] Error initializing filter 'channelsplit' with args 'channel_layout=11.1'
Error configuring filters.

I found a command in a forum post with this:

ffmpeg -i "C:\FFMPEG\bin\SomeTestFile.mov" -acodec copy -filter_complex channelsplit -f mov "Output.mov"

but get:

[auto-inserted resampler 0 @ 0000000002bf3d00] [SWR @ 0000000002bc82c0] Rematrix is needed between 12 channels and stereo but there is not enough
 information to do it
[auto-inserted resampler 0 @ 0000000002bf3d00] Failed to configure output pad on auto-inserted resampler 0

I tried the following command:

ffmpeg -i "C:\FFMPEG\bin\input.mov" -map 0:2 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:3 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:4 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:5 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:6 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:7 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:8 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:9 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:10 -acodec pcm_s16le -ar 44.1k -ac 1 -map 0:11 -acodec pcm_s16le -ar 44.1k -ac 1 -threads 1 output.mov 

but getting the following output error..

ffmpeg version N-66639-g6b347f5 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct  5 2014 22:10:17 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54.  9.100 / 54.  9.100
  libavcodec     56.  2.101 / 56.  2.101
  libavformat    56.  7.104 / 56.  7.104
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.102 /  5.  1.102
  libswscale      3.  1.100 /  3.  1.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  1.100 / 53.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\FFMPEG\bin\input.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-08-20 21:58:39
    Duration: 00:01:40.18, start: 0.000000, bitrate: 149980 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x1080, 136073 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2015-08-20 21:58:39
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, 12 channels, s32 (24 bit), 13824 kb/s (default)
    Metadata:
      creation_time   : 2015-08-20 21:58:39
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2015-08-20 21:58:39
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Stream map '0:3' matches no streams.

Update: After struggle with this issue for a while and discovering that I was able to split the channels successfully I noticed some video software suites and players would only recognize one of the channels instead of all 12 when played by default. I had a "-map 0:a" parameter after my filter graph and once I removed that it worked. I discovered the correct command is as follows:

C:\FFMPEG\bin\ffmpeg -i "C:\Test\TESTCLIP.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]" -map 0 -map "[a0]" -map "[a1]" -map "[a2]" -map "[a3]" -map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" -map "[a8]" -map "[a9]" -map "[a10]" -map "[a11]" -c copy -c:a pcm_s24le "C:\TEST\OUTPUT.mov"

Console Output:

ffmpeg version N-66639-g6b347f5 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct  5 2014 22:10:17 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54.  9.100 / 54.  9.100
  libavcodec     56.  2.101 / 56.  2.101
  libavformat    56.  7.104 / 56.  7.104
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.102 /  5.  1.102
  libswscale      3.  1.100 /  3.  1.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  1.100 / 53.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Test\TESTCLIP.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-08-25 22:11:49
  Duration: 00:01:40.18, start: 0.000000, bitrate: 148100 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x1080, 134192 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2015-08-25 22:11:49
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, 12 channels, s32 (24 bit), 13824 kb/s (default)
    Metadata:
      creation_time   : 2015-08-25 22:11:49
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2015-08-25 22:11:49
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[Parsed_pan_0 @ 0000000005d32500] Pure channel mapping detected: 0
[Parsed_pan_1 @ 00000000003956c0] Pure channel mapping detected: 1
[Parsed_pan_2 @ 00000000003958a0] Pure channel mapping detected: 2
[Parsed_pan_3 @ 0000000000395a80] Pure channel mapping detected: 3
[Parsed_pan_4 @ 00000000003adf00] Pure channel mapping detected: 4
[Parsed_pan_5 @ 0000000000395d00] Pure channel mapping detected: 5
[Parsed_pan_6 @ 00000000003bfcc0] Pure channel mapping detected: 6
[Parsed_pan_7 @ 00000000003bfee0] Pure channel mapping detected: 7
[Parsed_pan_8 @ 00000000003bfd80] Pure channel mapping detected: 8
[Parsed_pan_9 @ 00000000051b2840] Pure channel mapping detected: 9
[Parsed_pan_10 @ 0000000000332680] Pure channel mapping detected: 10
[Parsed_pan_11 @ 0000000000332740] Pure channel mapping detected: 11
[mov @ 00000000051ca260] You requested a copy of the original timecode track so timecode metadata are now ignored
Output #0, mov, to 'C:\TEST\OUTPUTFILE.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf56.7.104
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 134192 kb/s, 23.98 fps, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2015-08-25 22:11:49
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 12 channels, s32 (24 bit), 13824 kb/s (default)
    Metadata:
      creation_time   : 2015-08-25 22:11:49
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2015-08-25 22:11:49
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:3: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:4: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:5: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:6: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:7: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:8: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:9: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:10: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:11: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:12: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:13: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
    Stream #0:14: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      encoder         : Lavc56.2.101 pcm_s24le
Stream mapping:
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:1 (pcm_s24le) -> pan (graph 0)
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_s24le (native) -> pcm_s24le (native))
  Stream #0:2 -> #0:2 (copy)
  pan (graph 0) -> Stream #0:3 (pcm_s24le)
  pan (graph 0) -> Stream #0:4 (pcm_s24le)
  pan (graph 0) -> Stream #0:5 (pcm_s24le)
  pan (graph 0) -> Stream #0:6 (pcm_s24le)
  pan (graph 0) -> Stream #0:7 (pcm_s24le)
  pan (graph 0) -> Stream #0:8 (pcm_s24le)
  pan (graph 0) -> Stream #0:9 (pcm_s24le)
  pan (graph 0) -> Stream #0:10 (pcm_s24le)
  pan (graph 0) -> Stream #0:11 (pcm_s24le)
  pan (graph 0) -> Stream #0:12 (pcm_s24le)
  pan (graph 0) -> Stream #0:13 (pcm_s24le)
  pan (graph 0) -> Stream #0:14 (pcm_s24le)
Press [q] to stop, [?] for help
frame=  118 fps=0.0 q=-1.0 size=     854kB time=00:00:04.87 bitrate=1433.4kbits/s    
frame=  314 fps=313 q=-1.0 size=   70872kB time=00:00:13.05 bitrate=44472.7kbits/s    
frame=  412 fps=272 q=-1.0 size=  123393kB time=00:00:17.14 bitrate=58967.9kbits/s    
frame=  516 fps=256 q=-1.0 size=  172269kB time=00:00:21.47 bitrate=65700.3kbits/s    
frame=  617 fps=245 q=-1.0 size=  277313kB time=00:00:25.69 bitrate=88421.2kbits/s    
frame=  715 fps=237 q=-1.0 size=  376683kB time=00:00:29.77 bitrate=103620.3kbits/s    
frame=  859 fps=244 q=-1.0 size=  528409kB time=00:00:35.78 bitrate=120962.3kbits/s    
frame=  957 fps=238 q=-1.0 size=  633018kB time=00:00:39.87 bitrate=130054.3kbits/s    

As you can see in Adobe Premiere..I am able to recreate the mappings correctly. The left is my ffmpeg cut with 12 separate mono channels using the pan filter and the right is the single stream 12 channel sample. Both match! Special thanks to LordNeckBeard!

Adobe Premiere Audio Graph

2
  • You don't need to use -filter_complex to filter/map the streams. What happens if you try this: ffmpeg -i infile.mov -map 0:1 1.wav -map 0:2 2.wav [etc...]? Note that I also don't use double quotes or brackets to identify the streams. Check the help page for more explanation and examples.
    – agtoever
    Commented Aug 29, 2015 at 18:52
  • I have a possible answer, but I would need to see the complete console output from your ffmpeg command to make sure it will work.
    – llogan
    Commented Aug 30, 2015 at 18:07

2 Answers 2

4

What went wrong

You're trying to map input streams that don't exist. Here are your input streams:

Stream #0:0 Video: prores
Stream #0:1 Audio: pcm_s24le
Stream #0:2 Data: tmcd

You're telling ffmpeg to map 0:0-0:11, but only 0:0, 0:1, and 0:2 exist.

Example solution

You can use the pan filter to turn a single multichannel stream into multiple single channel streams.

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]" \
-map 0 -map -0:a -map "[a0]" -map "[a1]" -map "[a2]" -map "[a3]" \
-map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" \
-map "[a8]" -map "[a9]" -map "[a10]" -map "[a11]" \
-c copy -c:a pcm_s24le \
output.mov

Another method would be to use -map and -map_channel, but the syntax is more confusing.

Mapping

In this case you can't rely on the default stream selection behavior, so you have to tell ffmpeg what streams you want with the -map option. The various -map options in the example may seem confusing at first:

  • -map 0 - Include all input streams from the first (and only) input to the output.

  • -map -0:a - A negative mapping to omit all input audio streams to the output. This gets applied after -map 0. The original audio stream is excluded because the audio outputs from the filters will be used instead.

    • An alternative method would be to omit -map 0 -map -0:a and use -map 0:v -map 0:d instead to map the video and data streams, but what if your input also contained subtitles? Then you would need to add -map 0:s. You can see how using "include everything but audio" is more flexible, efficient, and lazy.
  • -map "[a0]" ... -map "[a11]" - Include the audio streams that are outputted from the pan filters.

So after all of these maps your input will contain: the video stream, the data tmcd stream, and the 12 audio streams.

Your ffmpeg is old

Development is very active. Download a recent build.

6
  • When I use the pan filter most video suites only recognize one of the audio channels. If I use the map channel feature all 12 channels are recognized. Is there a way to make all audio channels be recognized?
    – Kevin
    Commented Sep 21, 2015 at 18:07
  • @Kevin Please show your commands and the complete console outputs. Links to pastebin sites will suffice. What only recognizes one of the audio channels?
    – llogan
    Commented Sep 21, 2015 at 18:20
  • Thanks LordNeckBeard. I have updated my original post with my command and the CCL output under the "Update" section. I have also included some screenshots to illustrate what I meant when tracks are "not recognized". Basically I want all 12 seperate mono tracks to be played when file is opened in QuickTime. If I use the pan filter only one of them will be played..
    – Kevin
    Commented Sep 21, 2015 at 20:16
  • @Kevin What software is the first screenshot from? Do you have command and console output using -map_channel?
    – llogan
    Commented Sep 21, 2015 at 21:46
  • LockNeckBeard, just added my "map_channel_ outout in the "map channel" section. The screenshot in which you see visualization of the audio channels is "Adobe Premier". The others with the drop down list are QuickTime Player 7 on Windows using the movie inspector.
    – Kevin
    Commented Sep 21, 2015 at 22:41
1

I finally got it. For whatever reason when I use "filter_complex" solution provided by the FFMPEG god LordNeckBeard..it splits the channels correctly but players and video software only recognize the first audio track. This solution works correctly. The channels are split and audio is recognized!

C:\FFMPEG\bin\ffmpeg -i "C:\Test\InputFile.mov" -map 0:0 -vcodec copy -c:a pcm_s24le -map 0:1 -filter:a:0 "pan=mono|c0=c0" -map 0:1 -filter:a:1 "pan=mono|c0=c1" -map 0:1 -filter:a:2 "pan=mono|c0=c2" -map 0:1 -filter:a:3 "pan=mono|c0=c3" -map 0:1 -filter:a:4 "pan=mono|c0=c4" -map 0:1 -filter:a:5 "pan=mono|c0=c5" -map 0:1 -filter:a:6 "pan=mono|c0=c6" -map 0:1 -filter:a:7 "pan=mono|c0=c7" -map 0:1 -filter:a:8 "pan=mono|c0=c8" -map 0:1 -filter:a:9 "pan=mono|c0=c9" -map 0:1 -filter:a:10 "pan=mono|c0=c10" -map 0:1 -filter:a:11 "pan=mono|c0=c10" "C:\Test\OutputFile.mov"

Hope this helps some of you in some of your troubles!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .