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
60.35k stars 7.99k forks source link

Screen Capture Only Works On First Startup of The Graphical Session #10148

Closed mcmah309 closed 9 months ago

mcmah309 commented 9 months ago

Operating System Info

Other

Other OS

Nixos Linux

OBS Studio Version

30.0.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/yUBLE9aYw5R1O5Eo

OBS Studio Crash Log URL

No response

Expected Behavior

Every time I create a new screen capture source it should work.

Current Behavior

When I start up OBS for the first time for a graphical user session, screen capturing works as I would expect. If delete the screen capture source and try to recreate, or exit and start the OBS application again, all screen captures are a black screen.

Steps to Reproduce

In the attached OBS logs, I started OBS and screen capture works as expected, then I delete the source and recreate it and it is a black screen. The only fix is to log out of the graphical session and log back in.

Anything else we should know?

I am running hyprland/wayland.

Changing video encoder to "software" has no effect.

This happens on the Nixos OBS package or the OBS flatpak. The logs are from the OBS flatpak

The issue persists if I run with XWayland as well env -u WAYLAND_DISPLAY flatpak run com.obsproject.Studio. Screen capture with XWayland and using XSHM instead of pipewire will show the cursor, but the screen is still black.

tytan652 commented 9 months ago

There is a high chance that the issue is on the portal side sending a broken PipeWire stream.

Since you are using Hyprland, you should be using xdg-desktop-portal-hyprland to get a ScreenCast portal implementation and not xdg-desktop-portal-wlr.

For now I will just ask if you are actually using xdg-desktop-portal-hyprland and maybe check its issue tracker. If you are using xdg-desktop-portal-wlr, switch to xdg-desktop-portal-hyprland.

mcmah309 commented 9 months ago

Yes I am using xdg-desktop-portal-hyprland

henry@nixos:~$ ps aux | grep "xdg-desktop-portal"
henry     202759  0.0  0.0 523960  5888 ?        Ssl  18:09   0:00 /nix/store/ql1paja8kn5ff3lg092x89hms5h47iw4-xdg-desktop-portal-1.18.2/libexec/xdg-permission-store
henry     203487  0.0  0.0 705808 17920 ?        Ssl  18:09   0:00 /nix/store/ql1paja8kn5ff3lg092x89hms5h47iw4-xdg-desktop-portal-1.18.2/libexec/xdg-desktop-portal
henry     203492  0.0  0.0 747720  6656 ?        Ssl  18:09   0:00 /nix/store/ql1paja8kn5ff3lg092x89hms5h47iw4-xdg-desktop-portal-1.18.2/libexec/xdg-document-portal
henry     203501  0.0  0.0 634908 27392 ?        Ssl  18:09   0:00 /nix/store/gfxwh0qa90nxb7ksmksm8k60hkbzl117-xdg-desktop-portal-gtk-1.15.1/libexec/xdg-desktop-portal-gtk
henry     203522  125  0.0 2193016 59136 ?       Rsl  18:09   9:23 /nix/store/2nw5d89wa4md32k8flsiw9s2y8sachnn-xdg-desktop-portal-hyprland-1.2.6/libexec/xdg-desktop-portal-hyprland
henry     206663  0.0  0.0 222720  2560 pts/3    S+   18:16   0:00 grep xdg-desktop-portal

I did find that there is a broken pipe when trying to recreate the source

from journalctl

Logs during OBS startup and before new source

Jan 26 18:10:00 nixos dbus-daemon[202730]: [session uid=1000 pid=202730] Activating via systemd: service name='org.freedesktop.Flatpak' unit='flatpak-session-helper.service' requested by ':1.19' (uid=1000 pid=203>
Jan 26 18:10:00 nixos systemd[2184]: Starting flatpak session helper...
Jan 26 18:10:00 nixos dbus-daemon[202730]: [session uid=1000 pid=202730] Successfully activated service 'org.freedesktop.Flatpak'
Jan 26 18:10:00 nixos systemd[2184]: Started flatpak session helper.
Jan 26 18:10:00 nixos systemd[2184]: Started app-flatpak-com.obsproject.Studio-203788.scope.
Jan 26 18:10:00 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:00 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:00 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] Initializing xdph...
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] XDG_CURRENT_DESKTOP set to Hyprland
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] Gathering exported interfaces
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_shm (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_drm (ver 2)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_linux_dmabuf_v1 (ver 4)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_compositor (ver 6)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_subcompositor (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_data_device_manager (ver 3)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_export_dmabuf_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_data_control_manager_v1 (ver 2)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_primary_selection_device_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_viewporter (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_gamma_control_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_output_power_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: xdg_wm_base (ver 5)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_seat (ver 8)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_presentation (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: ext_idle_notifier_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_layer_shell_v1 (ver 4)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: org_kde_kwin_server_decoration_manager (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zxdg_decoration_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_output_manager_v1 (ver 4)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_keyboard_shortcuts_inhibit_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_pointer_constraints_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_relative_pointer_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_virtual_keyboard_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_virtual_pointer_manager_v1 (ver 2)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_foreign_toplevel_manager_v1 (ver 3)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_drm_lease_device_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_drm_lease_device_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_tablet_manager_v2 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_idle_inhibit_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zxdg_exporter_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zxdg_importer_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zxdg_exporter_v2 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zxdg_importer_v2 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_pointer_gestures_v1 (ver 3)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_text_input_manager_v3 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_input_method_manager_v2 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: xdg_activation_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: ext_session_lock_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_cursor_shape_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_tearing_control_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_single_pixel_buffer_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: xwayland_shell_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: hyprland_toplevel_export_manager_v1 (ver 2)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wp_fractional_scale_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwp_text_input_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: hyprland_global_shortcuts_manager_v1 (ver 1)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [globalshortcuts] registered
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zwlr_screencopy_manager_v1 (ver 3)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [pipewire] connected
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] init successful
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: zxdg_output_manager_v1 (ver 3)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_output (ver 4)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG]  | Got interface: wl_output (ver 4)
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] Registered for toplevel export
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [WARN] grim not found. Screenshots will not work.
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [core] dmabufFeedbackMainDevice
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] Found output name eDP-1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] Found output name DP-1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [toplevel] (activate) locks: 1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [toplevel] Activated, bound to 2026290, toplevels: 1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] New session:
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy]  | /org/freedesktop/portal/desktop/request/1_22/obs1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy]  | /org/freedesktop/portal/desktop/session/1_22/obs1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy]  | appid: com.obsproject.Studio
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] SelectSources:
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy]  | /org/freedesktop/portal/desktop/request/1_22/obs2
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy]  | /org/freedesktop/portal/desktop/session/1_22/obs1
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy]  | appid: com.obsproject.Studio
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] option cursor_mode to 2
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] option persist_mode to 2
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] unused option multiple
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] unused option types
Jan 26 18:10:02 nixos xdg-desktop-portal-hyprland[203522]: [LOG] [screencopy] restore data invalid / missing, prompting
Jan 26 18:10:02 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:02 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:02 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
Jan 26 18:10:02 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:02 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:02 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
Jan 26 18:10:05 nixos wireplumber[202735]: <WpPortalPermissionStorePlugin:0x521c60> Failed to call Lookup: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for camera

Logs after new source

Jan 26 18:10:17 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:17 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:17 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiStandardLink:0x54fed0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiStandardLink:0x8a06d0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiStandardLink:0x8ab630> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiStandardLink:0x8a06d0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiStandardLink:0x8ab630> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiStandardLink:0x8a06d0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:19 nixos wireplumber[202735]: <WpSiNode:0x8ab270> tried to link on last rescan, not retrying
Jan 26 18:10:24 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:24 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:24 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
Jan 26 18:10:25 nixos xdg-desktop-portal-hyprland[203522]: [LOG] execAndGet: WAYLAND_DISPLAY=wayland-1 QT_QPA_PLATFORM="wanot a valid new object id (4278190086), message toplevel(n)
Jan 26 18:10:25 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:25 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:25 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
Jan 26 18:10:26 nixos wireplumber[202735]: <WpPortalPermissionStorePlugin:0x521c60> Failed to call Lookup: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for camera
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiStandardLink:0x54f2a0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiStandardLink:0x8ac040> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiStandardLink:0x8a20b0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiStandardLink:0x79e020> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiStandardLink:0x8a20b0> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiStandardLink:0x550890> 1 of 1 PipeWire links failed to activate
Jan 26 18:10:26 nixos wireplumber[202735]: <WpSiNode:0x7ab360> tried to link on last rescan, not retrying
Jan 26 18:10:30 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: *** BUG ***
Jan 26 18:10:30 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: In pixman_region32_init_rect: Invalid rectangle passed
Jan 26 18:10:30 nixos /nix/store/pfhhm0b4zhl23s8sgvy8r5ynn2kr4zk8-gdm-45.0.1/libexec/gdm-wayland-session[203299]: Set a breakpoint on '_pixman_log_error' to debug
tytan652 commented 9 months ago

Looks like a bug outside of OBS Studio, but on the portal side like I said.

You need to discuss this issue first on NixOS or Hyprland (and/or xdg-desktop-portal-hyprland) bug tracker since it does not look like a OBS Studio bug.