使用命令列出所有输入设备:
pactl list sources | grep -A 5 Source
Source #0
State: RUNNING
Name: alsa_input.usb-SN0002_HIK_1080P_CAMERA_SN0002-02.mono-fallback
Description: HIK 1080P CAMERA Mono
Driver: module-alsa-card.c
Sample Specification: s16le 1ch 16000Hz
--
Source #1
State: RUNNING
Name: alsa_output.pci-0000_09_00.6.analog-stereo.monitor
Description: Monitor of Family 17h (Models 10h-1fh) HD Audio Controller Analog Stereo
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 44100Hz
用同样的方式捕获声卡上播放的音频:
parecord -d alsa_output.pci-0000_09_00.6.analog-stereo.monitor sample.wav
它工作得很好,现在可以用我的网络摄像头捕捉音频
arecord -d alsa_input.usb-SN0002_HIK_1080P_CAMERA_SN0002-02.analog-mono-fallback sample.wav
Stream error: No such entity
显示 alsa_input 的状态:
pacmd dump | grep alsa_input
set-source-volume alsa_input.usb-SN0002_HIK_1080P_CAMERA_SN0002-02.mono-fallback 0x13220
set-source-mute alsa_input.usb-SN0002_HIK_1080P_CAMERA_SN0002-02.mono-fallback no
suspend-source alsa_input.usb-SN0002_HIK_1080P_CAMERA_SN0002-02.mono-fallback no
set-default-source alsa_input.usb-SN0002_HIK_1080P_CAMERA_SN0002-02.mono-fallback
状态良好,为什么我的网络摄像头无法捕捉到说话的声音?奇怪的是,可以使用 arecord 命令捕获对网络摄像头说话的音频:
#get the hardware info
arecord -L|grep plughw|grep CAMERA
plughw:CARD=CAMERA,DEV=0
#write the command
arecord --device="plughw:CARD=CAMERA,DEV=0" music.wav
为什么arecord
可以捕获所有对网络摄像头说话的声音而不是parecord
?