Ocula
A small Rust screen recorder designed to fail safely. The GUI binary is ocula; the CLI binary is oculo.
It records through the desktop screencast portal on Wayland and can use direct X11 capture on X11. Output is written to a temporary file in the same directory, finalized with EOS on stop, synced, then atomically renamed to the final .mp4, .mkv, or .gif file.
Why This Is Harder To Break
- Uses
xdg-desktop-portaland PipeWire instead of brittle screenshot loops. - Defaults to MP4/H.264 for compatibility, while keeping MKV/MJPEG available as the safest high-throughput option.
- Handles Ctrl-C and SIGTERM by sending EOS before stopping, so muxers can finalize.
- Writes to
*.partfirst, then renames into place only after GStreamer has stopped. - Creates the output directory automatically and avoids overwriting existing recordings unless asked.
- Probes existing output directories or their nearest existing parents for writability before capture setup.
- Can fall back to X11 capture when running under X11.
- Supports selected-region recording with
--areaor--select. - Downscales large full-screen recordings to 1080p by default so 4K screens do not overload software encoders, without upscaling smaller captures.
- Keeps raw video buffering small and drops stale raw frames under encoder pressure so recording stays real-time instead of building huge lag.
- Caps capture framerate without manufacturing duplicate frames and feeds software H.264/VP8 explicit
I420input to reduce negotiation/conversion overhead. - Skips unnecessary color conversion for direct X11/MJPEG capture.
- Chooses default H.264/VP8 bitrates from effective output size and FPS, while preserving explicit
--bitrateexactly.
No recorder can save a file after SIGKILL, power loss, kernel crash, or disk failure, but this is built to preserve recordings for normal crashes, errors, and interrupts as much as GStreamer allows.
Requirements
- Rust 1.92+
- GStreamer 1.22+
- GStreamer plugins:
matroskamux,jpegenc,videoscale,videocrop,pipewiresrcfor Wayland,ximagesrcfor X11,opusencfor MKV audio - Default MP4 plugins:
mp4mux,openh264encor a supported hardware H.264 encoder,h264parse, and an AAC encoder such asfdkaacencfor MP4 audio - Optional GIF plugin:
gifenc - For Wayland:
pipewire,xdg-desktop-portal, and a portal backend such as GTK, KDE, GNOME, or wlr - For X11 fallback:
ximagesrc - X11/XWayland for interactive
--select, or use--areawith explicit coordinates - PulseAudio-compatible default input/output devices when
--audio mic,--audio system, or--audio bothis used
On Wayland, --backend auto uses the desktop portal only. Use --backend x11 explicitly if you intentionally want X11/XWayland capture.
Build
Install from crates.io after release:
Use
Launch the native desktop app:
After install, launch it with:
The desktop app provides compact capture controls, audio, pointer, MP4/MKV/GIF format controls, optional GLSL effects, an output picker, a large record/stop button, and a live recorder log. In Area mode, Ocula shows an effect-aware crop preview panel before selection; click Pick Crop, drag an area, refine it with the glass-style selector handles, then click Use This Crop or press Enter before recording. Ocula keeps a real selected-area crop preview visible when X11 snapshots are available, falls back to a clean crop map otherwise, and shows a click-through crop outline outside the selected area after selection and while recording. It launches the same fail-safe recorder engine as the CLI and stops recordings with a graceful interrupt so GStreamer can finalize the output file.
Run the CLI directly after install:
Start from an interactive chooser in the current directory:
The chooser supports screen or monitor, window, area, audio, pointer visibility, and output-path choices. Use explicit flags below when scripting or when you do not want a prompt.
Record to a directory:
Record with microphone audio:
Record a selected region by coordinates:
Record a screen through the normal backend chooser:
Record a specific X11 monitor:
Record a window through the desktop portal:
Select multiple monitor streams through the desktop portal:
Record a selected region interactively with Ocula's built-in selector:
Selector controls:
- Drag to create or move a region.
- Resize from edge or corner handles.
- Arrow keys move; Shift+arrows resize; Ctrl changes keyboard steps to 10 px.
- Delete or Backspace clears the region.
- Click
Use This Cropor press Enter/Space to confirm; clickCancel, press Escape, or right-click to cancel.
Record MKV instead of the default MP4:
MP4 uses H.264 video for compatibility. MKV remains available because it is faster to start, supports the MJPEG path, and is safer for interrupted recordings. GIF is video-only, defaults to 15 FPS unless --fps is provided, and requires gifenc.
Add an optional GLSL effect when GStreamer OpenGL elements are installed:
Effects use glupload, glshader, and gldownload; Ocula preflights those plugins before capture starts. Available effects are neon, heatmap, glitch, ripple, glass, crt, holo, vapor, fracture, prism, aurora, and kaleido.
Record GIF when the GStreamer gifenc plugin is installed:
Record full resolution instead of the default 1080p safety downscale for large screens:
Stop with Ctrl-C. Press Ctrl-C a second time to abort immediately.
Audio capture is preflighted before area selection, portal consent, and output reservation. If the default microphone or system-audio monitor is unavailable, Ocula fails before creating an output file.
Useful flags:
||
||
|||
||
||||||||||||
||
|||