List DirectShow Devices Using FFmpeg on Windows
Finding and identifying connected audio and video hardware on Windows is essential for multimedia recording and streaming. This article provides a quick, step-by-step guide on how to use FFmpeg to list all available DirectShow devices, such as webcams, microphones, and capture cards, using a simple command-line instruction.
The Command to List Devices
To discover your Windows multimedia devices, open either Command
Prompt (cmd.exe) or PowerShell and execute the following
FFmpeg command:
ffmpeg -list_devices true -f dshow -i dummyUnderstanding the Command Breakdown
ffmpeg: Calls the FFmpeg executable.-list_devices true: A device-specific option for the DirectShow demuxer that instructs FFmpeg to print a list of available devices instead of attempting to record input.-f dshow: Specifies the format driver, which is DirectShow (dshow) on Windows.-i dummy: Passes a placeholder input name (dummy) to satisfy the syntax requirements of the command, as the actual input will be determined by your list query.
Analyzing the Output
After running the command, FFmpeg will print the results to the console. The output will group your hardware into two distinct categories: DirectShow video devices and DirectShow audio devices.
The output will look similar to this:
[dshow @ 0000021c97a9f0c0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 0000021c97a9f0c0] "Integrated Webcam"
[dshow @ 0000021c97a9f0c0] Alternative name "@device_pnp_\\?\usb#vid_04f2&pid_b624..."
[dshow @ 0000021c97a9f0c0] DirectShow audio devices
[dshow @ 0000021c97a9f0c0] "Microphone Array (Realtek(R) Audio)"
[dshow @ 0000021c97a9f0c0] Alternative name "@device_cm_{33d9a762-90c8-11d0-bd43-00a0c911ce86}\..."
- Friendly Name: The name in quotes (e.g.,
"Integrated Webcam") is the user-friendly name of the device. You can use this exact name in future FFmpeg commands to capture video or audio. - Alternative Name: The long string beginning with
@deviceis a unique system identifier. If your device has non-ASCII characters in its name, or if you have multiple devices with the exact same friendly name, you should use this alternative name instead.
Saving the Device List to a Text File
Because FFmpeg prints this information to the standard error
(stderr) stream rather than the standard output
(stdout), standard command-line redirection using
> will not work. To save the list of devices directly to
a text file for future reference, redirect the error stream using
2>:
ffmpeg -list_devices true -f dshow -i dummy 2> devices.txt