View previous topic :: View next topic |
Author |
Message |
world_is_a_fun n00b
Joined: 02 Apr 2024 Posts: 3
|
Posted: Tue Apr 02, 2024 10:25 pm Post subject: Issues with OBS and pipewire not emulating pulseaudio server |
|
|
This is a bit of a rabbithole (at least, for my inexperienced self). My original goal was to record videos locally using OBS Studio. I have had various problems with the software, but the specific one I'm aiming to solve first involves audio. OBS Studio requires pulse audio according to the support I received in their discord (then why does it have a pipewire useflag?), however I use pipewire. Checking my obs logfile, it was discovered that it could not get any information on the pulseaudio server and was using alsa instead. This led me to recheck my pipewire setup to confirm the pulseaudio server emulation was working, however I instead found problems.
When running
Code: | user$ LANG=C pactl info | grep "Server Name" |
the output is (and the same for running as root):
Code: | Connection failure: Connection refused
pa_context_connect() failed: Connection refused |
I'm not sure what information is needed to help figure out what the issue is here (and hopefully fixing this also fixes my obs audio problems too). It should be noted that obs is the only application which has audio problems on my system. Here is some things that seem relevant:
.xinitrc
Code: |
#!/bin/sh
# Option 1: Launch with a dbus session
exec dbus-launch --exit-with-session i3
# Option 2: launch without dbus
#exec i3
|
snippet of i3 config file where the launcher is launched
Code: |
# pipewire
exec_always gentoo-pipewire-launcher &
|
Ive verified that the XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS are set by echoing them (looking at the pipewire wiki entry for reasons why its not working). The former is set by elogind (im pretty sure).
various ebuilds that seem like they might be relevant
Code: |
[ebuild R ] media-libs/alsa-lib-1.2.10-r2::gentoo USE="-alisp -debug -doc -python" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 0 KiB
[ebuild R ] media-sound/pulseaudio-16.1::gentoo USE="bluetooth glib -daemon -jack -ofono-headset" ABI_X86="(64) -32 (-x32)" 0 KiB
[ebuild R ] sys-auth/elogind-246.10-r3::gentoo USE="acl cgroup-hybrid pam policykit -audit -debug -doc (-selinux) -test" 0 KiB
[ebuild R ] sys-apps/dbus-1.15.8::gentoo USE="X elogind -debug -doc (-selinux) -static-libs -systemd -test -valgrind" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild R ] media-video/pipewire-1.0.3:0/0.4::gentoo USE="X bluetooth dbus jack-sdk pipewire-alsa readline sound-server ssl v4l -doc -echo-cancel -extra -ffmpeg -flatpak -gsettings -gstreamer -ieee1394 -jack-client -liblc3 -lv2 -man -modemmanager -roc (-selinux) (-system-service) -systemd -test -zeroconf" ABI_X86="(64) -32 (-x32)" 0 KiB
[ebuild R ~] media-video/obs-studio-30.1.0::gentoo USE="alsa pipewire pulseaudio python speex ssl v4l -browser -decklink -fdk -jack -lua (-mpegts) -nvenc -qsv -test -truetype -vlc -wayland -websocket" LUA_SINGLE_TARGET="luajit" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12" 0 KiB
|
It may also be worth mentioning that Im a little behind on my kernel updates. I havent had the time lately to sit down and rebuild my kernel. When I installed I used the general kernel. |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 451 Location: Naarm/Melbourne, Australia
|
Posted: Wed Apr 03, 2024 5:35 am Post subject: |
|
|
Can you confirm, e.g. by running:
that there's a distinct PipeWire process making use of pipewire-pulse.conf, e.g.:
Code: | 2817 /usr/bin/pipewire -c pipewire-pulse.conf |
`gentoo-pipewire-launcher` attempts to start such a process, but startup might have been unsuccessful for some reason (or startup was successful, but the process has since fallen over). |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2730 Location: Here and Away Again
|
Posted: Wed Apr 03, 2024 5:58 am Post subject: |
|
|
When I added USE="pipewire", I had not been using PipeWire or PulseAudio really myself, only ALSA (which works just fine with OBS Studio, though of course depends on one's needs if it works for them).
As I've been looking into actually testing it and figuring it out, I've come to learn that it is for screen capture only, and only(?) on Wayland, so USE="screencast" might have been better for the current functionality.
I'm actually in the process of sorting it out now (again) myself...
I don't think it has been documented well upstream, or at all, and it is getting more confusing now that they are adding video capture (camera etc.) via PipeWire as well, and audio things are on their way too, yet there are no proper CMake switches for them (or at least for the latest release, there is just the one for PipeWire, and then some automagic to enable camera support).
That said, I would think that using PipeWire, as we have it, in place of PulseAudio should probably work too, but I'm quite unsure at this time.
Somewhat related, though it's about the video side:
- OBSstudio: No creen capture device for pipewire XSHM only _________________ Kindest of regardses. |
|
Back to top |
|
|
world_is_a_fun n00b
Joined: 02 Apr 2024 Posts: 3
|
Posted: Wed Apr 03, 2024 8:41 pm Post subject: |
|
|
flexibeast wrote: | Can you confirm, e.g. by running:
that there's a distinct PipeWire process making use of pipewire-pulse.conf, e.g.:
Code: | 2817 /usr/bin/pipewire -c pipewire-pulse.conf |
`gentoo-pipewire-launcher` attempts to start such a process, but startup might have been unsuccessful for some reason (or startup was successful, but the process has since fallen over). |
pgrep -a wire
Code: |
3425 /usr/bin/wireplumber
3444 /usr/bin/pipewire
3449 /usr/bin/pipewire -c pipewire-pulse.conf
|
looks like there is.
Chiitoo wrote: |
When I added USE="pipewire", I had not been using PipeWire or PulseAudio really myself, only ALSA (which works just fine with OBS Studio, though of course depends on one's needs if it works for them).
As I've been looking into actually testing it and figuring it out, I've come to learn that it is for screen capture only, and only(?) on Wayland, so USE="screencast" might have been better for the current functionality.
I'm actually in the process of sorting it out now (again) myself...
I don't think it has been documented well upstream, or at all, and it is getting more confusing now that they are adding video capture (camera etc.) via PipeWire as well, and audio things are on their way too, yet there are no proper CMake switches for them (or at least for the latest release, there is just the one for PipeWire, and then some automagic to enable camera support).
That said, I would think that using PipeWire, as we have it, in place of PulseAudio should probably work too, but I'm quite unsure at this time.
Somewhat related, though it's about the video side:
- OBSstudio: No creen capture device for pipewire XSHM only |
Alsa works for microphone input, but not capturing desktop audio at all. I have discovered something that has me quite puzzled though. I use the strategy for sandboxing described here, and have one such sandbox set up for steam. I downloaded OBS on steam to see if that version would work (it did not, it wont run in proton and the steam version only works on MacOS and Windows for some reason), and in frustration, ran sudo -u sandbox-user obs, only to discover that without changing any configurations with my sound setup obs suddenly works. I swtich back to my primary user, and nope! still broken. The alsa input capture doesnt work, but thats likely because when I discovered this it was captured by a virtual machine, and I havent done a proper thorough test. I have no idea why it would be working for the steam sandbox user but not the regular user, and I'm very curious to find out why |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2730 Location: Here and Away Again
|
Posted: Thu Apr 04, 2024 11:27 am Post subject: |
|
|
Yeah, if the hardware can not record desktop audio, then a loopback device is needed for ALSA.
Something like this for example:
Code: |
pcm.!default
{
type asym
playback.pcm "generic"
#playback.pcm "correctedSurround"
playback.pcm "loopAndReal"
capture.pcm "loopRecord"
#capture.pcm "usbii"
hint
{
show on
}
}
pcm.correctedSurround
{
type plug
slave.pcm "loopAndReal"
#slave.pcm "xonarer"
ttable
{
0.0 1 # Front Left
1.1 1 # Front Right
2.0 0.5 # Rear Left
3.1 0.5 # Rear Right
4.0 1 # Front Center
4.1 1 # Front Center
5.0 0.5 # Rear Center
5.1 0.5 # Rear Center
}
hint
{
show on
}
}
pcm.loopRecord
{
type hw
card "Loopback"
#card "hw:0"
device 1
subdevice 0
}
pcm.loopAndReal
{
type plug
slave.pcm "binder"
route_policy "duplicate"
}
pcm.binder
{
type multi
slaves.a.pcm "generic"
slaves.a.channels 2
slaves.b.pcm "looper"
slaves.b.channels 2
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave b
bindings.2.channel 0
bindings.3.slave b
bindings.3.channel 1
}
pcm.looper
{
type dmix
ipc_key 1024
ipc_key_add_uid 0
ipc_perm 0666
slave
{
pcm "hw:Loopback,0,0"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
period_size 2048
#buffer_time 0
buffer_size 8192
#buffer_size 16384
#format s16_le
#format s32_le
}
}
pcm.generic
{
type dmix
ipc_key 1028
ipc_key_add_uid 0
ipc_perm 0666
slave
{
pcm "hw:0"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
period_size 2048
#buffer_time 0
buffer_size 8192
#buffer_size 16384
#format s16_le
#format s32_le
}
}
pcm.usbiii
{
type dsnoop
ipc_key 1032
ipc_key_add_uid 0
ipc_perm 0666
hint
{
show on
}
slave
{
pcm "U0x46d0x81b"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
#buffer_time 0
#buffer_size 8192
#buffer_size 16384
#format s16_le
}
}
pcm.line
{
type dsnoop
ipc_key 1036
ipc_key_add_uid 0
ipc_perm 0666
slave
{
pcm "hw:0"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
#buffer_time 0
#buffer_size 8192
#buffer_size 16384
#format s16_le
}
}
|
Not all of that is relevant to loopback, but you might get the idea (and perhaps other ideas).
Hrm, no immediate ideas come to me regarding the sandbox thing... _________________ Kindest of regardses. |
|
Back to top |
|
|
world_is_a_fun n00b
Joined: 02 Apr 2024 Posts: 3
|
Posted: Fri Apr 05, 2024 3:31 am Post subject: |
|
|
Chiitoo wrote: | Yeah, if the hardware can not record desktop audio, then a loopback device is needed for ALSA.
Something like this for example:
Code: |
pcm.!default
{
type asym
playback.pcm "generic"
#playback.pcm "correctedSurround"
playback.pcm "loopAndReal"
capture.pcm "loopRecord"
#capture.pcm "usbii"
hint
{
show on
}
}
pcm.correctedSurround
{
type plug
slave.pcm "loopAndReal"
#slave.pcm "xonarer"
ttable
{
0.0 1 # Front Left
1.1 1 # Front Right
2.0 0.5 # Rear Left
3.1 0.5 # Rear Right
4.0 1 # Front Center
4.1 1 # Front Center
5.0 0.5 # Rear Center
5.1 0.5 # Rear Center
}
hint
{
show on
}
}
pcm.loopRecord
{
type hw
card "Loopback"
#card "hw:0"
device 1
subdevice 0
}
pcm.loopAndReal
{
type plug
slave.pcm "binder"
route_policy "duplicate"
}
pcm.binder
{
type multi
slaves.a.pcm "generic"
slaves.a.channels 2
slaves.b.pcm "looper"
slaves.b.channels 2
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave b
bindings.2.channel 0
bindings.3.slave b
bindings.3.channel 1
}
pcm.looper
{
type dmix
ipc_key 1024
ipc_key_add_uid 0
ipc_perm 0666
slave
{
pcm "hw:Loopback,0,0"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
period_size 2048
#buffer_time 0
buffer_size 8192
#buffer_size 16384
#format s16_le
#format s32_le
}
}
pcm.generic
{
type dmix
ipc_key 1028
ipc_key_add_uid 0
ipc_perm 0666
slave
{
pcm "hw:0"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
period_size 2048
#buffer_time 0
buffer_size 8192
#buffer_size 16384
#format s16_le
#format s32_le
}
}
pcm.usbiii
{
type dsnoop
ipc_key 1032
ipc_key_add_uid 0
ipc_perm 0666
hint
{
show on
}
slave
{
pcm "U0x46d0x81b"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
#buffer_time 0
#buffer_size 8192
#buffer_size 16384
#format s16_le
}
}
pcm.line
{
type dsnoop
ipc_key 1036
ipc_key_add_uid 0
ipc_perm 0666
slave
{
pcm "hw:0"
rate 48000 # 44100, 48000, 96000 etc.
#periods 2
#period_time 0
#period_size 1024
#buffer_time 0
#buffer_size 8192
#buffer_size 16384
#format s16_le
}
}
|
Not all of that is relevant to loopback, but you might get the idea (and perhaps other ideas).
Hrm, no immediate ideas come to me regarding the sandbox thing... |
Well, for now it is a working fix to just use obs as the sandbox user. When I have the time I can try digging around in the configs to see if there is somehow something different about the local config of my user, or of the sandbox user. My thinking is that there must be something about the two which is different in configuration. |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2730 Location: Here and Away Again
|
Posted: Fri Apr 05, 2024 4:10 am Post subject: |
|
|
It does make me think of some kind of a permission issue, but as I'm not familiar with anything other than plain ALSA, I'm not sure.
I think I need to use a different machine to really exepiment with the PulseAudio and PipeWire things, as some of them seem to possibly reguire at least elogind and friends, which I don't have here.
I do have virtual machines, but they have their own quirks... _________________ Kindest of regardses. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|