hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.28k stars 897 forks source link

Major stuttering while recording games in OBS. #7517

Open EnderMaster77 opened 2 months ago

EnderMaster77 commented 2 months ago

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 9a09eac79b85c846e3a865a9078a3f8ff65a9259 (props: bump version to 0.42.0). Date: Wed Aug 7 19:17:10 2024 Tag: v0.42.0, commits: 5069 flags: (if any) System Information: System name: Linux Node name: archgdv2 Release: 6.10.6-zen1-1-zen Version: #1 ZEN SMP PREEMPT_DYNAMIC Mon, 19 Aug 2024 17:02:05 +0000 GPU information: 04:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK208B [GeForce GT 710] [10de:128b] (rev a1) (prog-if 00 [VGA controller]) 2b:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU116 [GeForce GTX 1650 SUPER] [10de:2187] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 560.35.03 Release Build (archlinux-builder@) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ❯ hyprctl systeminfo -c Hyprland, built from branch at commit 9a09eac79b85c846e3a865a9078a3f8ff65a9259 (props: bump version to 0.42.0). Date: Wed Aug 7 19:17:10 2024 Tag: v0.42.0, commits: 5069 flags: (if any) System Information: System name: Linux Node name: archgdv2 Release: 6.10.6-zen1-1-zen Version: #1 ZEN SMP PREEMPT_DYNAMIC Mon, 19 Aug 2024 17:02:05 +0000 GPU information: 04:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK208B [GeForce GT 710] [10de:128b] (rev a1) (prog-if 00 [VGA controller]) 2b:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU116 [GeForce GTX 1650 SUPER] [10de:2187] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 560.35.03 Release Build (archlinux-builder@) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ======Config-Start====== Config File: /home/ender/.config/hypr/hyprland.conf: Read Succeeded # Setup monitors # See https://wiki.hyprland.org/Configuring/Monitors/ #monitor=,preferred,auto,auto monitor=HDMI-A-1,1920x1080@143.98Hz, 1x0, 1 monitor=DP-1,1920x1080@60.00Hz,1921x0,1 #monitor=DVI-D-1,3840x2160@60.00000Hz,0x-2160,1 #monitor=DVI-D-1,3840x2160@30.00Hz,0x0,2 # Dual monitor example on G15 Strix # eDP-1 is the built in monitor while DP-1 is external # Both monitors here are at 1440 and 165Hz # DP-1 is on the left and eDP-1 is on the right #monitor=DP-1,2560x1440@165,0x0,1 #monitor=eDP-1,2560x1440@165,2560x0,1 # See https://wiki.hyprland.org/Configuring/Keywords/ for more # Execute your favorite apps at launch exec-once = xrandr --output HDMI-A-1 --primary exec-once = ~/.config/hypr/xdg-portal-hyprland exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once = swww-daemon exec-once = waybar exec-once = mako exec-once = keepassxc exec = virsh net-start default exec = /usr/bin/kdeconnectd exec-once = wl-gammarelay-rs exec-once = openrgb --startminimized exec = swww img ~/.config/HyprV/backgrounds/v1-background-dark.jpg exec-once = blueman-applet exec-once = nm-applet --indicator exec-once = wl-paste --watch cliphist store exec = gsettings set org.gnome.desktop.interface icon-theme "Dracula" exec = gsettings set org.gnome.desktop.interface gtk-theme "Dracula" env = LIBVA_DRIVER_NAME,nvidia env = XDG_SESSION_TYPE,wayland env = GBM_BACKEND,nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME,nvidia env = WLR_NO_HARDWARE_CURSORS,1 env = XCURSOR_SIZE=24 env = _JAVA_AWT_WM_NONREPARENTING=1 env = QT_QPA_PLATFORM=wayland env = QT_QPA_PLATFORMTHEME=qt6ct # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ input { kb_layout = us kb_variant = kb_model = kb_options = kb_rules = follow_mouse = 1 touchpad { natural_scroll = no } sensitivity = 0 # -1.0 - 1.0, 0 means no modification. } general { # See https://wiki.hyprland.org/Configuring/Variables/ for more gaps_in = 5 gaps_out = 10 border_size = 2 #col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg col.active_border=rgb(cdd6f4) col.inactive_border = rgba(595959aa) layout = dwindle } misc { disable_hyprland_logo = yes } decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more #active_opacity = 0.80 #inactive_opacity = 0.75 rounding = 5 blur { enabled = true size = 7 passes = 4 new_optimizations = true } blurls = lockscreen drop_shadow = yes shadow_range = 4 shadow_render_power = 3 col.shadow = rgba(1a1a1aee) } animations { enabled = yes # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more bezier = myBezier, 0.10, 0.9, 0.1, 1.05 animation = windows, 1, 7, myBezier, slide animation = windowsOut, 1, 7, myBezier, slide animation = border, 1, 10, default animation = fade, 1, 7, default animation = workspaces, 1, 6, default } dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainModENTER + P in the keybinds section below preserve_split = yes # you probably want this } master { # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more #new_is_master = true } gestures { # See https://wiki.hyprland.org/Configuring/Variables/ for more workspace_swipe = off } render{ # Enables explicit sync support. explicit_sync = 1 } render:explicit_sync = 1 # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more #device:epic mouse V1 { # sensitivity = -0.5 #} # Example windowrule v1 #windowrule = float, ^(alacritty)$ # # Example windowrule v2 # windowrulev2 = float,class:^(alacritty)$,title:^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # rules below would make the specific app transparent #windowrulev2 = active_opacity 1.0 override 1.0,class:^(aseprite)$ #windowrulev2 = active_opacity 1.0 override 1.0,class:^(libresprite)$ #active_opacity = 0.80 #inactive_opacity = 0.75 #windowrulev2 = opacity 0.75 0.8, class:^()$ windowrulev2 = opacity 0.80 0.75, class:() windowrulev2 = opacity 0.85 0.75, class:(Alacritty) windowrulev2 = opacity 0.85 0.75, class:(Zed) windowrulev2=opacity 1.0 1.0,class:(Aseprite) windowrulev2=tile,class:(Aseprite) windowrulev2=opacity 1.0 1.0,class:(LibreWolf),title:YouTube windowrulev2 = animation popin,class:^(alacritty)$,title:^(update-sys)$ windowrulev2 = animation popin,class:^(thunar)$ windowrulev2 = opacity 0.8 0.8,class:^(thunar)$ windowrulev2 = opacity 0.8 0.8,class:^(VSCodium)$ windowrulev2 = animation popin,class:^(chromium)$ windowrulev2 = move cursor -3% -105%,class:^(wofi)$ windowrulev2 = noanim,class:^(wofi)$ windowrulev2 = opacity 0.8 0.6,class:^(wofi)$ # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER bind= ALT,Up,exec,busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n -500 bind= ALT,Down,exec,busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n +500 bind = $mainMod, K, exec, ~/Scripts/hidewindow.sh # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, RETURN, exec, alacritty #open the terminal bind = $mainMod SHIFT, C, killactive, # close the active window bind = $mainMod, L, exec, swaylock # Lock the screen bind = $mainMod, M, exec, wlogout --protocol layer-shell # show the logout window bind = $mainMod SHIFT, Q, exit, # Exit Hyprland all together no (force quit Hyprland) bind = $mainMod, E, exec, thunar # Show the graphical file browser bind = $mainMod, V, togglefloating, # Allow a window to float bind = $mainMod, P, exec, wofi # Show the graphical app launcher #bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle bind = $mainMod, S, exec, grim -g "$(slurp)" - | swappy -f - # take a screenshot bind = ALT, V, exec, cliphist list | wofi -dmenu | cliphist decode | wl-copy # open clipboard manager #bind = $mainMod, T, exec, ~/.config/HyprV/hyprv_util vswitch # switch HyprV version bind=$mainMod,F,fullscreen # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 11 bind = $mainMod, 2, workspace, 12 bind = $mainMod, 3, workspace, 13 bind = $mainMod, 4, workspace, 14 bind = $mainMod, 5, workspace, 15 bind = $mainMod, 6, workspace, 16 bind = $mainMod, 7, workspace, 17 bind = $mainMod, 8, workspace, 18 bind = $mainMod, 9, workspace, 19 bind = $mainMod, 0, workspace, 110 bind = ALT, 1, workspace, 21 bind = ALT, 2, workspace, 22 bind = ALT, 3, workspace, 23 bind = ALT, 4, workspace, 24 bind = ALT, 5, workspace, 25 bind = ALT, 6, workspace, 26 bind = ALT, 7, workspace, 27 bind = ALT, 8, workspace, 28 bind = ALT, 9, workspace, 29 bind = ALT, 0, workspace, 210 bind = CTRL, 1, workspace, 31 bind = CTRL, 2, workspace, 32 bind = CTRL, 3, workspace, 33 bind = CTRL, 4, workspace, 34 bind = CTRL, 5, workspace, 35 bind = CTRL, 6, workspace, 36 bind = CTRL, 7, workspace, 37 bind = CTRL, 8, workspace, 38 bind = CTRL, 9, workspace, 39 bind = CTRL, 0, workspace, 310 bind = $mainMod SHIFT, H, workspace, 21 # Primary monitor workspaces workspace= name:11, monitor:HDMI-A-1,default:true workspace= name:12, monitor:HDMI-A-1 workspace= name:13, monitor:HDMI-A-1 workspace= name:14, monitor:HDMI-A-1 workspace= name:15, monitor:HDMI-A-1 workspace= name:16, monitor:HDMI-A-1 workspace= name:17, monitor:HDMI-A-1 workspace= name:18, monitor:HDMI-A-1 workspace= name:19, monitor:HDMI-A-1 workspace= name:110, monitor:HDMI-A-1 # Secondary Monitor workspaces workspace= name:21, monitor:DP-1,default:true workspace= name:22, monitor:DP-1 workspace= name:23, monitor:DP-1 workspace= name:24, monitor:DP-1 workspace= name:25, monitor:DP-1 workspace= name:26, monitor:DP-1 workspace= name:27, monitor:DP-1 workspace= name:28, monitor:DP-1 workspace= name:29, monitor:DP-1 workspace= name:210, monitor:DP-1 # TV Monitor workspaces workspace= name:31, monitor:DVI-D-1,default:true workspace= name:32, monitor:DVI-D-1 workspace= name:33, monitor:DVI-D-1 workspace= name:34, monitor:DVI-D-1 workspace= name:35, monitor:DVI-D-1 workspace= name:36, monitor:DVI-D-1 workspace= name:37, monitor:DVI-D-1 workspace= name:38, monitor:DVI-D-1 workspace= name:39, monitor:DVI-D-1 workspace= name:310, monitor:DVI-D-1 # Move active window to a workspace with mainMod + SHIFT + [0-9] bind = $mainMod SHIFT, 1, movetoworkspace, 11 bind = $mainMod SHIFT, 2, movetoworkspace, 12 bind = $mainMod SHIFT, 3, movetoworkspace, 13 bind = $mainMod SHIFT, 4, movetoworkspace, 14 bind = $mainMod SHIFT, 5, movetoworkspace, 15 bind = $mainMod SHIFT, 6, movetoworkspace, 16 bind = $mainMod SHIFT, 7, movetoworkspace, 17 bind = $mainMod SHIFT, 8, movetoworkspace, 18 bind = $mainMod SHIFT, 9, movetoworkspace, 19 bind = $mainMod SHIFT, 0, movetoworkspace, 110 bind = ALT SHIFT, 1, movetoworkspace, 21 bind = ALT SHIFT, 2, movetoworkspace, 22 bind = ALT SHIFT, 3, movetoworkspace, 23 bind = ALT SHIFT, 4, movetoworkspace, 24 bind = ALT SHIFT, 5, movetoworkspace, 25 bind = ALT SHIFT, 6, movetoworkspace, 26 bind = ALT SHIFT, 7, movetoworkspace, 27 bind = ALT SHIFT, 8, movetoworkspace, 28 bind = ALT SHIFT, 9, movetoworkspace, 29 bind = ALT SHIFT, 0, movetoworkspace, 210 bind = CTRL SHIFT, 1, movetoworkspace, 31 bind = CTRL SHIFT, 2, movetoworkspace, 32 bind = CTRL SHIFT, 3, movetoworkspace, 33 bind = CTRL SHIFT, 4, movetoworkspace, 34 bind = CTRL SHIFT, 5, movetoworkspace, 35 bind = CTRL SHIFT, 6, movetoworkspace, 36 bind = CTRL SHIFT, 7, movetoworkspace, 37 bind = CTRL SHIFT, 8, movetoworkspace, 38 bind = CTRL SHIFT, 9, movetoworkspace, 39 bind = CTRL SHIFT, 0, movetoworkspace, 310 # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow # Global Keybinds for apps bind = , F12, pass, ^(com\.obsproject\.Studio)$ # Source a file (multi-file configs) source = ~/.config/hypr/media-binds.conf source = ~/.config/hypr/env_var.conf exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP Config File: /home/ender/.config/hypr/media-binds.conf: Read Succeeded $SCRIPT = ~/.config/HyprV/waybar/scripts bind = , xf86audioraisevolume, exec, $SCRIPT/volume --inc bind = , xf86audiolowervolume, exec, $SCRIPT/volume --dec bind = , xf86AudioMicMute, exec, $SCRIPT/volume --toggle-mic bind = , xf86audioMute, exec, $SCRIPT/volume --toggle bind = , xf86KbdBrightnessDown, exec, $SCRIPT/kb-brightness --dec bind = , xf86KbdBrightnessUp, exec, $SCRIPT/kb-brightness --inc bind = , xf86MonBrightnessDown, exec, $SCRIPT/brightness --dec bind = , xf86MonBrightnessUp, exec, $SCRIPT/brightness --inc Config File: /home/ender/.config/hypr/env_var.conf: Read Succeeded # Environment Variables # see https://wiki.hyprland.org/Configuring/Environment-variables/ # Theming Related Variables # Set cursor size. See FAQ below for why you might want this variable set. # https://wiki.hyprland.org/FAQ/ env = XCURSOR_SIZE,24 # Set a GTK theme manually, for those who want to avoid appearance tools such as lxappearance or nwg-look #env = GTK_THEME, # Set your cursor theme. The theme needs to be installed and readable by your user. #env = XCURSOR_THEME, # the line below may help with multiple monitors #env = WLR_EGL_NO_MODIFIERS,1 #XDG Specifications env = XDG_CURRENT_DESKTOP,Hyprland env = XDG_SESSION_TYPE,wayland env = XDG_SESSION_DESKTOP,Hyprland # Toolkit Backend Variables # GTK: Use wayland if available, fall back to x11 if not. #env = GDK_BACKEND,wayland,x11 # QT: Use wayland if available, fall back to x11 if not. #env = QT_QPA_PLATFORM,wayland,xcb # Run SDL2 applications on Wayland. Remove or set to x11 if games that # provide older versions of SDL cause compatibility issues #env = SDL_VIDEODRIVER,wayland # Clutter package already has wayland enabled, this variable #will force Clutter applications to try and use the Wayland backend #env = CLUTTER_BACKEND,wayland # QT Variables # (From the QT documentation) enables automatic scaling, based on the monitor’s pixel density # https://doc.qt.io/qt-5/highdpi.html #env = QT_AUTO_SCREEN_SCALE_FACTOR,1 # Tell QT applications to use the Wayland backend, and fall back to x11 if Wayland is unavailable #env = QT_QPA_PLATFORM,wayland,xcb # Disables window decorations on QT applications #env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 #Tells QT based applications to pick your theme from qt5ct, use with Kvantum. #env = QT_QPA_PLATFORMTHEME,qt5ct ======Config-End======== ```

Description

OBS stutters a lot when recording specifically gameplay. These stutters are shown both in the recording and in the preview even before recording starts. This issue appears to be unrelated to framerate, as setting the monitor's refresh rate in the hyprland.conf file to 60.00Hz does not fix this issue. I'm also pretty sure this issue is Hyprland Specific. I tested the same scenario on the Cosmic Alpha and it worked as expected. I'm also not sure if this is due to something Xwayland does. Also, the game only stutters IN the recording. While playing, nothing seems off except OBS's preview and the recording.

How to reproduce

  1. Open Hyprland
  2. Launch OBS
  3. Start recording with OBS
  4. Launch game.
  5. Play game for any length of time
  6. End Recording

This recording should have a ton of stutter.

Crash reports, logs, images, videos

Below is an example of this issue in subnautica.

https://github.com/user-attachments/assets/f0c63d0a-c240-49d7-acba-1e281f605931

ENDragnee commented 2 months ago

Here too mydude, but the games stutter without opening OBS.

romanstingler commented 2 months ago

test disabling

render{
# Enables explicit sync support.
 explicit_sync = 1
}
render:explicit_sync = 1

why do you even have the second line in your config ??

additionally, you could play around with

no_hardware_cursors
 no_direct_scanout
JaredKIso commented 1 month ago

I am also experiencing a similar issue with recording stuttering.

To add to this now that I have gotten home. The above does not seem to relate to me as I do not have the "render {..}" code block.

I am going to test around with the no_hardware_cursors as well as no _direct_scanout to see if they make any differences.


I have tried downgrading to a different OBS version through AUR and the current OBS version I am on is: "30.2.3-tytan652-1 (64 bit).

I may bounce around and test other version per this GitHub posting:

7640 which someone mentions a 0.41 the error happened then or before then.


I will keep this updated here if I find anything but may take time due to work :)

EmmetZ commented 1 month ago
render{
 explicit_sync = 1
}

It actually works! I have the same problem and my previous settings is explicit_sync = 0, after I set the explicit_sync to 1 ,the problem disappear and everything goes fine

JaredKIso commented 1 month ago

I was testing around a bit more last night and found the following:

The stuttering does not happen when recording just the desktop.

The game I was experiencing this issue on was a game that I had set to Vulkan for rendering. After changing it to Direct3D 11 I testing recording the game again and I did not experience the issue anymore. (For context I am playing Deadlock).


I was doing further research and it looks like this (if related) has been a known issue for a bit regarding Vulkan: https://obsproject.com/forum/threads/i-cant-capture-vulkan-games-i-can-no-longer-hook-vulkan-games-i-could-but-now-i-cant.143257/

From that comment section I saw someone mention the use of "Game Capture" which my OBS does not have. This lead me down the path of: https://www.reddit.com/r/linuxquestions/comments/x0q6fp/obs_game_capture_on_linux/

Which then linked to: https://github.com/nowrep/obs-vkcapture?tab=readme-ov-file

I will be testing this today and will keep everyone updated!

--

T.L.D.R:

I am also going to test around a bit more with explicit_sync as it worked for Emmet :). So I will post here about how each thing goes

JaredKIso commented 1 month ago

Here to post an update!

Regarding my previous post I will get what did not work out of the way:

---| Things that didn't work |---

Because these didn't work I had to dig a little further into it.

To cut to the chase: ---| What worked for me |---

Hope this helps someone else if they experience this issue!

LaineZ commented 1 month ago

I encounter the same issue, but in Vesktop. This solution as I understand only works for OBS?

Here to post an update!

Regarding my previous post I will get what did not work out of the way:

---| Things that didn't work |---

* Downgrading OBS

* Updating system (Even a fresh install)

* Trying the suggestions that @romanstingler suggested neither of them worked for me but did for @EmmetZ.

Because these didn't work I had to dig a little further into it.

To cut to the chase: ---| What worked for me |---

* Noticed that if I swapped to Direct3D 11 for the game that saw stutters the stutters no longer happened in recordings.

* Found out the stuttering on recordings was a known thing for Vulkan.

* Someone suggested adding a Vulkan game capture to OBS. (https://github.com/nowrep/obs-vkcapture)
  --- Quick Solution: ---

* Installed it via `yay -S obs-vkcapture-git`

* Added `obs-gamecapture OBS_VKCAPTURE=1 %command%` to the games "Launch Options" on steam.

* Set the games render to Vulkan and tried recording using "Game Capture" and it worked smoothly!

Hope this helps someone else if they experience this issue!

JaredKIso commented 1 month ago

@LaineZ I do think this is specific to OBS (my solution).

But, I do recall seeing stuttering on different distros. When I swapped from Nobara to CachyOS (Hyprland specifically) it went away. I do not know why, could be drivers or how Vesktop interacts with the WM.

Maybe that is the place to investigate :)

LaineZ commented 1 month ago

@JaredKIso Probably you are right. I didn't remember any screenshare issues on OpenSUSE Tumbleweed, but there is also involving Plasma DE. I didn't test hyprland in OpenSUSE

LaineZ commented 1 month ago

For me, enabling render:explicit_sync = 1 seems to be resolves this issue (Both in OBS, and Vesktop)