User:StasFomin/HowTo/GetDefaultMicOnWindows

From Wiki4Intranet
Jump to: navigation, search

Written For: https://github.com/spatialaudio/python-sounddevice/issues/45#issuecomment-256570747


The problem
Get default mic on Windows, to specify it for ffmpeg. For example I want to capture some video or audio and specify default windows audio device.

I have about 10 of laptops with such audio devices:

Audio configuration of HP2540p on Windows10.png

As we can see, we have two audio devices with same name

  • "Microphone (High Definition Audio Device)"

(One — working, default, one - disabled).

We have to specify the right one, but we cannot use original name.


If we list devices by ffmpeg, we see unique alternative names like "@device_cm_{xxxx}\wave_{yyyy}"

ffmpeg -list_devices true -f dshow -i dummy:
…
DirectShow video devices (some may be both video and audio devices)
[dshow @ 04e332a0] Could not enumerate video devices (or none found).
[dshow @ 04e332a0] DirectShow audio devices
[dshow @ 04e332a0]  "Microphone (High Definition Audio Device)"
[dshow @ 04e332a0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{26076D90-56E0-4313-8919-07C91C3285D8}"
[dshow @ 04e332a0]  "Line (Elgato Sound Capture)" [dshow @ 04e332a0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{066F1F62-9858-4DC2-A6E6-CBA5DC57D17F}"
[dshow @ 04e332a0]  "Microphone (High Definition Audio Device)"
[dshow @ 04e332a0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{469C7D87-9CF7-4C0C-A12B-419714989D7E}"
…

The only