bozbez / win-capture-audio

An OBS plugin that allows capture of independant application audio streams on Windows, in a similar fashion to OBS's game capture and Discord's application streaming.
GNU General Public License v2.0
3.73k stars 203 forks source link

Is a standalone very of this plugin possible ? #225

Open shodanx2 opened 1 year ago

shodanx2 commented 1 year ago

Hi,

(I would have posted this as a discussion, but there is no discussion section here)

I've been scouring the internet for a way to help ffmpeg capture desktop audio.

OBS seems to have the best desktop audio capture around by a long shot in the form of this plugin. In particular the per-application granularity portion.

I am wondering, is there any way to roll this plugin into a standalone application ? Something I could use to feed my ffmpeg process with captured audio ?

bozbez commented 1 year ago

A standalone version should be pretty easy - you could almost just use the AudioCapture class as-is, you would just need to replace AudioCapture::Update() to take something that isn't the OBS settings object.

The question is really the output format - at the moment Mixer::Tick() is calling obs_source_output_audio() to dump the frames. Dumping raw audio frames to stdout would lose bitrate, channel and format information - it might be better to consider re-packaging as an ffmpeg input source for nicer integration.

shodanx2 commented 1 year ago

I think that would be perfect, I want to help fund this. Maybe bunch of ffmpeg users like me can come together and make it worthwhile for you and some ffmpeg expert to give it a shot.

There are no comparable audio source, https://ffmpeg.org/ffmpeg-all.html#Audio-Sources. The only option is -f dshow but that requires a driver with a stereo mix loopback recording device, which, most computers don't have installed. End result is, there is no reliable desktop audio capture on random windows computers if using ffmpeg.

(My current use case is streaming my desktop using ddagrab, streaming to local multicast so I can keep watching youtube when I go in the kitchen !)

The ability to capture just one specific app's audio would open doors from the people doing cloud computing,

I will ask on ffmpeg-devel mailing to see if there is anyone up to the challenge.

lostmsu commented 1 year ago

@bozbez can you describe a little bit how this works? Can I silence the regular game sound?

lostmsu commented 1 year ago

Found a simpler version of this: https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/ApplicationLoopback/cpp