Capture audio of a single application on Windows 7
Asked Answered
D

2

6

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.)

Disprize answered 21/5, 2011 at 21:27 Comment(2)
Hi. I am interested in capturing the entire system audio. How you have done it? Some pointers?Ken
hi, how do solve your problem finally?Jemy
S
5

Detours is used for hooking. Using the lib to hook IAudioRenderClient interface, including GetBuffer and ReleaseBuffer, and read data from the buffer.

Staple answered 27/3, 2012 at 8:21 Comment(1)
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.Ailee
R
-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.

Reform answered 21/5, 2011 at 21:38 Comment(5)
Don'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.Brilliance
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.Reform
Please 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.Brilliance
We will have to agree to disagree on that: it IS invasive, but like all powerful tools can be valuable when carefully handled.Reform
This 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.Brilliance

© 2022 - 2024 — McMap. All rights reserved.