Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to intercept all audio data sent to a speaker and write it to a file? I am trying to extract the audio content of a video but I do not have a microphone.

share|improve this question
Can't help you without knowing what OS, at the very least. – Aaron Miller Apr 9 '13 at 22:06
Windows (either 7 or 8 would work) – sddhhanover Apr 9 '13 at 22:13
All audio or something specific? – Boris_yo Apr 9 '13 at 22:16
All audio the computer sends to the speaker – sddhhanover Apr 9 '13 at 22:42
up vote 1 down vote accepted

With either a file or a streaming address, you can use ffmpeg to extract the audio.

ffmpeg.exe -i input -map 0:a:0 -c copy output.mkv

I've used a Matroska (MKV) file because it can handle pretty much any audio codec - the only major exception I know of is Opus, and that's unlikely to be part of a video file at the moment. If you know which audio codec is in use, you can use a different format. If you just want to extract it as an MP3, you can re-encode:

ffmpeg.exe -i input -map 0:a:0 -c:a libmp3lame -q:a 4 output.mp3

input can be either a file, or a streaming address.

Now, to answer your actual question, again with ffmpeg. First, use the following command to list your dshow devices:

ffmpeg.exe -list_devices true -f dshow -i dummy

...the last few lines of which should be something like this:

[dshow @ 000000000214c940] DirectShow video devices
[dshow @ 000000000214c940]  "HP Truevision HD"
[dshow @ 000000000214c940] DirectShow audio devices
[dshow @ 000000000214c940]  "Internal Mic (IDT High Definition Audio CODEC)"
[dshow @ 000000000214c940]  "Stereo Mix (IDT High Definition Audio CODEC)"
dummy: Immediate exit requested

In my case, I used (on Windows 8)

ffmpeg.exe -f dshow -i audio="Stereo Mix (IDT High Definition Audio CODEC)" output.wav

...which captured all the sound from my laptop's audio output. The name of the relevant device will probably be different on your computer. To stop recording, press q with the command prompt in focus.

share|improve this answer
My list doesn't have a stereo mix or anything like that. Is there a way to add it? DirectShow audio devices "Microphone (Cirrus Logic CS4206A (AB 09))" "Digital Audio (S/PDIF) (Cirrus Logic CS4206A (AB 09))" – sddhhanover Apr 10 '13 at 1:30
Well, it's probably not the Microphone, so I'd suggest trying out -i audio="Digital Audio (S/PDIF) (Cirrus Logic CS4206A (AB 09))" – evilsoup Apr 10 '13 at 1:32
how do I finish the recording? – sddhhanover Apr 10 '13 at 1:36
With the command prompt in focus, press q – evilsoup Apr 10 '13 at 1:37
hmm... the audio file was empty which makes me think "Digital Audio" was the wrong device. Is it possible I have speakers not showing up in the -list_devices call? – sddhhanover Apr 10 '13 at 1:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .