Use bluetooth headset device as audio source in ffmpeg

£可爱£侵袭症+ 提交于 2020-07-07 13:02:46

问题


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?

My asoundrc file:

pcm.bluetooth {
            type bluetooth
            profile "auto"
        }

 ctl.bluetooth {
   type bluetooth
 }

回答1:


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


来源:https://stackoverflow.com/questions/36365661/use-bluetooth-headset-device-as-audio-source-in-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!