How to record what's playing on the soundcard using FFmpeg?

If it's still relevant to anybody. You need to open Sound Devices window shown above, then click RMB in clean spot and select Show Disabled Devices to toggle Stereo Mix device visibility


First enable your Stereo Mix by opening the "Sound" window shown in the screenshot above, selecting the "Recording" tab, then right clicking on the window and selecting "Show Disabled Devices" to toggle the Stereo Mix device visibility. This post has the instructions in more detail.

After you enable your Stereo Mix you need to plug a speaker or headphones into your audio output. Then run the command to get the name of your headset/speaker output.

ffmpeg -list_devices true -f dshow -i dummy

Here is the full command that is working for me on Windows 10 Home to get the audio:

ffmpeg -f dshow -i audio="Microphone (Realtek High Definition Audio)" D:\Audio\output.mp3

Here is a command for audio and video at the same time:

ffmpeg -f gdigrab -framerate ntsc -video_size 1920x1080 -i desktop  -f dshow -i audio="Microphone (Realtek High Definition Audio)" -vcodec libx264 -pix_fmt yuv420p -preset ultrafast D:\Movies\output.mp4

This video output is also working on my iPad. I have a laptop plugged into a monitor and this will record the full screen of my monitor and the audio coming out of my speakers.