Windows shell: How can I get the audio device(s) name(s)? -
i not sure if strictly programming question, long don't mind use additional software in order solve problem, long keeps being scriptable or command-line (this is: not gui solution). anyway, have posted (a bit different) question @ superuser. way, update here if answer there.
my windows program (just shell script) invokes vlc command-line in order record audio audio card , stream out, like:
vlc dshow:// :dshow-vdev=none :dshow-adev="soundmax hd audio i" :std{mux=ts,access=http,dst=:8080} :sout-keep [rest of cmdline not relevant]
as long there multiple audio devices on computer (webcam, multiple audio cards, bluettoth devices... etc), need programmatically name of them.
i have used ffmpeg until now:
ffmpeg -list_devices true -f dshow -i dummy
... not work ok, example:
d:\utils\ffmpeg\bin>ffmpeg -list_devices true -f dshow -i dummy ffmpeg version n-72460-g11aa050 copyright (c) 2000-2015 ffmpeg developers built 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 both video , audio devices) [dshow @ 0000000000363520] not enumerate video devices (or none found). [dshow @ 0000000000363520] directshow audio devices [dshow @ 0000000000363520] not enumerate audio devices (or none found ). dummy: immediate exit requested
the command line tool systeminfo
neither work:
c:\>systeminfo | find "audio" /i c:\>
searching inside regedit
found nothing soundcard example (soundmax hd audio i
).
isn't there other more reliable way programmatically obtain sound device(s) name(s)?
if possible, prefer obtain answers both windows xp , vista or later.
additional tests performed:
- installed latest microsoft .net framework v4.5.2 & rebooted.
- tested older versions of ffmpeg: v4.8 (2014) , v4.7 (2013).
- tested uac elevated prompt.
answer obtained (thanks, @karan) above mentioned superuser thread.
firstly, ffmpeg should return device name value. if not, try:
- update ffmpeg latest version.
- update .net framework.
- try another version. note v4.7.3 seems not needing .net framework, if issue (extracted this thread).
- for microphone devices make sure jack connected. on systems seems device disabled (disappears) if not. of course, 1 not apply portables embedded (built-in) microphone.
as second option, working (as today, june 2015) vista , above, , not needing 30-40mb download of ffmpeg, can try soundvolumeview nirsoft. send values .txt file , filter doing:
soundvolumeview /scomma audio.txt /f "tokens=1 delims=," %d in ('type audio.txt ^| find "capture"') @echo default recording device is: "%d"
as third option, still vista , above, audio input (capture & recording) devices can extracted register (explained here @karan) issuing command line:
for /f "tokens=9 delims=\" %a in ('reg query "hklm\software\microsoft\windows\currentversion\mmdevices\audio\capture" /s ^| find "\properties"') @for /f "tokens=2*" %k in ('reg query "hklm\software\microsoft\windows\currentversion\mmdevices\audio\capture\%a\properties" /v "{a45c254e-df1c-4efd-8020-67d146a850e0},2"') @echo "%l"
note: remember when scripting such devices can find special localized characters, spanish word micrófono
microphone
. ffmpeg, example, show rather strange micrófono
.
all 3 above mentioned methods, including nirsoft's, work fine on remote console (ssh, example).
additional points:
- note answer solves audio device name issue recording/input/capture devices, (except ffmpeg case, maybe) above methods not valid or must modified accordingly if search playing ones.
Comments
Post a Comment