我以前从未使用过avconv
。过去几周我一直在阅读该手册并在各种论坛和 IRC 上提出问题,但尚未找到答案。 (这个问题是我问的一个更大问题的一部分这里。我将其分解,因为这个关键部分是我首先需要帮助的地方。我可能会删除另一个问题,因为它可能太宽泛或定义不明确。)
我曾经pacmd list-cards
列出我的流媒体音频源。以下是我需要定义为 的输入的两个avconv
。
- alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2:Scarlett 2i2 USB 模拟立体声监视器
- alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3:Scarlett 2i2 USB 模拟立体声
所以我的问题很简单,如何将这些来源定义为输入avconv
?
更多信息/背景如下:
一旦我知道如何定义音频输入,我计划像这样使用它们:
#!/bin/bash
OUTPUT="audio_`date +%Y-%m-%d_%H%M`"
avconv \
-f alsa -ac 2 -i <alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor> \
-f alsa -ac 1 -i <alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo> \
-map 0:0 -map 1:0 \
-acodec flac \
-threads 0 \
-y $OUTPUT
我认为我需要用正确的符号替换尖括号中的内容。我不知道上面脚本的其余部分是否接近......
这是我的硬件信息:
$ pacmd list-cards
Welcome to PulseAudio! Use "help" for usage information.
>>> 3 card(s) available.
[snip other cards]
index: 2
name: <alsa_card.usb-Focusrite_Scarlett_2i2_USB-00-USB>
driver: <module-alsa-card.c>
owner module: 6
properties:
alsa.card = "1"
alsa.card_name = "Scarlett 2i2 USB"
alsa.long_card_name = "Focusrite Scarlett 2i2 USB at usb-0000:04:00.0-2, high speed"
alsa.driver_name = "snd_usb_audio"
device.bus_path = "pci-0000:04:00.0-usb-0:2:1.0"
sysfs.path = "/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb3/3-2/3-2:1.0/sound/card1"
udev.id = "usb-Focusrite_Scarlett_2i2_USB-00-USB"
device.bus = "usb"
device.vendor.id = "1235"
device.vendor.name = "Novation EMS"
device.product.id = "8006"
device.product.name = "Scarlett 2i2 USB"
device.serial = "Focusrite_Scarlett_2i2_USB"
device.string = "1"
device.description = "Scarlett 2i2 USB"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-usb"
profiles:
output:analog-stereo: Analog Stereo Output (priority 6000)
output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060)
output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055)
output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500)
output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560)
output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5555)
input:analog-stereo: Analog Stereo Input (priority 60)
input:iec958-stereo: Digital Stereo (IEC958) Input (priority 55)
off: Off (priority 0)
active profile: <output:analog-stereo+input:analog-stereo>
sinks:
alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#1: Scarlett 2i2 USB Analog Stereo
sources:
alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo
alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo
ports:
analog-output: Analog Output (priority 9900, available: unknown)
properties:
analog-input: Analog Input (priority 10000, available: unknown)
properties:
iec958-stereo-input: iec958-stereo-input (priority 0, available: unknown)
properties:
iec958-stereo-output: Digital Output (S/PDIF) (priority 0, available: unknown)
properties:
答案1
您还可以使用以下命令查找接口的名称
pactl list sources | grep Name:
在您的情况下,它是“alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor”。
然后使用 -i 开关后的名称使用 avconv 录制音频
avconv -f alsa -ac 2 -ar 48000 -f pulse \
-i alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor \
-acodec libvorbis -aq 6 test.ogg
本质上,在示例中省略标识符周围的大于和小于符号,它应该可以工作。
以下是有关这些命令的用法和含义的教程: http://meshfields.de/linux-usb-audio-stream-recording/