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

21,553

Solution 1

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

Solution 2

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.

Share:
21,553

Related videos on Youtube

gardenofwine
Author by

gardenofwine

Updated on September 18, 2022

Comments

  • gardenofwine
    gardenofwine over 1 year

    I am trying to record what's playing on my soundcard in Windows 8.1

    I ran the following to determine what devices I have:

    ffmpeg -list_devices true -f dshow -i dummy
    

    The output listed:

    DirectShow video devices (some may be both video and audio devices)
      "Built-in iSight"
    DirectShow audio devices
      "Microphone (Cirrus Logic CS4206A (AB 71))"
      "Digital Audio (S/PDIF) (Cirrus Logic CS4206A (AB 71))"
    

    From this I am assuming that Digital Audio (S/PDIF) (Cirrus Logic CS4206A (AB 71)) is my one and only output soundcard.

    So I put on some random youtube video with sound and run the following to record an mp3 for duration of 10 seconds.

    ffmpeg -f dshow -i audio="Digital Audio (S/PDIF) (Cirrus Logic CS4206A (AB 71))" -acodec libmp3lame  -t 10 out.mp3
    

    It does record a 10 second clip but its silent.
    When I look at playback devices, I see that the device through which audio is actually playing is Speakers, not Digital Audio (S/PDIF). enter image description here

    I tried replacing Digital Audio (S/PDIF) with Speakers in the ffmpeg command line, but it obviously couldn't recognize the device.

    I've seen in a similar question, that people suggested "Stereo Mix" - I do not see it on my computer at all. Downloading the latest drivers didn't add it to the list of devices.

    So what am I missing? How can I record the audio off my sound card

    • Admin
      Admin over 8 years
      either stereo mix (doesn't exist typically in windows > XP) or some type of virtual audio capturer like github.com/rdp/virtual-audio-capture-grabber-device or VAC or VB net or what not
    • Admin
      Admin over 8 years
      @rogerdpack Thank you for the advice. I grabbed the github package and was recording in no time.
  • chovy
    chovy over 3 years
    that list devices gives me an error.
  • Tyguy7
    Tyguy7 about 3 years
    This solution doesn't work. I've seen this explained in several posts and followed and re-followed it perfectly and it just records dead air.