Eu tenho um fluxo de áudio único de 12 canais QuickTime que estou tentando dividir em 12 fluxos de áudio separados em um arquivo de saída. Do MediaInfo, minha configuração de áudio de origem é semelhante à seguinte:
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
Eu fiz isso com sucesso com 6 canais, mas não sei como fazer isso com 12 canais. O comando de 6 canais gosta do seguinte:
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"
Mas, a partir da lista de parâmetros de layout no ffmpeg, isso não parece possível, pois só vai até 8.1. Eu tentei mudar o "channel_layout = 11.1" e adicionando os parâmetros de mapeamento adicionais, mas eu recebo:
[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.
Encontrei um comando em uma postagem no fórum com isso:
ffmpeg -i "C:\FFMPEG\bin\SomeTestFile.mov" -acodec copy -filter_complex channelsplit -f mov "Output.mov"
mas obtenha:
[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
Eu tentei o seguinte comando:
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
mas recebendo o seguinte erro de saída ...
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.
Atualização:
Depois de lutar com esse problema por um tempo e descobrir que eu era capaz de dividir os canais com sucesso, notei que algumas suítes de software de vídeo e players só reconheceriam um dos canais ao invés de todos os 12 quando executados por padrão. Eu tinha um parâmetro "-map 0: a" depois do meu gráfico de filtro e uma vez eu removi o que funcionou. Eu descobri que o comando correto é o seguinte:
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"
Saída do Console:
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
Como você pode ver no Adobe Premiere ... Consigo recriar os mapeamentos corretamente. A esquerda é o meu ffmpeg cortado com 12 canais mono separados usando o filtro de pan e o direito é a amostra de 12 canais de fluxo único. Ambos combinam! Um agradecimento especial a LordNeckBeard!