On Debian 12 Bookworm (Raspberry Pi OS), the desktop environment runs natively on Wayland. Consequently, traditional X11 screen capture utilities (like FFmpeg's -f x11grab) no longer work.
The standard tool for recording Wayland sessions is wf-recorder. However, the stock wf-recorder v0.3 package provided in Debian's default repository lacks several modern enhancements, most notably the --overwrite flag. Compiling the latest version from source gives you full feature support, hardware-accelerated encoding, and audio capture.
1. Install Build Dependencies
Install the required C++ compilers, Meson build system, PipeWire, and FFmpeg development headers:
sudo apt-get update
sudo apt-get install -y g++ meson ninja-build libavutil-dev libavcodec-dev libavformat-dev libswscale-dev libpulse-dev wayland-protocols libpipewire-0.3-dev wget
2. Download, Configure, and Build wf-recorder
mkdir -p ~/src && cd ~/src
wget https://github.com/ammen99/wf-recorder/releases/download/v0.5.0/wf-recorder-0.5.0.tar.xz
tar -xf wf-recorder-0.5.0.tar.xz
cd wf-recorder-0.5.0
# Configure release build with Meson
meson setup build --prefix=/usr --buildtype=release --reconfigure
# Compile with Ninja
ninja -C build
# Install binary to /usr/local/bin
sudo cp build/wf-recorder /usr/local/bin/
3. Recording Desktop Video and Audio
To record your full Wayland desktop screen with system audio output:
wf-recorder --overwrite -a default -f capture.mp4
--overwrite: Automatically overwrites existing destination files without prompting.-a default: Captures audio from the default PulseAudio / PipeWire monitor source.-f capture.mp4: Output file path. Stop recording at any time by pressingCtrl + C.