I am not sure if this is strictly a programming question, as long as I don't mind to use additional software in order to solve the problem, as long as it keeps being scriptable or command-line (this is: a not GUI solution). Anyway, I have posted another (a bit different) question at SuperUser. By the way, I will update here if I get the answer there.
My Windows program (just a shell script) invokes VLC command-line in order to record audio from the audio card and stream it out, like:
vlc dshow:// :dshow-vdev=none :dshow-adev="SoundMAX HD Audio I" :std{mux=ts,access=http,dst=:8080} :sout-keep [rest of the cmdline not relevant]
As long as there could be multiple audio devices on a computer (webcam, multiple audio cards, bluettoth devices... etc), I need to programmatically get the name of them.
I have used FFMPEG until now:
ffmpeg -list_devices true -f dshow -i dummy
... but sometimes it does not work OK, for example:
d:\Utils\FFMPEG\bin>ffmpeg -list_devices true -f dshow -i dummy
ffmpeg version N-72460-g11aa050 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 26.100 / 54. 26.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 34.100 / 56. 34.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[dshow @ 0000000000363520] DirectShow video devices (some may be both video and
audio devices)
[dshow @ 0000000000363520] Could not enumerate video devices (or none found).
[dshow @ 0000000000363520] DirectShow audio devices
[dshow @ 0000000000363520] Could not enumerate audio only devices (or none found
).
dummy: Immediate exit requested
The command line tool SystemInfo
does neither work:
C:\>systeminfo | find "audio" /i
C:\>
Searching inside regedit
found nothing about my soundcard example (SoundMAX HD Audio I
).
Isn't there any other more reliable way to programmatically obtain the sound device(s) name(s)?
If possible, I would prefer to obtain answers for both Windows XP and Vista or later.
Additional tests performed:
- Installed latest MicroSoft .NET FrameWork v4.5.2 & rebooted.
- Tested older versions of FFMPEG: v4.8 (2014) and v4.7 (2013).
- Tested UAC elevated prompt.