Is it possible to record the screen with ffmpeg on wayland using the Hyprland compositor?
I've read some posts that imply people managed to do it with kmsgrab, but cannot figure out how to do it myself (I tried the common examples with kmsgrab and it didn't work, possibly because I'm on wayland)
Is there a way to do it?
I've tried:
ffmpeg -device /dev/dri/card1 -f kmsgrab -i - -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mkv
But get the following error:
[kmsgrab @ 0x556c9ae1fec0] Using plane 58 to locate framebuffers.
[kmsgrab @ 0x556c9ae1fec0] Template framebuffer is 142: 2560x1600 format 34325258 modifier 200000000401b03 flags 2.
[kmsgrab @ 0x556c9ae1fec0] No handle set on framebuffer: maybe you need some additional capabilities?
[in#0 @ 0x556c9ae1fc00] Error opening input: Invalid argument
Error opening input file -.
Error opening input files: Invalid argument
Recording with vaapi with wf-recorder or wl-screenrec works fine btw, but I would prefer to directly use ffmpeg.
I'm also curious if it can be used with nvenc (which would be on card0 for me), but if I try to use it with my nvidia gpu I get:
[kmsgrab @ 0x558916595e80] No usable planes found.
[in#0 @ 0x558916595bc0] Error opening input: Invalid argument
Error opening input file -.
Error opening input files: Invalid argument
Asked by Cestarian
(2438 rep)
Jul 28, 2025, 03:26 PM
Last activity: Jul 29, 2025, 09:19 PM
Last activity: Jul 29, 2025, 09:19 PM