問題描述
從 FFMPEG for android 的命令行版本訪問網絡攝像頭麥克風 (Accessing webcam mic from command line version of FFMPEG for android)
I am currently testing audio and video streaming from a webcam using a command line version of FFMPEG on an android box. I am having a problem accessing the webcam mic Using Ubuntu as a reference, the correct command to determine the recording devices available is arecord -L . Unfortunately arecord -L does not work on the Android box The current command option alsa for accessing the webcam mic is ffmpeg -f alsa -alsa_device_name.. and the previous option of oss does not work either, ie ffmpeg -f -oss.. does not work either. The listed audio devices shown in /dev/snd shows the mic portion of the webcam as pcmC3D0c and controlC3. The reason I know this is because if I unplug the webcam these values vanish from the directory listing. Has anyone tried successfully to access the mic portion of a webcam using ffmpeg on an android box? How do you formulate the correct format of the command to access the webcam mic. Please note that I am able to access the audio and video on my Ubuntu PC using ffmpeg hence i know that both devices work
參考解法
方法 1:
I finally figured out what I was doing wrong. The issue was with my build of FFMpeg To use either the camera or mic portion(s) of a webcam, one needs to call the device(s) using the appropriate format(s) in FFMPEG. The camera portion is controlled by video4linux2, while the mic portion of the webcam is controlled by alsa. I should have checked and made sure that my build of FFMPEG had both formats - alsa and video4linux available in my FFMPEG build. The command to use is ./ffmpeg -formats The output would show somewhere in the output listing as DE alsa for sound, which means alsa is available for Decoding and Encoding. Likewise for the video portion, D video4linux - meaning that video4linux was available to decoode the video coming from the camera portion of the webcam. . Because alsa was not available, the command ./ffmpeg -f alsa... always gave a syntax error I guess the lesson is check your ffmpeg build for all the features you need to make sure they are there before you attempt to use it. "Thank you" to all who looked at the question!
(by user1545779、user1545779)