I started experimenting with the possibility of recording the framebuffer directly, bypassing the X server or Wayland: the Linux kernel provide this via a system called DMAbuf.
To be fair, the idea is not mine: ffmpeg let you do that with the kmsgrab input device, but for some reason they don't recommend it very much, certainly not as a first choice; maybe that road is not as tested as the classic x11grab.
So here is the first version of my little utility screenrec: you can take a screenshot or record a short video of your desktop.
It's a proof-of-concept; while it only supports a linear or tiledX by 4KB framebuffer and only the pixel format of my video card, those limitations are easy to expand.
Let me know if you like it!