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:

  1. Press Win + R, type mmsys.cpl, and press Enter to open Sound settings.
  2. Go to the Recording tab.
  3. Right-click anywhere in the empty space and check both Show Disabled Devices and Show Disconnected Devices.
  4. If Stereo Mix appears, right-click it and select Enable, then set it as the Default Device.
  5. 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 dummy

Look 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.mp3

Lossless Audio Capture (WAV)

ffmpeg -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -c:a pcm_s16le output.wav

High-Quality AAC Audio Capture

ffmpeg -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -c:a aac -b:a 192k output.m4a

Replace "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.