Skip to content

Screencast only captures the first frame #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Dummyc0m opened this issue Apr 7, 2025 · 12 comments
Closed

Screencast only captures the first frame #1403

Dummyc0m opened this issue Apr 7, 2025 · 12 comments
Labels
bug Something isn't working

Comments

@Dummyc0m
Copy link

Dummyc0m commented Apr 7, 2025

When screencasting to discord or firefox (google meet), only the first frame is captured and a static image is shown consistently throughout the capture.

I've tried 25.02 and the build below from April. Not sure what I'm doing wrong here.

Logs from niri:

Apr 07 02:51:41 systemd[2195]: Starting A scrollable-tiling Wayland compositor...
░░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has begun execution.
░░ 
░░ The job identifier is 38.
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.086481Z  INFO niri: starting version unstable 2025-04-01 (commit 60034a57efd9c8130b05797b37cbc187a8c13145)
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.119314Z DEBUG niri_config: loaded config from "/home/alice/.config/niri/config.kdl"
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.240136Z  INFO niri::backend::tty: using as the render node: "/dev/dri/renderD128"
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.296961Z DEBUG niri::backend::tty: device added: 57857 "/dev/dri/card1"
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.388700Z DEBUG niri::backend::tty: this is the primary node
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.388713Z DEBUG niri::backend::tty: this is the primary render node
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.463540Z DEBUG niri::backend::tty: device changed: 57857
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.498315Z DEBUG niri::backend::tty: new connector: DP-2 "Lenovo Group Limited LEN P32p-20 VNA55M15"
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.498342Z DEBUG niri::backend::tty: connecting connector: DP-2
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.498376Z DEBUG niri::backend::tty: picking mode: Mode { name: "3840x2160", clock: 533250, size: (3840, 2160), hsync: (3888, 3920, 4000), vsync: (2163, 2168, 2222), hskew: 0, vscan: 0, vrefresh: 60, mode_type: ModeTypeFlags(PREFERRED) }
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.498432Z DEBUG niri::backend::tty: error setting max bpc: couldn't find max bpc property
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.503558Z DEBUG niri::niri: putting output DP-2 at x=0 y=0
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.503741Z  INFO niri: listening on Wayland socket: wayland-1
Apr 07 02:51:41 niri[2248]: 2025-04-07T09:51:41.503752Z  INFO niri: IPC listening on: /run/user/1000/niri.wayland-1.2248.sock
Apr 07 02:51:41 systemd[2195]: Started A scrollable-tiling Wayland compositor.
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 38.
Apr 07 02:52:10 niri[2248]: 2025-04-07T09:52:10.818460Z DEBUG niri::dbus::mutter_screen_cast: record_window properties=RecordWindowProperties { window_id: 4, cursor_mode: Some(Metadata), _is_recording: None }
Apr 07 02:52:10 niri[2248]: 2025-04-07T09:52:10.819353Z DEBUG niri::dbus::mutter_screen_cast: start
Apr 07 02:52:10 niri[2248]: 2025-04-07T09:52:10.819390Z DEBUG niri::niri: StartCast session_id=0 stream_id=0
Apr 07 02:52:10 niri[2248]: 2025-04-07T09:52:10.827869Z DEBUG niri::pw_utils: pw stream: state changed: Unconnected -> Connecting
Apr 07 02:52:10 niri[2248]: 2025-04-07T09:52:10.862780Z DEBUG niri::pw_utils: pw stream: state changed: Connecting -> Paused
Apr 07 02:52:10 niri[2248]: 2025-04-07T09:52:10.862791Z DEBUG niri::pw_utils: pw stream: sending signal with 95
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.381406Z DEBUG niri::pw_utils: pw stream: got format = VideoInfoRaw { format: VideoFormat::BGRA, flags: VideoFlags(0xc), modifier: 0, size: spa_rectangle { width: 1865, height: 2120 }, framerate: spa_fraction { num: 0, denom: 1 }, max_framerate: spa_fraction { num: 59997, denom: 1000 }, views: 0, interlace_mode: 0, pixel_aspect_ratio: spa_fraction { num: 0, denom: 0 }, multiview_mode: 0, multiview_flags: 0, chroma_site: 0, color_range: 0, color_matrix: 0, transfer_function: 0, color_primaries: 0 }
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.381496Z DEBUG niri::pw_utils: pw stream: fixating the modifier
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.381503Z DEBUG niri::pw_utils: find_preferred_modifier: size=Size<smithay::utils::geometry::Physical> { w: 1865, h: 2120 }, fourcc=AR24, modifiers=[216172782120099856, 216172782120099857, 216172782120099858, 216172782120099859, 216172782120099860, 216172782120099861, 216172782128496656, 216172782128496657, 216172782128496658, 216172782128496659, 216172782128496660, 216172782128496661, 72057594037927935]
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.381664Z DEBUG niri::pw_utils: pw stream: allocation successful (modifier=Unrecognized(216172782128496660), plane_count=1), moving to confirmation pending
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.381859Z DEBUG niri::pw_utils: pw stream: got format = VideoInfoRaw { format: VideoFormat::BGRA, flags: VideoFlags(0x4), modifier: 216172782128496660, size: spa_rectangle { width: 1865, height: 2120 }, framerate: spa_fraction { num: 0, denom: 1 }, max_framerate: spa_fraction { num: 59997, denom: 1000 }, views: 0, interlace_mode: 0, pixel_aspect_ratio: spa_fraction { num: 0, denom: 0 }, multiview_mode: 0, multiview_flags: 0, chroma_site: 0, color_range: 0, color_matrix: 0, transfer_function: 0, color_primaries: 0 }
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.381871Z DEBUG niri::pw_utils: pw stream: moving to ready state
Apr 07 02:52:11 niri[2248]: 2025-04-07T09:52:11.383157Z DEBUG niri::pw_utils: pw stream: state changed: Paused -> Streaming

Logs from xdp-gnome:

Apr 07 02:51:41 systemd[2195]: Starting Portal service (GNOME implementation)...
░░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has begun execution.
░░ 
░░ The job identifier is 119.
Apr 07 02:51:41 systemd[2195]: Started Portal service (GNOME implementation).
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 119.
Apr 07 02:52:07 .xdg-desktop-po[2334]: Failed to associate portal window with parent window 
Apr 07 02:52:08 .xdg-desktop-po[2334]: vkAcquireNextImageKHR(): A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR) (1000001003)

logs from pipewire:

Apr 07 02:51:42 systemd[2195]: Started PipeWire Multimedia Service.
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 144.
Apr 07 02:51:54 pipewire[2380]: pw.node: (alsa_output.usb-MONOPRICE_MONOLITH_HPA-00.iec958-stereo-55) graph xrun not-triggered (0 suppressed)
Apr 07 02:51:54 pipewire[2380]: pw.node: (alsa_output.usb-MONOPRICE_MONOLITH_HPA-00.iec958-stereo-55) xrun state:0x7f9b0400c008 pending:1/3 s:29644611962 a:29644646972 f:29644651102 waiting:35010 process:4130 status:triggered
Apr 07 02:54:28 pipewire[2380]: spa.alsa: iec958:0c: snd_pcm_drop: No such device
Apr 07 02:54:28 pipewire[2380]: spa.alsa: iec958:0c: close failed: No such device
Apr 07 02:54:28 pipewire[2380]: pw.node: (alsa_output.usb-MONOPRICE_MONOLITH_HPA-00.iec958-stereo-55) graph xrun not-triggered (0 suppressed)
Apr 07 02:54:28 pipewire[2380]: pw.node: (alsa_output.usb-MONOPRICE_MONOLITH_HPA-00.iec958-stereo-55) xrun state:0x7f9b0400c008 pending:1/2 s:183276909663 a:183276939874 f:183276945694 waiting:30211 process:5820 status:triggered

config:
https://gist.github.com/Dummyc0m/6836dfcbbcf2eb97e3f084ca2336167b

System Information

  • niri version:
    niri unstable 2025-04-01 (commit 60034a5)

  • Distro:
    NixOS 24.11

  • GPU:
    nvidia 3090 Ti

  • CPU:
    AMD EPYC 7V73X

@Dummyc0m Dummyc0m added the bug Something isn't working label Apr 7, 2025
@YaLTeR
Copy link
Owner

YaLTeR commented Apr 7, 2025

Not sure, doesn't seem like anything is wrong. Could you try https://github.com/YaLTeR/niri/wiki/Configuration:-Debug-Options#wait-for-frame-completion-in-pipewire?

@Dummyc0m
Copy link
Author

Dummyc0m commented Apr 7, 2025

Thanks for taking a look. I added it to my config and did a logout/login. Same problem persists. I have tried both open (not nouveau) and proprietary nvidia drivers.

@Dummyc0m
Copy link
Author

Dummyc0m commented Apr 8, 2025

I'll probably get around to debugging during the weekend. Probably will start building niri and adding some logging in pw_utils.rs or trying to find the streaming part. Unsure which part of the stack is having issues though. I've never used wayland gnome myself.

@YaLTeR
Copy link
Owner

YaLTeR commented Apr 8, 2025

It's probably a good idea to try if it works on GNOME, since the screencast handling should be somewhat similar.

You could also try using xdg-desktop-portal-wlr for screencasting (override in niri-portals.conf) since that uses different code paths.

@Dummyc0m
Copy link
Author

Dummyc0m commented Apr 8, 2025

I just tried both.

GNOME on wayland worked, also verified discord was running wayland with xeyes.

xdg-desktop-portal-wlr had the same problem of only showing a static image.

@YaLTeR
Copy link
Owner

YaLTeR commented Apr 8, 2025

Huh

@maxverbeek
Copy link

I am getting the same issue.

Apr 14 08:01:39 thinkpad .xdg-desktop-po[2385]: Failed to associate portal window with parent window 
Apr 14 08:01:39 thinkpad xdg-desktop-portal-gnome[2385]: MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:763: FINISHME: support YUV colorspace with DRM format modifiers
Apr 14 08:01:39 thinkpad xdg-desktop-portal-gnome[2385]: MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:794: FINISHME: support more multi-planar formats with DRM modifiers
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.668150Z DEBUG niri::dbus::mutter_screen_cast: record_monitor connector="DP-1" properties=RecordMonitorProperties { cursor_mode: Some(Metadata), _is_recording: None }
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.670231Z DEBUG niri::dbus::mutter_screen_cast: start
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.670259Z DEBUG niri::niri: StartCast session_id=0
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.682808Z DEBUG niri::pw_utils: pw stream: state changed: Unconnected -> Connecting
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.724339Z DEBUG niri::pw_utils: pw stream: state changed: Connecting -> Paused
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.724354Z DEBUG niri::pw_utils: pw stream: sending signal with 86
Apr 14 08:01:40 thinkpad .firefox-wrapped[2681]: mod.protocol-native: 0x7f8b313ea100: could not find proxy 2
Apr 14 08:01:40 thinkpad .firefox-wrapped[2681]: mod.protocol-native: 0x7f8b313ea100: could not find proxy 2
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.757246Z DEBUG niri::pw_utils: pw stream: got format = VideoInfoRaw { format: VideoFormat::BGRx, flags: VideoFlags(0xc), modifier: 0, size: spa_rectangle { width: 3440, height: 1440 }, framerate: spa_fraction { num: 0, denom: 1 }, max_framerate: spa_fraction { num: 49987, denom: 100>
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.757274Z DEBUG niri::pw_utils: pw stream: fixating the modifier
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.757280Z DEBUG niri::pw_utils: find_preferred_modifier: size=Size<smithay::utils::geometry::Physical> { w: 3440, h: 1440 }, fourcc=XR24, modifiers=[0, 72057594037927937, 72057594037927945, 72057594037927949, 72057594037927951, 72057594037927935]
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.761427Z DEBUG niri::pw_utils: pw stream: allocation successful (modifier=Unrecognized(72057594037927951), plane_count=3), moving to confirmation pending
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.761782Z DEBUG niri::pw_utils: pw stream: got format = VideoInfoRaw { format: VideoFormat::BGRx, flags: VideoFlags(0x4), modifier: 72057594037927951, size: spa_rectangle { width: 3440, height: 1440 }, framerate: spa_fraction { num: 0, denom: 1 }, max_framerate: spa_fraction { num: 4>
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.761797Z DEBUG niri::pw_utils: pw stream: moving to ready state
Apr 14 08:01:40 thinkpad niri[2213]: 2025-04-14T06:01:40.800601Z DEBUG niri::pw_utils: pw stream: state changed: Paused -> Streaming
Apr 14 08:01:44 thinkpad niri[2213]: 2025-04-14T06:01:44.076074Z DEBUG niri::pw_utils: pw stream: state changed: Streaming -> Paused
Apr 14 08:01:44 thinkpad niri[2213]: 2025-04-14T06:01:44.076963Z DEBUG niri::dbus::mutter_screen_cast: stop
Apr 14 08:01:44 thinkpad niri[2213]: 2025-04-14T06:01:44.077031Z DEBUG niri::niri: StopCast session_id=0
Apr 14 08:01:44 thinkpad niri[2213]: 2025-04-14T06:01:44.077082Z DEBUG niri::pw_utils: pw stream: state changed: Paused -> Unconnected

niri --version: niri 25.02 (unknown commit) (should be installed from the v25.02 tag)

GPU: Intel Arc

Distro: NixOS 24.11

@maxverbeek
Copy link

Trying it on an older build, with Niri 25.01, and here it works fine. I can do more in-depth testing later where I try this older niri version on the newer build

@Dummyc0m
Copy link
Author

LOL I didn't have time during the weekend. Thanks @maxverbeek for the additional report valuable insight to know that I'm not insane.

@maxverbeek
Copy link

maxverbeek commented Apr 14, 2025

I'm sad to report that is probably an error on my end, but I suspect it could be causing your issue as well:

For a while I was using an unstable version of niri because I wanted that sweet floating window support. To achieve this I put this in my config:

  modules.niri.package = pkgs.unstable.niri.overrideAttrs (old: {
    buildInputs = ((builtins.filter (p: p != pkgs.unstable.libgbm) old.buildInputs) ++ [ pkgs.mesa ]);
  });

When not doing this, and just using the Niri from the nixpkgs of my distro, everything works fine. Note: the Niri version from nixos-unstable and nixos-24.11 are the same atm (same hashes, both v25.02).

I suspect the problem could lie in the buildInputs and after briefly looking at it I do see that pipewire is a derivation dependency.

I haven't tried it myself, but it might be worth trying a

.override { pipewire = pkgs.pipewire; }

Edit: to be clear, not doing overrides fixes this issue for me, no more screensharing issues :)

@Dummyc0m
Copy link
Author

Makes sense, I've been using a mix of 24.11 and unstable packages, my graphics drivers were coming from 24.11 and niri was overlayed on top of unstable. I switched the overlay to 24.11 and things are ok now.

I'll close this issue because:

  1. it's unlikely to be a niri issue
  2. there's a workaround.

@YaLTeR
Copy link
Owner

YaLTeR commented Apr 15, 2025

Thanks for looking into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants