dimtpap / obs-pipewire-audio-capture

🔊 Audio device and application capture for OBS Studio using PipeWire
https://obsproject.com/forum/resources/pipewire-audio-capture.1458/
GNU General Public License v2.0
346 stars 12 forks source link

Application Capture doesn't work with EasyEffects #9

Closed AlbinoGeek closed 2 years ago

AlbinoGeek commented 2 years ago

Hello!

So, I have both Pipewire and Wireplumber (a standard Fedora 36 workstation).

It doesn't seem to matter what application source I put in OBS, it records all of my system audio.

image

Regardless of the comment in #8, this also happens with multiple applications.

AlbinoGeek commented 2 years ago

After playing around, all Application sources appear to be recording my microphone only.

It doesn't actually appear to record any audio from my applications.

In the above example, I have youtube music in a chrome tab, not being recorded.

dimtpap commented 2 years ago

Can you run OBS using obs --verbose and post the log?

AlbinoGeek commented 2 years ago

Sure thing, OBS version:

OBS Studio - 27.2.4 (linux)

The only logs I could find that were related to pipewire:

info: [pipewire] Created stream 0x55bbdb02b610
info: [pipewire] Created stream 0x55bbdb082170
info: [pipewire] Created app capture sink 240 with 2 channels and position FL,FR
info: [pipewire] Created app capture sink 225 with 2 channels and position FL,FR
info: [pipewire] 0x55bbdb02b610 Got format: rate 48000 - channels 2 - format 4 - frame size 8
info: [pipewire] 0x55bbdb082170 Got format: rate 48000 - channels 2 - format 4 - frame size 8
info: adding 21 milliseconds of audio buffering, total audio buffering is now 21 milliseconds (source: Chrome)

(shortly after startup)

dimtpap commented 2 years ago

I'll need the log from the terminal output directly. Also if you can install Helvum and post a screenshot of it when OBS and the sources are running

AlbinoGeek commented 2 years ago

Alright,

I've narrowed this issue down to EasyEffects running on the same system.

Even if I disable migration, and exclude OBS from EasyEffects, the plugin still breaks.

dimtpap commented 2 years ago

I can reproduce the issue when the option "Process All Input Streams" is turned on in EasyEffect's general preferences. Do you have it on?

Excluding OBS Studio in the Input tab lets the plugin work as expected once I restart OBS

AlbinoGeek commented 2 years ago

Here is a full log from a run without EasyEffects running:

Click to expand ``` Attempted path: share/obs/obs-studio/locale/en-US.ini Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini Attempted path: share/obs/obs-studio/themes/Dark.qss Attempted path: /usr/share/obs/obs-studio/themes/Dark.qss info: CPU Name: Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz info: CPU Speed: 3800.000MHz info: Physical Cores: 4, Logical Cores: 8 info: Physical Memory: 31561MB Total, 1900MB Free info: Kernel Version: Linux 5.18.6-200.fc36.x86_64 info: Distribution: "Fedora Linux" 36 info: Session Type: x11 info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.20.14 info: Qt Version: 5.15.3 (runtime), 5.15.3 (compiled) info: Portable mode: false Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg Attempted path: /usr/share/obs/obs-studio/themes/Dark/no_sources.svg info: OBS 27.2.4 (linux) info: --------------------------------- info: --------------------------------- info: audio settings reset: samples per sec: 48000 speakers: 2 info: --------------------------------- info: Initializing OpenGL... info: Loading up OpenGL on adapter NVIDIA Corporation NVIDIA GeForce GTX 960/PCIe/SSE2 info: OpenGL loaded successfully, version 3.3.0 NVIDIA 510.68.02, shading language 3.30 NVIDIA via Cg compiler info: --------------------------------- info: video settings reset: base resolution: 1280x720 output resolution: 1280x720 downscale filter: Bicubic fps: 30/1 format: NV12 YUV mode: sRGB/Full info: NV12 texture support not available info: Audio monitoring device: name: Default id: default info: --------------------------------- warning: Failed to load 'en-US' text for module: 'decklink-captions.so' warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so' warning: A DeckLink iterator could not be created. The DeckLink drivers may not be installed info: No blackmagic support info: NVENC supported info: FFMPEG VAAPI supported info: [vlc-video]: VLC 3.0.17.2 Vetinari found, VLC video source enabled info: --------------------------------- info: Loaded Modules: info: linux-pipewire-audio.so info: vlc-video.so info: text-freetype2.so info: rtmp-services.so info: obs-x264.so info: obs-vst.so info: obs-transitions.so info: obs-outputs.so info: obs-libfdk.so info: obs-filters.so info: obs-ffmpeg.so info: linux-v4l2.so info: linux-pulseaudio.so info: linux-jack.so info: linux-decklink.so info: linux-capture.so info: linux-alsa.so info: image-source.so info: frontend-tools.so info: decklink-ouput-ui.so info: decklink-captions.so info: --------------------------------- info: ==== Startup complete =============================================== info: All scene data cleared info: ------------------------------------------------ info: pulse-input: Server name: 'PulseAudio (on PipeWire 0.3.52) 15.0.0' info: pulse-input: Audio format: s32le, 48000 Hz, 2 channels info: pulse-input: Started recording from 'alsa_input.pci-0000_00_1b.0.analog-stereo' info: [Loaded global audio device]: 'Mic/Aux' info: [pipewire] Created stream 0x55e4e79904f0 info: [pipewire] Created stream 0x55e4e7a40890 info: [pipewire] Created app capture sink 192 with 2 channels and position FL,FR info: [pipewire] Created app capture sink 193 with 2 channels and position FL,FR info: [pipewire] 0x55e4e79904f0 Got format: rate 48000 - channels 2 - format 4 - frame size 8 info: Switched to scene 'Avatar' info: ------------------------------------------------ info: Loaded scenes: info: - scene 'Avatar': info: - source: 'Background' (image_source) info: - source: 'VSeeFace' (xcomposite_input) info: - filter: 'Chroma Key' (chroma_key_filter_v2) info: - filter: 'Colour Correction' (color_filter_v2) info: - filter: 'Sharpen' (sharpness_filter_v2) info: - filter: 'Apply LUT' (clut_filter) info: - source: 'Chrome' (pipewire_audio_application_capture) info: - source: 'Firefox' (pipewire_audio_application_capture) info: ------------------------------------------------ info: [pipewire] 0x55e4e7a40890 Got format: rate 48000 - channels 2 - format 4 - frame size 8 info: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds (source: Chrome) Attempted path: share/obs/obs-studio/images/overflow.png Attempted path: /usr/share/obs/obs-studio/images/overflow.png info: ==== Shutting down ================================================== info: pulse-input: Stopped recording from 'alsa_input.pci-0000_00_1b.0.analog-stereo' info: pulse-input: Got 302 packets with 362400 frames info: All scene data cleared info: ------------------------------------------------ info: [Scripting] Total detached callbacks: 0 info: Freeing OBS context data info: == Profiler Results ============================= info: run_program_init: 1189.83 ms info: ┣OBSApp::AppInit: 2.194 ms info: ┃ ┗OBSApp::InitLocale: 0.776 ms info: ┗OBSApp::OBSInit: 1002.44 ms info: ┣obs_startup: 27.018 ms info: ┗OBSBasic::OBSInit: 892.709 ms info: ┣OBSBasic::InitBasicConfig: 0.093 ms info: ┣OBSBasic::ResetAudio: 0.193 ms info: ┣OBSBasic::ResetVideo: 124.092 ms info: ┣OBSBasic::InitOBSCallbacks: 0.004 ms info: ┣OBSBasic::InitHotkeys: 0.032 ms info: ┣obs_load_all_modules: 318.613 ms info: ┃ ┣obs_init_module(decklink-captions.so): 0.039 ms info: ┃ ┣obs_init_module(decklink-ouput-ui.so): 0.913 ms info: ┃ ┣obs_init_module(frontend-tools.so): 93.143 ms info: ┃ ┣obs_init_module(image-source.so): 0.005 ms info: ┃ ┣obs_init_module(linux-alsa.so): 0.002 ms info: ┃ ┣obs_init_module(linux-capture.so): 0.637 ms info: ┃ ┣obs_init_module(linux-decklink.so): 0.151 ms info: ┃ ┣obs_init_module(linux-jack.so): 0.002 ms info: ┃ ┣obs_init_module(linux-pulseaudio.so): 0.001 ms info: ┃ ┣obs_init_module(linux-v4l2.so): 0.039 ms info: ┃ ┣obs_init_module(obs-ffmpeg.so): 1.113 ms info: ┃ ┃ ┗nvenc_check: 0.634 ms info: ┃ ┣obs_init_module(obs-filters.so): 0.016 ms info: ┃ ┣obs_init_module(obs-libfdk.so): 0.001 ms info: ┃ ┣obs_init_module(obs-outputs.so): 0.003 ms info: ┃ ┣obs_init_module(obs-transitions.so): 0.006 ms info: ┃ ┣obs_init_module(obs-vst.so): 0.002 ms info: ┃ ┣obs_init_module(obs-x264.so): 0.001 ms info: ┃ ┣obs_init_module(rtmp-services.so): 0.172 ms info: ┃ ┣obs_init_module(text-freetype2.so): 0.018 ms info: ┃ ┣obs_init_module(vlc-video.so): 5.126 ms info: ┃ ┗obs_init_module(linux-pipewire-audio.so): 0.426 ms info: ┣OBSBasic::ResetOutputs: 0.208 ms info: ┣OBSBasic::CreateHotkeys: 0.193 ms info: ┣OBSBasic::InitService: 1.146 ms info: ┣OBSBasic::InitPrimitives: 0.259 ms info: ┗OBSBasic::Load: 305.595 ms info: obs_hotkey_thread(25 ms): min=0.1 ms, median=0.34 ms, max=13.312 ms, 99th percentile=5.009 ms, 100% below 25 ms info: audio_thread(Audio): min=0 ms, median=0.139 ms, max=0.306 ms, 99th percentile=0.231 ms info: obs_graphics_thread(33.3333 ms): min=0.593 ms, median=2.362 ms, max=216.987 ms, 99th percentile=23.507 ms, 99.1597% below 33.333 ms info: ┣tick_sources: min=0.001 ms, median=0.443 ms, max=215.223 ms, 99th percentile=2.36 ms info: ┣output_frame: min=0.218 ms, median=0.573 ms, max=2.798 ms, 99th percentile=1.87 ms info: ┃ ┗gs_context(video->graphics): min=0.218 ms, median=0.572 ms, max=2.797 ms, 99th percentile=1.87 ms info: ┃ ┣render_video: min=0.074 ms, median=0.339 ms, max=1.057 ms, 99th percentile=0.662 ms info: ┃ ┃ ┗render_main_texture: min=0.062 ms, median=0.317 ms, max=1.041 ms, 99th percentile=0.646 ms info: ┃ ┗gs_flush: min=0.006 ms, median=0.016 ms, max=2.034 ms, 99th percentile=0.396 ms info: ┗render_displays: min=0.097 ms, median=0.837 ms, max=49.32 ms, 99th percentile=1.697 ms info: ================================================= info: == Profiler Time Between Calls ================== info: obs_hotkey_thread(25 ms): min=25.179 ms, median=25.424 ms, max=38.386 ms, 68.9231% within ±2% of 25 ms (0% lower, 31.0769% higher) info: obs_graphics_thread(33.3333 ms): min=15.227 ms, median=33.333 ms, max=216.992 ms, 98.3122% within ±2% of 33.333 ms (0.843882% lower, 0.843882% higher) info: ================================================= info: Number of memory leaks: 0 ```

Now, with EasyEffects running

Click to expand ``` Attempted path: share/obs/obs-studio/locale/en-US.ini Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini Attempted path: share/obs/obs-studio/themes/Dark.qss Attempted path: /usr/share/obs/obs-studio/themes/Dark.qss info: CPU Name: Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz info: CPU Speed: 3800.000MHz info: Physical Cores: 4, Logical Cores: 8 info: Physical Memory: 31561MB Total, 1661MB Free info: Kernel Version: Linux 5.18.6-200.fc36.x86_64 info: Distribution: "Fedora Linux" 36 info: Session Type: x11 info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.20.14 info: Qt Version: 5.15.3 (runtime), 5.15.3 (compiled) info: Portable mode: false Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg Attempted path: /usr/share/obs/obs-studio/themes/Dark/no_sources.svg info: OBS 27.2.4 (linux) info: --------------------------------- info: --------------------------------- info: audio settings reset: samples per sec: 48000 speakers: 2 info: --------------------------------- info: Initializing OpenGL... info: Loading up OpenGL on adapter NVIDIA Corporation NVIDIA GeForce GTX 960/PCIe/SSE2 info: OpenGL loaded successfully, version 3.3.0 NVIDIA 510.68.02, shading language 3.30 NVIDIA via Cg compiler info: --------------------------------- info: video settings reset: base resolution: 1280x720 output resolution: 1280x720 downscale filter: Bicubic fps: 30/1 format: NV12 YUV mode: sRGB/Full info: NV12 texture support not available info: Audio monitoring device: name: Default id: default info: --------------------------------- warning: Failed to load 'en-US' text for module: 'decklink-captions.so' warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so' warning: A DeckLink iterator could not be created. The DeckLink drivers may not be installed info: No blackmagic support info: NVENC supported info: FFMPEG VAAPI supported info: [vlc-video]: VLC 3.0.17.2 Vetinari found, VLC video source enabled info: --------------------------------- info: Loaded Modules: info: linux-pipewire-audio.so info: vlc-video.so info: text-freetype2.so info: rtmp-services.so info: obs-x264.so info: obs-vst.so info: obs-transitions.so info: obs-outputs.so info: obs-libfdk.so info: obs-filters.so info: obs-ffmpeg.so info: linux-v4l2.so info: linux-pulseaudio.so info: linux-jack.so info: linux-decklink.so info: linux-capture.so info: linux-alsa.so info: image-source.so info: frontend-tools.so info: decklink-ouput-ui.so info: decklink-captions.so info: --------------------------------- info: ==== Startup complete =============================================== info: All scene data cleared info: ------------------------------------------------ info: pulse-input: Server name: 'PulseAudio (on PipeWire 0.3.52) 15.0.0' info: pulse-input: Audio format: s32le, 48000 Hz, 2 channels info: pulse-input: Started recording from 'alsa_input.pci-0000_00_1b.0.analog-stereo' info: [Loaded global audio device]: 'Mic/Aux' info: [pipewire] Created stream 0x559d1f239100 info: [pipewire] Created stream 0x559d1f1eb610 info: [pipewire] Created app capture sink 206 with 2 channels and position FL,FR info: [pipewire] Created app capture sink 261 with 2 channels and position FL,FR info: [pipewire] 0x559d1f1eb610 Got format: rate 48000 - channels 2 - format 4 - frame size 8 info: [pipewire] 0x559d1f239100 Got format: rate 48000 - channels 2 - format 4 - frame size 8 info: Switched to scene 'Avatar' info: ------------------------------------------------ info: Loaded scenes: info: - scene 'Avatar': info: - source: 'Background' (image_source) info: - source: 'VSeeFace' (xcomposite_input) info: - filter: 'Chroma Key' (chroma_key_filter_v2) info: - filter: 'Colour Correction' (color_filter_v2) info: - filter: 'Sharpen' (sharpness_filter_v2) info: - filter: 'Apply LUT' (clut_filter) info: - source: 'Chrome' (pipewire_audio_application_capture) info: - source: 'Firefox' (pipewire_audio_application_capture) info: ------------------------------------------------ Attempted path: share/obs/obs-studio/images/overflow.png Attempted path: /usr/share/obs/obs-studio/images/overflow.png info: adding 21 milliseconds of audio buffering, total audio buffering is now 21 milliseconds (source: Mic/Aux) info: ==== Shutting down ================================================== info: pulse-input: Stopped recording from 'alsa_input.pci-0000_00_1b.0.analog-stereo' info: pulse-input: Got 847 packets with 1016400 frames info: All scene data cleared info: ------------------------------------------------ info: [Scripting] Total detached callbacks: 0 info: Freeing OBS context data info: == Profiler Results ============================= info: run_program_init: 1258.02 ms info: ┣OBSApp::AppInit: 2.836 ms info: ┃ ┗OBSApp::InitLocale: 1.158 ms info: ┗OBSApp::OBSInit: 1053.62 ms info: ┣obs_startup: 14.536 ms info: ┗OBSBasic::OBSInit: 951.796 ms info: ┣OBSBasic::InitBasicConfig: 0.158 ms info: ┣OBSBasic::ResetAudio: 0.284 ms info: ┣OBSBasic::ResetVideo: 135.572 ms info: ┣OBSBasic::InitOBSCallbacks: 0.004 ms info: ┣OBSBasic::InitHotkeys: 0.033 ms info: ┣obs_load_all_modules: 347.566 ms info: ┃ ┣obs_init_module(decklink-captions.so): 0.04 ms info: ┃ ┣obs_init_module(decklink-ouput-ui.so): 0.934 ms info: ┃ ┣obs_init_module(frontend-tools.so): 96.252 ms info: ┃ ┣obs_init_module(image-source.so): 0.008 ms info: ┃ ┣obs_init_module(linux-alsa.so): 0.003 ms info: ┃ ┣obs_init_module(linux-capture.so): 0.578 ms info: ┃ ┣obs_init_module(linux-decklink.so): 0.202 ms info: ┃ ┣obs_init_module(linux-jack.so): 0.002 ms info: ┃ ┣obs_init_module(linux-pulseaudio.so): 0.002 ms info: ┃ ┣obs_init_module(linux-v4l2.so): 0.045 ms info: ┃ ┣obs_init_module(obs-ffmpeg.so): 1.211 ms info: ┃ ┃ ┗nvenc_check: 0.692 ms info: ┃ ┣obs_init_module(obs-filters.so): 0.026 ms info: ┃ ┣obs_init_module(obs-libfdk.so): 0.001 ms info: ┃ ┣obs_init_module(obs-outputs.so): 0.003 ms info: ┃ ┣obs_init_module(obs-transitions.so): 0.006 ms info: ┃ ┣obs_init_module(obs-vst.so): 0.003 ms info: ┃ ┣obs_init_module(obs-x264.so): 0.002 ms info: ┃ ┣obs_init_module(rtmp-services.so): 0.188 ms info: ┃ ┣obs_init_module(text-freetype2.so): 0.009 ms info: ┃ ┣obs_init_module(vlc-video.so): 5.63 ms info: ┃ ┗obs_init_module(linux-pipewire-audio.so): 0.511 ms info: ┣OBSBasic::ResetOutputs: 0.204 ms info: ┣OBSBasic::CreateHotkeys: 0.223 ms info: ┣OBSBasic::InitService: 1.184 ms info: ┣OBSBasic::InitPrimitives: 0.37 ms info: ┗OBSBasic::Load: 283.652 ms info: obs_hotkey_thread(25 ms): min=0.087 ms, median=0.273 ms, max=24.884 ms, 99th percentile=8.282 ms, 100% below 25 ms info: audio_thread(Audio): min=0 ms, median=0.134 ms, max=3.377 ms, 99th percentile=0.265 ms info: obs_graphics_thread(33.3333 ms): min=0.487 ms, median=2.073 ms, max=226.348 ms, 99th percentile=28.705 ms, 99.2248% below 33.333 ms info: ┣tick_sources: min=0.001 ms, median=0.388 ms, max=224.2 ms, 99th percentile=3.456 ms info: ┣output_frame: min=0.195 ms, median=0.515 ms, max=31.386 ms, 99th percentile=1.611 ms info: ┃ ┗gs_context(video->graphics): min=0.194 ms, median=0.514 ms, max=31.385 ms, 99th percentile=1.61 ms info: ┃ ┣render_video: min=0.05 ms, median=0.301 ms, max=1.312 ms, 99th percentile=0.496 ms info: ┃ ┃ ┗render_main_texture: min=0.041 ms, median=0.281 ms, max=1.297 ms, 99th percentile=0.456 ms info: ┃ ┗gs_flush: min=0.005 ms, median=0.013 ms, max=15.033 ms, 99th percentile=0.202 ms info: ┗render_displays: min=0.074 ms, median=0.688 ms, max=27.618 ms, 99th percentile=7.24 ms info: ================================================= info: == Profiler Time Between Calls ================== info: obs_hotkey_thread(25 ms): min=25.162 ms, median=25.355 ms, max=49.957 ms, 77.2196% within ±2% of 25 ms (0% lower, 22.7804% higher) info: obs_graphics_thread(33.3333 ms): min=6.982 ms, median=33.334 ms, max=226.352 ms, 98.4472% within ±2% of 33.333 ms (0.776398% lower, 0.776398% higher) info: ================================================= info: Number of memory leaks: 0 ```

Specifically, after blacklisting OBS, the plugin works, and the output appears unchanged. So, good to know, this issue is specific to the sources being "migrated" by EasyEffects.


This issue boils down to "add a note about excluding OBS from EasyEffects to the README" -- unless you want to look into why this happens.

dimtpap commented 2 years ago

Looking at the EasyEffects source code it is set to exclude streams if a certain property is set. I'll see if that fixes it.

AlbinoGeek commented 2 years ago

Thank you for your incredibly diligent support on this project. I am keen to start using OBS again, thanks entirely to your plugin. I had stopped using OBS because of its lackluster audio support on Linux, and you single-handedly are fixing that.

Note: EasyEffects will IGNORE the PA_DONT_MIGRATE flag, because of Firefox.

I didn't know about PW_KEY_STREAM_CAPTURE_SINK though, that's a neat find.


Wow, I never realized how much EasyEffects stuffs up your audio subsystem.

Without OBS:

image

With OBS:

image

BluesDriveAmelia commented 3 months ago

I use EasyEffects and I'm having a similar issue with the application audio capture albeit it actually does capture my application audio, but also my microphone. While excluding OBS works, all of my microphone filters to make it all sound nice are in easyeffects so it isn't really a viable solution as it also affects the microphone audio capture. Any alternatives?