snapcrafters / obs-studio

This is a community-supported modified build of OBS Studio.
https://snapcraft.io/obs-studio
118 stars 35 forks source link

[Bug]: Crash when using more than one pipewire source #166

Closed Ayowel closed 11 months ago

Ayowel commented 2 years ago

What happened?

Obs craches when attempting to use more that one pipewire source (Screen or window capture). The crash occurs at the moment the new pipewire source is selected in the menu after adding the source to the scene.

Note that this might be a linux-related pipewire issue and not a snap issue.

What should have happened?

The new source should become visible in OBS' preview

Output of snap info $snap_name

name:      obs-studio
summary:   Free and open source software for live streaming and screen recording
publisher: Snapcrafters
store-url: https://snapcraft.io/obs-studio
contact:   https://github.com/snapcrafters/obs-studio/issues
license:   GPL-2.0
description: |
  OBS Studio is software designed for capturing, compositing, encoding, recording, and streaming
  video content, efficiently. _This is a community-supported modified build of OBS Studio; please
  file issues on the Snapcrafters GitHub:_ https://github.com/snapcrafters/obs-studio/issues

  **Batteries included**

  The snap of OBS studio comes pre-loaded with some extra features:

    * Supports **nvenc (NVIDIA) and VA-API (AMD & Intel) accelerated video encoding**.
    * **Advanced Scene Switcher** plugin; an automated scene switcher
    * **Browser** plugin; CEF-based OBS Studio browser plugin
    * **Directory Watch Media** plugin; filter you can add to a media source to load the oldest or
    newest file in a directory.
    * **Dynamic Delay** plugin; filter for dynamic delaying a video source.
    * **Freeze Filter** plugin; freeze a source using a filter.
    * **gPhoto** plugin; connect DSLR cameras with obs-studio via gPhoto.
    * **GStreamer** plugins; feed GStreamer launch pipelines into OBS Studio and use GStreamer
    encoder elements.
    * **Move Transition** plugin; move sources to a new position during a scene transition.
    * **NDI** plugin; Network A/V via NewTek's NDI.
    * **NvFBC** plugin; screen capture via NVIDIA FBC API. Requires NvFBC patches for Nvidia drivers
    for consumer-grade GPUs.
    * **RGB Levels** plugin; simple filter to adjust RGB levels.
    * **Source Switcher** plugin; to switch between a list of sources.
    * **Spectralizer** plugin; audio visualization using fftw.
    * **StreamFX** plugin; collection modern effects filters and transitions.
    * **Text Pango** plugin; Provides a text source rendered using Pango with multi-language
    support, emoji support, vertical rendering and RTL support.
    * **Transition Matrix** plugin; customize Any -> One or One -> One scene transitions.
    * **VNC Source** plugin; VNC viewer that works as a source.
    * **Websockets** plugin; remote-control OBS Studio through WebSockets.

  **Connecting Interfaces**

  For the best experience, you'll want to connect the following interfaces.

     sudo snap connect obs-studio:alsa
     sudo snap connect obs-studio:audio-record
     sudo snap connect obs-studio:avahi-control
     sudo snap connect obs-studio:camera
     sudo snap connect obs-studio:jack1
     sudo snap connect obs-studio:kernel-module-observe

  **NDI**

  If you want to use the NDI plugin you'll need to connect the Avahi Control interface.

     snap connect obs-studio:avahi-control

  **Virtual Camera**

  Starting with OBS 26.1.0, Virtual Camera support is integrated. Here's how to install and
  configure `v4l2loopback`:

     sudo snap connect obs-studio:kernel-module-observe
     sudo apt -y install v4l2loopback-dkms v4l2loopback-utils
     echo "options v4l2loopback devices=1 video_nr=13 card_label='OBS Virtual Camera'   
     exclusive_caps=1" | sudo tee /etc/modprobe.d/v4l2loopback.conf
     echo "v4l2loopback" | sudo tee /etc/modules-load.d/v4l2loopback.conf
     sudo modprobe -r v4l2loopback
     sudo modprobe v4l2loopback devices=1 video_nr=13 card_label='OBS Virtual Camera'
     exclusive_caps=1

  **NOTE!** Using `video_nr` greater than 64 will not work.

  **Removable Storage**

  To access content on external storage, connect to the removable-media plug:

     snap connect obs-studio:removable-media

  **gPhoto**

  The gPhoto plugin allows some DSLR cameras to be connected via USB. You'll need to connect the Raw
  USB interface.

     snap connect obs-studio:raw-usb

  **3rd Party plugins**

  To install pre-compiled plugins, download and extract the plugin to
  `~/snap/obs-studio/current/.config/obs-studio/plugins/`.

  This is how the Input Overlay plugin looks when correctly installed:

     /home/username/snap/obs-studio/current/.config/obs-studio/plugins/
     └── input-overlay
         ├── bin
         │   └── 64bit
         │       └── input-overlay.so
         └── data
             └── locale
                 ├── de-DE.ini
                 ├── en-US.ini
                 └── ru-RU.ini

  If you want to use the Input Overlay plugin, you'll also need to connect the joystick interface:

     snap connect obs-studio:joystick
commands:
  - obs-studio.eglinfo
  - obs-studio.ffmpeg
  - obs-studio.ffplay
  - obs-studio.ffprobe
  - obs-studio.glxinfo
  - obs-studio
  - obs-studio.srt-ffplay
  - obs-studio.srt-file-transmit
  - obs-studio.srt-live-transmit
  - obs-studio.srt-tunnel
  - obs-studio.vainfo
  - obs-studio.vdpauinfo
  - obs-studio.vulkaninfo
snap-id:      6uLU2MJmBURfLNz4rmL4WT2CmtVULE2u
tracking:     latest/stable
refresh-date: 2022-07-29
channels:
  latest/stable:    27.1.3 2021-12-20 (1284) 418MB -
  latest/candidate: ↑                              
  latest/beta:      ↑                              
  latest/edge:      27.2.1 2022-02-24 (1287) 439MB -
installed:          27.1.3            (1284) 418MB -

Output of snap connections $snap_name

Interface                 Plug                                 Slot                            Notes
alsa                      obs-studio:alsa                      :alsa                           manual
audio-playback            obs-studio:audio-playback            :audio-playback                 -
audio-record              obs-studio:audio-record              :audio-record                   -
avahi-control             obs-studio:avahi-control             :avahi-control                  manual
browser-support           obs-studio:browser-support           :browser-support                -
camera                    obs-studio:camera                    :camera                         -
content[gtk-3-themes]     obs-studio:gtk-3-themes              gtk-common-themes:gtk-3-themes  -
content[icon-themes]      obs-studio:icon-themes               gtk-common-themes:icon-themes   -
content[sound-themes]     obs-studio:sound-themes              gtk-common-themes:sound-themes  -
desktop                   obs-studio:desktop                   :desktop                        -
desktop-legacy            obs-studio:desktop-legacy            :desktop-legacy                 -
gsettings                 obs-studio:gsettings                 :gsettings                      -
hardware-observe          obs-studio:hardware-observe          -                               -
home                      obs-studio:home                      :home                           -
jack1                     obs-studio:jack1                     :jack1                          manual
joystick                  obs-studio:joystick                  :joystick                       manual
kernel-module-observe     obs-studio:kernel-module-observe     :kernel-module-observe          manual
network                   obs-studio:network                   :network                        -
network-bind              obs-studio:network-bind              :network-bind                   -
opengl                    obs-studio:opengl                    :opengl                         -
password-manager-service  obs-studio:password-manager-service  -                               -
process-control           obs-studio:process-control           :process-control                manual
pulseaudio                obs-studio:pulseaudio                :pulseaudio                     -
raw-usb                   obs-studio:raw-usb                   :raw-usb                        manual
removable-media           obs-studio:removable-media           -                               -
screen-inhibit-control    obs-studio:screen-inhibit-control    :screen-inhibit-control         -
screencast-legacy         obs-studio:screencast-legacy         :screencast-legacy              manual
system-observe            obs-studio:system-observe            -                               -
unity7                    obs-studio:unity7                    :unity7                         -
upower-observe            obs-studio:upower-observe            :upower-observe                 -
wayland                   obs-studio:wayland                   :wayland                        -
x11                       obs-studio:x11                       :x11                            -

Output of snap version

snap    2.57.2
snapd   2.57.2
series  16
ubuntu  22.04
kernel  5.15.0-48-generic

Relevant log output

# /var/log/syslog, nothing in kernel logs
Oct  3 17:35:08 CoreWorkstation obs-studio_obs-studio.desktop[472662]: info: [pipewire] desktop selected, setting up screencast
Oct  3 17:35:08 CoreWorkstation obs-studio_obs-studio.desktop[472662]: [W][21380.829371][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
Oct  3 17:35:08 CoreWorkstation obs-studio_obs-studio.desktop[472662]: [W][21380.829394][  module-rtkit.c:  456 set_nice()] could not set nice-level to -11: Permission denied
Oct  3 17:35:08 CoreWorkstation obs-studio_obs-studio.desktop[472662]: [W][21380.829492][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
Oct  3 17:35:08 CoreWorkstation obs-studio_obs-studio.desktop[472662]: [E][21380.829627][module-protocol-:  609 lock_socket()] server 0x5643552ee210: unable to lock lockfile '/run/user/1000/snap.obs-studio/pipewire-0.lock': Resource temporarily unavailable (maybe another daemon is running)
Oct  3 17:35:08 CoreWorkstation obs-studio_obs-studio.desktop[472662]: [E][21380.829655][          conf.c:  332 load_module()] config 0x564355252fb0: could not load mandatory module "libpipewire-module-protocol-native": Resource temporarily unavailable
Oct  3 17:35:08 CoreWorkstation systemd[3020]: snap.obs-studio.obs-studio.85523d08-ca62-4414-b9ec-7e0c46ba9080.scope: Consumed 38.225s CPU time.

Teminal output of app

qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
info: [pipewire] screencast session created
Attempted path: share/obs/obs-studio/images/overflow.png
Attempted path: /usr/share/obs/obs-studio/images/overflow.png
info: [pipewire] asking for desktop…
info: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds (source: Mic/Aux)

info: [pipewire] desktop selected, setting up screencast
[W][22589.602031][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
[W][22589.602039][  module-rtkit.c:  456 set_nice()] could not set nice-level to -11: Permission denied
[W][22589.602114][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
[W][22589.604421][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
[W][22589.604492][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
[W][22589.604496][  module-rtkit.c:  629 impl_acquire_rt()] could not make thread realtime: Permission denied
info: [pipewire] created stream 0x558019f87960
info: [pipewire] playing stream…
info: [pipewire] available cursor modes:
info: [pipewire]     - Metadata
info: [pipewire]     - Always visible
info: [pipewire]     - Hidden
info: PipeWire initialized (sender name: 1_4796)
info: User added source 'Window Capture (PipeWire)' (pipewire-window-capture-source) to scene 'Scene_dev'
info: [pipewire] screencast session created
info: [pipewire] asking for window…
info: [pipewire] window selected, setting up screencast
[W][22604.921985][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
[W][22604.921995][  module-rtkit.c:  456 set_nice()] could not set nice-level to -11: Permission denied
[W][22604.922072][  module-rtkit.c:  196 translate_error()] RTKit error: org.freedesktop.DBus.Error.AccessDenied
[E][22604.922159][module-protocol-:  609 lock_socket()] server 0x55801cbd9070: unable to lock lockfile '/run/user/1000/snap.obs-studio/pipewire-0.lock': Resource temporarily unavailable (maybe another daemon is running)
[E][22604.922195][          conf.c:  332 load_module()] config 0x55801b33f080: could not load mandatory module "libpipewire-module-protocol-native": Resource temporarily unavailable
Segmentation fault (core dumped)
neutrino82 commented 1 year ago

I experience the same bug. Seem the same as the one reported here https://github.com/obsproject/obs-studio/issues/7210 . It seems it have been fixed upstream but (maybe) the fix did not come to the snap version.

neutrino82 commented 1 year ago

After a bit more of testing it seems that the same bug is also present in the edge version of the snap package (v 27.2.1). As an effective solution I installed the latest ppa package as reported on the official obs siteand it seems to work fine. At the moment the default version shipped in the ubuntu-universe report fails to start (crashes on startup) in the wayland session so I did not test it.

flexiondotorg commented 11 months ago

Fixed via #172, which updates OBS to 29.1.3 and includes Pipewire audio capture plugin that can handle multiple audio sources and application-specific audio capture.