Similar to the win-capture-audio plugin by bozbez that allows for the capturing of audio from specific applications except for systems that use PulseAudio as their main sound server. Also influenced by the existing linux-pulseaudio
plugin built into OBS as well as the pactl utility built into PulseAudio
Another Note: This plugin is not under very active development. It has been updated to support OBS 29 but with very if any testing. If you wish to contribute with development of this plugin, feel free to fork the repo
While upgrading the plugin to OBS 29, I decided to take another look if libpulse
supported any other ways of capturing application audio without using the combine-sink
module. v0.1.0
used the combine-sink
module dynamically resulting a lot of bugs and janky behavior. Instead of using a combine-sink
module to man in the middle the audio so it can be recorded before it makes it to the sink, v0.2.0-alpha
attaches itself to the monitor of the sink of which the application is sending audio to. Because there is no longer a man in the middle, there is no more added latency as well as random audio routing issues when the combine-sink
module would misbehave. libpulse
allows for only capturing audio from a monitor from a specific sink-input (in this case an application) if desired making this entire approach possible in much less code.
PulseAudio uses a client server model to manage sound. Unfortunately (at least from what I can tell) it does not allow recording directly from a specific application as clients and the corresponding sink-inputs do not have monitors that can be recorded from. The way to get around this is to load a new combine-sink
module, set the combine-sink
module's sink (output) to be the same sink as the application, and then move the application's sink to be the new combine-sink
module. Because the combine-sink
module has a monitor, we can read the audio data from the monitor while the audio is still being sent to desired location. Note: While not ideal, this is actually the same method that Zoom
uses in order to capture and share desktop audio on Linux devices running a PulseAudio server.
Simply add the source, select the application, and the audio should be recorded.
- libpulse0
Debain installer can be found in the Releases section. A tar file containing the actual plugin library and data files can also be found and extracted for other non-Debian based systems.
git clone https://github.com/jbwong05/obs-pulseaudio-app-capture.git
cd obs-pulseaudio-app-capture
./.github/scripts/build-linux.sh