Is there a way to capture the audio outputted by only a single application, and not the system as a whole? With WASAPI I can capture the entire system audio, but I wish to only capture the audio from one application (there will be many applications, all playing audio at once.)
Asked
Active
Viewed 7,930 times
6
-
Hi. I am interested in capturing the entire system audio. How you have done it? Some pointers? – Gabriel Feb 14 '20 at 17:05
-
hi, how do solve your problem finally? – TianpingHsu Nov 28 '22 at 08:16
2 Answers
5
Detours is used for hooking. Using the lib to hook IAudioRenderClient interface, including GetBuffer and ReleaseBuffer, and read data from the buffer.

lethe
- 78
- 1
- 5
-
How did you hook the IAudioRenderClient using Detours? I tried via IMMDeviceEnumerator, IMMDevice::Activate and IAudioClient::GetService. But unfortunately IMMDevice::Activate doesn't seem to be called. – Cthutu May 08 '13 at 13:45
-1
Depending on the APIs used by the application to play the audio, you could write an AppInit DLL that will wrap the built-in waveIn\waveOut functions and would pass along the audio data. I know this works with the waveIn\waveOut functions, but not sure what other audio playback interfaces there are on Windows 7 and whether they are compatible with the AppInit trick.

Femi
- 64,273
- 8
- 118
- 148
-
2Don't use AppInit, just start the process suspended and inject your DLL - either way it's hacky, but at least you won't affect every application on the machine. – Ana Betts May 21 '11 at 21:55
-
True, but starting suspended/inject is hard to do from an icon click: the AppInit option works reasonably well. If you wanted to be super-careful you could do an image hijack for the executable which would be compatible with the suspend/inject trick: just don't have any experience with that. – Femi May 21 '11 at 22:01
-
1Please don't use AppInit for anything, you're almost guaranteed to crash other applications and make your customers' lives less awesome. You can suspend processes by using the debugger APIs, inject your DLL, then hit go. – Ana Betts May 21 '11 at 22:13
-
We will have to agree to disagree on that: it IS invasive, but like all powerful tools can be valuable when carefully handled. – Femi May 21 '11 at 22:27
-
1This isn't an opinion - AppInit DLLs *will* cause problems, guaranteed. Your only hope is that your app isn't popular enough that users happen to hit it. – Ana Betts May 22 '11 at 20:05