使用蓝牙耳机设备作为ffmpeg中的音频源 [英] Use bluetooth headset device as audio source in ffmpeg
问题描述
我想使用蓝牙耳机作为录制视频的音频源.
我可以使用arecord -D bluetooth -f s16_le -c1 -r8000
命令并将音频传输到ffmpeg.但这会导致音频和视频同步问题.所以我想录制音频而无需录音.如何在ffmpeg命令中将蓝牙设备定义为音频源?
I want use a bluetooth headset as audio source for recording a video.
I can use arecord -D bluetooth -f s16_le -c1 -r8000
command and pipe audio to ffmpeg. But this cause sync problems in audio and video. so i want to capture audio without arecord. How can i define bluetooth device as audio source in ffmpeg command?
我的asoundrc文件:
My asoundrc file:
pcm.bluetooth {
type bluetooth
profile "auto"
}
ctl.bluetooth {
type bluetooth
}
推荐答案
在ffmpeg文档中进行了一些挖掘之后,我设法通过带有ffmpeg的蓝牙耳机录制了声音. 首先是我的/etc/asound.cnf:
After some digging in the ffmpeg docs, i managed to record sound via bluetooth headset with ffmpeg. Firstly here is my /etc/asound.cnf:
pcm.btheadset {
type plug
slave {
pcm {
type bluetooth
profile "auto"
}
}
hint {
show on
description "BT Headset"
}
}
ctl.btheadset {
type bluetooth
}
然后使用以下命令可以录制声音:
Then with the following command you can record sound:
ffmpeg -y -f alsa -ac 1 -ar 8000 -i btheadset alsaout.wav
这篇关于使用蓝牙耳机设备作为ffmpeg中的音频源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!