Screen recording on KWin Wayland

Hello there!

I was giving Wayland a try after eyeing it for a long time. It has been quite smooth, working better than X on the features they both can do, with one exception however – screen recording.

I have installed the xdg-desktop-portal and xdg-desktop-portal-kde packages, as we as wireplumber.
I’ve been running with the latter active for some days with no issues in regards to audio.

Now, in OBS, I can correctly pick a window to record, the portal shows up all fine, and the recording works great. For a full screen capture, however, the portal shows up, yet the preview window remains pitch black, if not for the mouse cursor.
I have tried another recorder, Kooha, and it too can’t capture the entire screen or a region of it, instead displaying a white/gray checker pattern.

Any idea what this might be? I’ve looked at a lot of Reddit threads, posts on Manjaro’s, ArchLinux’s and OBS’ forums, reaching no conclusion. Everything seems to point to installing the correct XDG portals and a pipewire media session (such as wireplumber).

Thanks in advance!


Info dump

Here’s the block of Pipewire related logs shown by OBS:

info: [pipewire] Screencast session created
info: [pipewire] Screencast session created
info: [pipewire] Asking for desktop
info: [pipewire] Asking for window
info: [pipewire] window selected, setting up screencast
info: [pipewire] desktop selected, setting up screencast
info: [pipewire] Server version: 0.3.65
info: [pipewire] Library version: 0.3.65
info: [pipewire] Header version: 0.3.64
info: [pipewire] Created stream 0x55fecbf48690
info: [pipewire] Stream 0x55fecbf48690 state: "connecting" (error: none)
info: [pipewire] Playing stream 0x55fecbf48690
info: [pipewire] Stream 0x55fecbf48690 state: "paused" (error: none)
info: [pipewire] Server version: 0.3.65
info: [pipewire] Library version: 0.3.65
info: [pipewire] Header version: 0.3.64
info: [pipewire] Created stream 0x55fecbf7cd10
info: [pipewire] Stream 0x55fecbf7cd10 state: "connecting" (error: none)
info: [pipewire] Playing stream 0x55fecbf7cd10
info: [pipewire] Stream 0x55fecbf7cd10 state: "paused" (error: none)
info: [pipewire] Negotiated format:
info: [pipewire] Negotiated format:
info: [pipewire]     Format: 12 (Spa:Enum:VideoFormat:BGRA)
info: [pipewire]     Format: 12 (Spa:Enum:VideoFormat:BGRA)
info: [pipewire]     Modifier: 0
info: [pipewire]     Modifier: 0
info: [pipewire]     Size: 1920x1080
info: [pipewire]     Size: 1920x1035
info: [pipewire]     Framerate: 0/1
info: [pipewire]     Framerate: 0/1
info: [pipewire] Negotiated format:
info: [pipewire] Negotiated format:
info: [pipewire]     Format: 12 (Spa:Enum:VideoFormat:BGRA)
info: [pipewire]     Format: 12 (Spa:Enum:VideoFormat:BGRA)
info: [pipewire]     Modifier: 216172782128496660
info: [pipewire]     Modifier: 216172782128496660
info: [pipewire]     Size: 1920x1080
info: [pipewire]     Size: 1920x1035
info: [pipewire]     Framerate: 0/1
info: [pipewire]     Framerate: 0/1
info: [pipewire] Stream 0x55fecbf7cd10 state: "streaming" (error: none)
info: [pipewire] Stream 0x55fecbf48690 state: "streaming" (error: none)

Here is inxi -v7azy:

System:
  Kernel: 6.1.19-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1-x86_64
    root=UUID=b8e4ec89-794c-4ce3-b10a-0102bf25e5b4 rw apparmor=1
    security=apparmor udev.log_priority=3
    bootsplash.bootfile=/bootsplash-themes/kde/bootsplash
  Desktop: KDE Plasma v: 5.26.5 tk: Qt v: 5.15.8 wm: kwin_wayland vt: 2
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: <redacted>
    v: Late 2019 serial: <superuser required> Chassis: type: 10 v: 1.0
    serial: <superuser required>
  Mobo: Intel model: <redacted> v: <redacted> serial: <superuser required>
    UEFI: Intel v: <redacted> date: 05/23/2022
Battery:
  ID-1: BAT0 charge: 56.1 Wh (60.0%) condition: 93.5/93.5 Wh (100.0%)
    volts: 10.7 min: 11.4 model: standard type: Li-ion serial: <filter>
    status: discharging
Memory:
  RAM: total: 15.47 GiB used: 11.28 GiB (72.9%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Core i7-9750H bits: 64 type: MT MCP arch: Coffee Lake
    gen: core 9 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 0xA (10) microcode: 0xF0
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
    L3: 12 MiB desc: 1x12 MiB
  Speed (MHz): avg: 1400 high: 2600 min/max: 800/4500 scaling:
    driver: intel_pstate governor: powersave cores: 1: 800 2: 800 3: 800 4: 2600
    5: 2600 6: 801 7: 800 8: 800 9: 800 10: 2600 11: 2600 12: 800
    bogomips: 62431
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2 bts clflush
    clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64
    dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu
    fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs ida
    intel_pt invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor
    movbe mpx msr mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm
    pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts rdrand rdseed rdtscp
    rep_good sdbg sep smap smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp
    syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer vme vmx vnmi
    vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
  Vulnerabilities:
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed mitigation: IBRS
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS, IBPB: conditional, STIBP: conditional,
    RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] driver: i915 v: kernel
    arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1
    empty: none bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300
  Device-2: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] vendor: Intel
    driver: nvidia v: 525.89.02 alternate: nouveau,nvidia_drm non-free: 525.xx+
    status: current (as of 2023-02) arch: Turing code: TUxxx
    process: TSMC 12nm FF built: 2018-22 pcie: gen: 2 speed: 5 GT/s lanes: 16
    link-max: gen: 3 speed: 8 GT/s ports: active: none
    empty: DP-1,DP-2,HDMI-A-1 bus-ID: 01:00.0 chip-ID: 10de:2191 class-ID: 0300
  Device-3: Chicony HD Webcam type: USB driver: uvcvideo bus-ID: 1-13:4
    chip-ID: 04f2:b68b class-ID: 0e02 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.7 with: Xwayland v: 22.1.8
    compositor: kwin_wayland driver: X: loaded: modesetting,nvidia dri: iris
    gpu: i915 display-ID: 0
  Monitor-1: eDP-1 model: BOE Display 0x084d built: 2018 res: 1920x1080
    dpi: 142 gamma: 1.2 size: 344x193mm (13.54x7.6") diag: 394mm (15.5")
    ratio: 16:9 modes: 1920x1080
  API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: NVIDIA GeForce GTX 1660
    Ti/PCIe/SSE2 direct-render: Yes
Audio:
  Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel v: kernel
    alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
    chip-ID: 8086:a348 class-ID: 0403
  Device-2: NVIDIA TU116 High Definition Audio vendor: Tongfang Hongkong
    driver: snd_hda_intel v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 16
    link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.1 chip-ID: 10de:1aeb
    class-ID: 0403
  Sound API: ALSA v: k6.1.19-1-MANJARO running: yes
  Sound Interface: sndio v: N/A running: no
  Sound Server-1: JACK v: 1.9.22 running: no
  Sound Server-2: PulseAudio v: 16.1 running: no
  Sound Server-3: PipeWire v: 0.3.65 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Intel driver: r8169 v: kernel pcie: speed: Unknown lanes: 63
    link-max: gen: 6 speed: 64 GT/s port: 3000 bus-ID: 3d:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp61s0 state: down mac: <filter>
  Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel pcie: gen: 2
    speed: 5 GT/s lanes: 1 bus-ID: 3e:00.0 chip-ID: 8086:2723 class-ID: 0280
  IF: wlan0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: noprefixroute scope: link
  IF-ID-1: docker0 state: down mac: <filter>
  IP v4: <filter> scope: global broadcast: <filter>
  IF-ID-2: wg-mullvad state: unknown speed: N/A duplex: N/A mac: N/A
  IP v4: <filter> scope: global
  Message: Output throttled. IPs: 2; Limit: 10; Override: --limit [1-x;-1
    all]
  WAN IP: <filter>
Bluetooth:
  Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 1-14:5
    chip-ID: 8087:0029 class-ID: e001
  Report: hciconfig ID: hci0 rfk-id: 12 state: up address: <filter> bt-v: 3.0
    lmp-v: 5.2 sub-v: 200f hci-v: 5.2 rev: 200f
  Info: acl-mtu: 1021:4 sco-mtu: 96:6 link-policy: rswitch sniff
    link-mode: peripheral accept service-classes: rendering, capturing, object
    transfer, audio, telephony
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 465.76 GiB used: 389.44 GiB (83.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Crucial model: CT500P1SSD8
    size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 type: SSD serial: <filter> rev: P3CR021 temp: 38.9 C scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 70 GiB size: 68.35 GiB (97.64%) used: 64.54 GiB (94.4%)
    fs: ext4 dev: /dev/nvme0n1p2 maj-min: 259:2 label: root
    uuid: b8e4ec89-794c-4ce3-b10a-0102bf25e5b4
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
    used: 312 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 label: N/A
    uuid: 8BCC-FA41
  ID-3: /home raw-size: 350 GiB size: 343.44 GiB (98.13%)
    used: 323.1 GiB (94.1%) fs: ext4 dev: /dev/nvme0n1p3 maj-min: 259:3
    label: home uuid: c2c4dab5-0a58-42d4-b279-2791c65f4a17
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 8 GiB used: 1.8 GiB (22.5%) priority: -2
    dev: /dev/nvme0n1p4 maj-min: 259:4 label: SWAP
    uuid: 89ff7953-8699-42ab-bf57-98a619111bac
Unmounted:
  Message: No unmounted partitions found.
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 16 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 1-6:2 info: Integrated Express ITE Device(8291)
    type: Keyboard,HID driver: hid-generic,usbhid interfaces: 2 rev: 2.0
    speed: 12 Mb/s power: 100mA chip-ID: 048d:ce00 class-ID: 0300
  Device-2: 1-13:4 info: Chicony HD Webcam type: Video driver: uvcvideo
    interfaces: 4 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 04f2:b68b
    class-ID: 0e02 serial: <filter>
  Device-3: 1-14:5 info: Intel AX200 Bluetooth type: Bluetooth driver: btusb
    interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 100mA chip-ID: 8087:0029
    class-ID: e001
  Hub-2: 2-0:1 info: Super-speed hub ports: 8 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
  Device-1: 2-2:2 info: Realtek Card Reader type: Mass Storage
    driver: usb-storage interfaces: 1 rev: 3.0 speed: 5 Gb/s power: 800mA
    chip-ID: 0bda:0316 class-ID: 0806 serial: <filter>
  Hub-3: 5-0:1 info: Hi-speed hub with single TT ports: 2 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Hub-4: 6-0:1 info: Super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: 52.0 C pch: 54.0 C mobo: N/A
  Fan Speeds (RPM): cpu: 2875 fan-2: 2871
Info:
  Processes: 371 Uptime: 3d 52m wakeups: 39 Init: systemd v: 252
  default: graphical tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7
  Packages: pm: pacman pkgs: 3919 libs: 574 tools: octopi,pamac,paru,yay
  pm: flatpak pkgs: 0 Shell: fish v: 3.6.0 running-in: kitty inxi: 3.3.25

I know Kooha, it still has bugs on KDE Wayland, but it has no issue with Gnome Wayland.

I use OBS studio for screen recording on KDE Wayland, it works flawlessly

Mmm, interesting. What is your setup? Am I missing any packages, maybe some service?
Thank you!

Only difference is that I use AMD GPU, that’s why OBS works fine with AMD GPU and KDE Wayland.

I see… Do you have any suggestions for NVIDIA?

I often read other problems, Nvidia and Wayland are not friends yet. Switch back to Xorg if people use Nvidia.

The good news is that the XwaylandVideoBridge may soon make Wayland screencasting/recording on Plasma a fairly simple process:

Fixing Wayland: Xwayland screen casting

This blog introduces a new tool to make it easy to stream wayland windows and screens to existing applications running under Xwayland that don’t have native pipewire support in an easy-to-use manner than retains full user control throughout.