obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
58.92k stars 7.85k forks source link

Linux Application Audio Capture Crackling/Stuttering #10964

Closed fritz-fritz closed 2 months ago

fritz-fritz commented 2 months ago

Operating System Info

Other

Other OS

Kali GNU/Linux kali-rolling 2024.2 x86_64

OBS Studio Version

30.2.0-rc1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/JqadeT2OpkmCoqMX

OBS Studio Crash Log URL

No response

Expected Behavior

Game audio should be captured as it sounds during play.

Current Behavior

Game audio stutters/crackles (believe it may be an audio underrun).

Steps to Reproduce

  1. Set pipewire default clock rate to 96000
  2. Set OBS audio sample to 48000
  3. Add a source Audio Application Capture (for example Counter Strike 2)
  4. Start Recording

Anything else we should know?

I am aware that OBS is in the process of integrating the third party plugin and I am honestly unsure if I have the Application Audio Capture being provided by the plugin or from compiling of this repo... But I figured you might want the report here regardless.

There was absolutely nothing in the OBS logs that hinted at any audio issues. The game output itself was flawless and only the capture was having an issue.

Tuning pipewire quantums led to occasional successful recording/streaming but ultimately didn't fix the problem. Returning the default clock rate to default (4800) improved the audio but didn't fix it.

What fixed the problem:

Overriding the default clock rate to 44100 (but still with OBS set to 48000) seems to have fixed it. (idea from the similar windows issue) I then used wireplumber to override my devices (headphones/mic) sample rates to their highest depth/rate and set pipewire allowed rates to include the devices supported sample rates in order to achieve an equivalent(ish) setup.

I don't know why this was a problem or why the steps above resolved it... but if you would like me to test further I am available.

fastfetch

```console $ fastfetch .............. user@hostname ..,;:ccc,. ----------------- ......''';lxO. OS: Kali GNU/Linux kali-rolling 2024.2 x86_64 .....''''..........,:ld; Host: 82k2 (ideapad r5 16) .';;;:::;,,.x, Kernel: Linux 6.8.11-amd64 ..'''. 0Xxoc:,. ... Uptime: 1 day, 1 hour, 16 mins .... ,ONkc;,;cokOdc',. Packages: 4538 (dpkg) . OMo ':ddo. Shell: zsh 5.9 dMc :OO; Display (U34G3G3R3): 3440x1440 @ 100Hz * 0M. .:o. Display (BOE08E8): 1920x1080 @ 120Hz ;Wd DE: Xfce4 4.18 ;XO, WM: Xfwm4 (X11) ,d0Odlc;,.. WM Theme: Kali-Dark ..',;:cdOOd::,. Theme: Kali-Dark [GTK2/3/4] .:d;.':;. Icons: Flat-Remix-Blue-Dark [GTK2/3/4] 'd, .' Font: Cantarell (11pt) [GTK2/3/4] ;l .. Cursor: Adwaita (24px) .o Terminal: qterminal 1.4.0 c Terminal Font: FiraCode (10pt) .' CPU: AMD Ryzen 5 5600H (12) @ 4.28 GHz . GPU 1: NVIDIA GeForce GTX 1650 Mobile / Max-Q [Discrete] GPU 2: AMD Radeon Vega Series / Radeon Vega Mobile Series @ 0.40 GHz [Integrated] Memory: 10.17 GiB / 58.72 GiB (17%) Swap: 0 B / 976.00 MiB (0%) Disk (/): 32.72 GiB / 196.69 GiB (17%) - ext4 Disk (/home): 384.75 GiB / 491.08 GiB (78%) - ext4 Disk (/opt/Steam): 1.14 TiB / 1.48 TiB (77%) - ext4 Disk (/opt/VirtualMachines): 245.45 GiB / 294.23 GiB (83%) - ext4 Disk (/tmp): 18.69 MiB / 1.79 GiB (1%) - ext4 Disk (/var): 19.19 GiB / 38.59 GiB (50%) - ext4 Local IP (eth0): 192.168.1.114/24 * Battery: 100% [AC Connected] Locale: en_US.UTF-8 ████████████████████████ ████████████████████████ ```

tytan652 commented 2 months ago

Your issue is about a third-party plugin.

fritz-fritz commented 2 months ago

Yes... as I said. A third party plugin that has/had been planned to be merged with the project #6207 . I wasn't sure if the code had been implemented outside the stale pull request. But regardless... it seemed like the OBS devs had gotten involved with it and hence I filed it here.

Perhaps the plugin is no longer planned to be merged and I should file there?

tiberium-v commented 2 months ago

@fritz-fritz The plugin is active developed. The dev is also active in the github issues: https://github.com/dimtpap/obs-pipewire-audio-capture

The reason the PR here is stalled, is because of the "dependency" of flatpak. There is no Audio Portal at the moment and for the plugin to use under flatpak, you have to make a hole in the permission design of flatpak, as the plugin readme on github describe. Until the adaption of a future audio portal, it will not native implemented.

derrod commented 2 months ago

Yes... as I said. A third party plugin that has/had been planned to be merged with the project #6207 . I wasn't sure if the code had been implemented outside the stale pull request. But regardless... it seemed like the OBS devs had gotten involved with it and hence I filed it here.

A PR existing does not mean it is planned to be merged, merely that the author wishes for it to be included. OBS contributors providing review and guidance does not mean that we as the project accept any responsibility for the code or feature in question. Any issues with unmerged PRs should be either filed on the downstream repository, or left as comments on the PR itself if relevant.

fritz-fritz commented 2 months ago

Thanks @tiberium-v

I just found the closed issue dimtpap/obs-pipewire-audio-capture/issues/55 at his repo that sounds like my issue. Pulled the latest to see if it allows me to switch my setup back. It did fix it for me. Sorry for wasting your time.

@derrod I am aware of how pull requests work. The implications of the conversation on that pull request was that it was good to be merged once other work was completed. Fair?

All in all... this should remain closed.