Capture System Audio in Windows Using FFmpeg dshow
This guide explains how to capture internal system audio on Windows
using FFmpeg's DirectShow (dshow) input format. Because
DirectShow treats system audio output as playback rather than a standard
capture source, you must route your desktop audio through an input
interface like Windows Stereo Mix or a virtual audio cable. Below, you
will find the steps to enable an audio loopback source, locate its
DirectShow device name, and run the FFmpeg commands required to record
the sound directly to an audio file.
Step 1: Enable a Loopback Recording Device
DirectShow requires an audio input device to record sound. To record what is playing on your computer, you need an internal loopback device:
- Press
Win + R, typemmsys.cpl, and press Enter to open Sound settings. - Go to the Recording tab.
- Right-click anywhere in the empty space and check both Show Disabled Devices and Show Disconnected Devices.
- If Stereo Mix appears, right-click it and select Enable, then set it as the Default Device.
- If Stereo Mix is not available on your hardware,
download and install a free virtual audio driver such as VB-Audio
Virtual Cable, which provides a virtual input
(
CABLE Output) that can capture desktop audio.
Step 2: Identify the DirectShow Device Name
FFmpeg needs the exact name of the recording device to initialize the capture stream. Open Command Prompt or PowerShell and run:
ffmpeg -list_devices true -f dshow -i dummyLook at the output under the DirectShow audio devices
section. Note the exact name inside the quotation marks, such as
"Stereo Mix (Realtek High Definition Audio)" or
"CABLE Output (VB-Audio Virtual Cable)".
Step 3: Record System Audio with FFmpeg
Once you have the exact device name, use the -f dshow
flag followed by the -i audio="[Device Name]" syntax.
Basic Audio Capture (MP3)
ffmpeg -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" output.mp3Lossless Audio Capture (WAV)
ffmpeg -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -c:a pcm_s16le output.wavHigh-Quality AAC Audio Capture
ffmpeg -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -c:a aac -b:a 192k output.m4aReplace "Stereo Mix (Realtek High Definition Audio)"
with the exact name found in Step 2.
Step 4: Stop Recording
When you are ready to finish the recording, press
Ctrl + C in your terminal window. FFmpeg will safely close
the audio stream and finalize the output file.