How to only list audio devices using FFmpeg?

820 Views Asked by At

I am doing an audio recording project using FFmpeg 5.0.1. To list all the available audio input devices for the user to select and use, I used the function avdevice_list_input_sources(). My code goes like this:

avdevice_list_input_sources(av_find_input_format("dshow"), NULL, NULL, &device_list);

Where device_list is declared as

AVDeviceInfoList* device_list;

But this way, all the input devices supported, including audio and video, are listed. This could compromise the program's stability, for the user could select a video device listed and cause the program to crash. So I need to find a way to only list audio input devices or delete the video devices from device_list. But so far, I have not found a feasible away.

Does anyone know how to do so?

0

There are 0 best solutions below