什么地方出了错

什么地方出了错

我有一个 12 通道 QuickTime 单音频流,我试图将其拆分为一个输出文件中的 12 个独立音频流。从 MediaInfo 来看,我的源音频配置如下所示:

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

我已经用 6 个通道成功完成了此操作,但不确定如何使用 12 个通道完成此操作。6 通道命令如下:

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"

但从 ffmpeg 中的布局参数列表来看,这似乎是不可能的,因为它只能达到 8.1。我尝试更改“channel_layout=11.1”并添加其他映射参数,但我得到:

[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.

我在论坛帖子中找到了一条命令:

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

但得到:

[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

我尝试了以下命令:

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 

但出现以下输出错误..

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.

更新: 在解决了这个问题一段时间后,我发现我能够成功分割频道,我注意到一些视频软件套件和播放器在默认播放时只会识别其中一个频道,而不是所有 12 个频道。我的过滤器图后面有一个“-map 0:a”参数,一旦我删除它,它就会起作用。我发现正​​确的命令如下:

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"

控制台输出:

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    

正如您在 Adob​​e Premiere 中看到的,我能够正确地重新创建映射。左侧是我使用平移滤镜剪辑的 ffmpeg,具有 12 个独立的单声道,右侧是单流 12 通道样本。两者匹配!特别感谢 LordNeckBeard!

Adobe Premiere 音频图

答案1

什么地方出了错

您正在尝试映射不存在的输入流。以下是您的输入流:

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

您要ffmpeg映射0:0- 0:11,但只有0:00:10:2存在。

示例解决方案

您可以使用平底锅过滤器将单个多通道流转换为多个单通道流。

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

另一种方法是使用-mapand -map_channel,但语法更令人困惑。

映射

在这种情况下,你不能依赖默认流选择行为,所以你必须告诉ffmpeg你想要什么流-map选项示例中的各种-map选项乍一看可能让人困惑:

  • -map 0- 包括全部输入流从第一个(也是唯一的)输入到输出。

  • -map -0:a- 负向映射,用于忽略所有输入音频流到输出。此操作在 之后应用-map 0。原始音频流被排除,因为将改用来自过滤器的音频输出。

    • 另一种方法是省略-map 0 -map -0:a并使用-map 0:v -map 0:d来映射视频和数据流,但如果您的输入还包含字幕怎么办?那么您需要添加-map 0:s。您可以看到使用“包括除音频之外的所有内容”如何更加灵活、高效和懒惰。
  • -map "[a0]" ... -map "[a11]"- 包括从平移滤波器输出的音频流。

因此,在完成所有这些映射之后,您的输入将包含:视频流、数据tmcd流和 12 个音频流。

你的ffmpeg很老

开发非常活跃。下载最新版本

答案2

我终于明白了。不知为何,当我使用 FFMPEG 大神 LordNeckBeard 提供的“filter_complex”解决方案时,它正确地分割了声道,但播放器和视频软件只能识别第一个音轨。这个解决方案工作正常。声道被分割,音频被识别!

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"

希望这可以帮助你们解决一些麻烦!

相关内容