Record Virtual Audio Cable with FFmpeg on Windows
Capturing audio from a virtual sound card like Virtual Audio Cable (VAC) using FFmpeg on Windows allows you to record system sounds, application audio, or routed streams directly into a digital audio file. This guide provides a straightforward, step-by-step walkthrough on how to identify your virtual audio devices using DirectShow and execute the correct FFmpeg commands to record high-quality audio.
Step 1: Identify Your Virtual Audio Device Name
Before recording, you must find the exact name of your virtual audio
device as recognized by Windows. FFmpeg uses the DirectShow
(dshow) device grabber to access Windows audio
hardware.
Open your Windows Command Prompt (cmd) or PowerShell and run the following command:
ffmpeg -list_devices true -f dshow -i dummyLocate the section in the output labeled “DirectShow audio devices”.
You will see a list of available audio input devices. Look for your
virtual audio card, which is often named something like: *
"Line 1 (Virtual Audio Cable)" *
"CABLE Output (VB-Audio Virtual Cable)"
Note the exact name inside the quotation marks.
Step 2: Record Audio Using FFmpeg
Once you have the device name, you can start recording. Use the following command structure to capture the audio and save it to a file.
Replace "Line 1 (Virtual Audio Cable)" with the exact
name of your virtual device:
ffmpeg -f dshow -i audio="Line 1 (Virtual Audio Cable)" output.mp3Explaining the Command Parameters:
-f dshow: Tells FFmpeg to use the DirectShow format library to capture input.-i audio="...": Specifies the input source as an audio device and provides the name of your virtual sound card.output.mp3: The name and format of the output file. FFmpeg will automatically encode the audio based on the file extension you provide (e.g.,.mp3,.wav,.m4a).
Advanced Recording Options
To ensure maximum compatibility and audio quality, you can specify the audio codec, sample rate, and bit rate manually.
Record Lossless WAV (PCM 16-bit):
ffmpeg -f dshow -i audio="Line 1 (Virtual Audio Cable)" -c:a pcm_s16le output.wavRecord High-Quality MP3 (320kbps):
ffmpeg -f dshow -i audio="Line 1 (Virtual Audio Cable)" -c:a libmp3lame -b:a 320k output.mp3Record AAC Audio with 48kHz Sampling Rate:
ffmpeg -f dshow -i audio="Line 1 (Virtual Audio Cable)" -c:a aac -ar 48000 output.m4aTo stop the recording at any time, press q or Ctrl + C in the command prompt window. FFmpeg will safely close the file and finalize the audio track.