Windows外壳:我怎样才能音频设备(S)姓名(或名称)? [英] Windows shell: How can I get the audio device(s) name(s)?

查看:1930
本文介绍了Windows外壳:我怎样才能音频设备(S)姓名(或名称)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是否是严格意义上的规划问题,只要我
  不介意为了解决这个问题,以使用额外的软件,只要它保持是编写脚本或命令行(在此是:一个不GUI溶液)。无论如何,我已经张贴在另一个(有点不同)问题<一href=\"http://superuser.com/questions/922008/windows-command-line-method-to-know-the-name-of-my-audio-recording-device\">SuperUser.顺便说一句,我会,如果我得到的答案有在这里更新。

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.

我的Windows程序(只是一个shell脚本)的从声卡调用VLC命令行录制音频并流出来,如:

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]

只要有可能的多个音频设备的计算机上(摄像头,多音频卡,bluettoth设备...等),我需要以编程方式获得的名称他们。

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.

我用FFMPEG至今:

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

该命令行工具的SystemInfo ,既不工作:

C:\>systeminfo | find "audio" /i

C:\>

注册表编辑器搜索发现任何关于我的声卡的例子(的SoundMAX HD音频I )。

Searching inside regedit found nothing about my soundcard example (SoundMAX HD Audio I).

是不是有其他更可靠的方式以编程的获取声音设备(S)姓名(或名称)?

Isn't there any other more reliable way to programmatically obtain the sound device(s) name(s)?

如果可能的话,我会preFER获得答案为Windows XP和Vista或更高版本两种。

If possible, I would prefer to obtain answers for both Windows XP and Vista or later.

更多的测试执行


  • 已安装最新的Microsoft .NET Framework v4.5.2和放大器;重新启动。

  • 测试老版本的ffmpeg:V4.8(2014年)和V4.7(2013年)

  • 测试UAC提升提示。

推荐答案

答得从上面提到的超级用户线程(感谢,@Karan)。

Answer obtained (thanks, @Karan) from the above mentioned SuperUser thread.

首先, FFMPEG应返回设备名称值。如果没有,请尝试:

Firstly, FFMPEG should return the device name value. If not, try:


  • 更新FFMPEG至最新版本。

  • 更新.NET框架。

  • 尝试另一个版本。需要注意的是v4.7.3似乎并没有被需要.NET Framework中,如果这是问题(从<一个提取href=\"http://stackoverflow.com/questions/17650354/strncpy-s-error-when-deploying-ffmpeg-streaming-application-on-xp\">this螺纹)。

  • 麦克风设备,请确保该插座连接。在一些系统上,似乎该设备被禁用(消失)如果不是。当然,这其中并不适用于便携设备嵌入(内置)麦克风。

  • Update FFMPEG to latest version.
  • Update .NET FrameWork.
  • Try another version. Note that v4.7.3 seems not to be needing .NET Framework, if this were the issue (extracted from this thread).
  • For microphone devices make sure that the jack is connected. On some systems it seems the device is disabled (disappears) if not. Of course, this one does not apply to portables with embedded (built-in) microphone.

作为第二选择,唯一的工作(如今日六月2015)为Vista及以上,且不需要为FFMPEG的30-40MB的下载,您可以尝试的 SoundVolumeView 从NirSoft。发送值.txt文件和过滤做:

As a second option, only working (as for today, June 2015) for Vista and above, and not needing for the 30-40MB download of FFMPEG, you can try SoundVolumeView from NirSoft. Send values to .txt file and filter by doing:

SoundVolumeView /scomma Audio.txt
for /f "tokens=1 delims=," %d in ('type Audio.txt ^| find "Capture"') do @echo Default recording device is: "%d"

作为第三种选择,还为Vista及以上的,所有的音频输入(捕捉&安培;录音)设备可以从寄存器中提取(适用解释的这里由@Karan通过发出此命令行中):

for /f "tokens=9 delims=\" %a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture" /s ^| find "\Properties"') do @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"') do @echo "%l"

请注意:请记住,脚本等设备时,你可以找到的特殊本地化字符,像西班牙语单词Micrófono麦克风。 FFMPEG,例如,将其显示为一些比较奇怪的Micrófono

Note: remember that when scripting such devices you can find special localized characters, like the spanish word Micrófono for Microphone. FFMPEG, for example, would show it as some rather strange Micrófono.

这三个上面提到的方法,包括NirSoft的,做工精细的远程控制台(SSH等)。

All the three above mentioned methods, including the NirSoft's, work fine on remote console (SSH, for example).

其他景点的:


  • 请注意,这个答案解决了音频设备名称问题仅对于记录/输入/捕获设备,因此(除了FFmpeg的情况下,也许)上面的方法都无效,或者必须相应地修改如果你搜索打的。

  • Note that this answer solves the audio device name issue only for recording/input/capture devices, so (except for the FFMPEG case, maybe) the above methods are not valid or must be modified accordingly if you search for the playing ones.

这篇关于Windows外壳:我怎样才能音频设备(S)姓名(或名称)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆