Record your screen with `ffmpeg` (x11grab)

No recorder installed? ffmpeg itself can capture the whole screen, a region or a window — the syntax is just easy to forget, especially the `:0.0` display part.

Linuxvideox11grabffmpegscreen-recordingLow risk
Run `ffmpeg -f x11grab -framerate 25 -video_size 1920x1080 -i :0.0 output.mp4` to record display :0.0; press `q` in the terminal to stop.

01Command

Command
$ ffmpeg -f x11grab -framerate 25 -video_size 1920x1080 -i :0.0 output.mp4

02What it does

`-i :0.0` means X display 0, screen 0; `xdpyinfo | grep dimensions` (or `xrandr`) tells you the value for -video_size. To record a movable region instead, add `-follow_mouse 1`, and to capture microphone/system audio append `-f pulse -i default` before the output. On Wayland this input does not work — use the desktop's built-in recorder (e.g. GNOME's Ctrl+Alt+Shift+R) or a pipewire-based tool.

03Risk

RiskLow risk
RequirementsRequires ffmpeg; x11grab works on X11 sessions only — Wayland needs pipewire (`-f pipewire`) or a desktop recorder instead
!Warning: Long recordings at full resolution can consume several GB per hour — watch disk space or add a lower -video_size.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Capture/Desktop — FFmpeg wiki
    FFmpeg · vendor-doc · 2026-09-17
    Evidence: Official wiki documents x11grab screen capture, -framerate, -video_size, audio capture with pulse, and region recording

Last verified: 2026-09-17 · Category: Media