在ffmpeg中使用蓝牙耳机设备作为音频源 [英] Use bluetooth headset device as audio source in ffmpeg

查看:16
本文介绍了在ffmpeg中使用蓝牙耳机设备作为音频源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用蓝牙耳机作为音频源来录制视频.我可以使用 arecord -D bluetooth -f s16_le -c1 -r8000 命令和管道音频到 ffmpeg.但这会导致音频和视频的同步问题.所以我想在没有 arecord 的情况下捕获音频.如何在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆