我有几个 USB 音频接口,它们有许多输入通道,例如 10、18 或 32。
我目前有一个具有 10 个输入通道的连接到我的 Linux PC,我能够在 的输出中找到它pactl list sources
。以下是相关部分:
Source #1414
...
Name: alsa_input.usb-Behringer_FLOW_8_03-FF-02-11-55-44-00.Direct__hw_F8__source
...
Sample Specification: s32le 10ch 48000Hz
Channel Map: aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9
...
Volume: aux0: 48287 / 74% / -7.96 dB, aux1: 48287 / 74% / -7.96 dB, aux2: 48287 / 74% / -7.96 dB, aux3: 48287 / 74% / -7.96 dB, aux4: 48287 / 74% / -7.96 dB, aux5: 48287 / 74% / -7.96 dB, aux6: 48287 / 74% / -7.96 dB, aux7: 48287 / 74% / -7.96 dB, aux8: 48287 / 74% / -7.96 dB, aux9: 48287 / 74% / -7.96 dB
balance 0.00
...
Properties:
...
audio.channels = "10"
...
所以显然它确实有 10 个输入通道。
并且 audacity 也同意,我可以将所有 10 个通道并行录制到单独的音轨中而不会出现任何问题。另一方面,ffmpeg 似乎并不太明白我的音频接口有 2 个以上的通道,即使我指定了 channel_layout(我使用的是 0x3ff,它是 1111111111(10 个通道)的十六进制表示)。
我尝试像这样运行它:
$ export SOURCE_NAME="alsa_input.usb-Behringer_FLOW_8_03-FF-02-11-55-44-00.Direct__hw_F8__source"
$ ffmpeg -f pulse -i "${SOURCE_NAME}" -c:a pcm_s32le -ar 48000 -ac 10 -channel_layout 0x3ff output.w64
我得到了这个输出:
...
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, pulse, from 'alsa_input.usb-Behringer_FLOW_8_03-FF-02-11-55-44-00.Direct__hw_F8__source':
Duration: N/A, start: 1689435887.317692, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Multiple -ac options specified for stream 0, only the last option '-ac 10' will be used.
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s32le (native))
Press [q] to stop, [?] for help
[pcm_s32le @ 0x5636967eb040] Channel layout '10 channels (FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL)' with 10 channels does not match number of specified channels 2
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
如果我将其指定hexadecagonal
为 channel_layout,它确实会记录,但它只会记录前两个通道,从而创建一个具有 16 个通道的 w64 文件,并且只有前两个通道包含音频。
$ ffmpeg -f pulse -i "${SOURCE_NAME}" -c:a pcm_s32le -ar 48000 -ac 10 -channel_layout hexadecagonal output.w64
...
Output #0, w64, to 'output.w64':
Metadata:
encoder : Lavf58.76.100
Stream #0:0: Audio: pcm_s32le ([1][0][0][0] / 0x0001), 48000 Hz, hexadecagonal, s32, 24576 kb/s
Metadata:
encoder : Lavc58.134.100 pcm_s32le
size= 54000kB time=00:00:16.02 bitrate=27602.2kbits/s speed=1.07x
video:0kB audio:54000kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000231%
Exiting normally, received signal 2.
有什么线索表明我做错了什么吗?