Skip to content

cjRem44x/RustKlip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔥 RustKlip

A Wayland screen recorder and animated GIF/WebP exporter written in Rust.
Records any monitor or window via the XDG Screencast portal, then gives you a full frame editor to trim, splice, and export — all wrapped in a Doom-fire UI.


📸 Screenshots

Launcher Preview & Editor
Launcher window Preview window

✨ Features

  • 🖥️ Wayland-native recording — uses the XDG Screencast portal (works on GNOME, KDE Plasma, and any PipeWire-backed compositor)
  • Hardware or software H.264 encoding — auto-detects VA-API (vah264enc), falls back to x264enc
  • 📂 Load existing frames — open any folder of JPEG/PNG images directly, no recording required
  • ✂️ Frame editor
    • Trim left / Trim right of current position
    • Delete individual frames
    • Halve frame count (keeps parity from current position)
    • Append-reverse (bounce/ping-pong loop)
    • Full undo/redo (up to 50 steps)
  • 🔪 Splicer — mark split points to create named segments; navigate, delete, or export segments independently
  • 🎨 High-quality GIF export — two-pass ffmpeg palettegen + sierra2_4a dithering, per-frame exact timing
  • 🌐 Animated WebP export — single-pass libwebp, smaller files than GIF
  • ⏱️ Configurable delay — per-format delay spinner with a tunable step unit
  • 🚀 GPU-cached playback — all frames preloaded as GDK textures for smooth scrubbing
  • 🔥 Doom-fire background — 80×45 particle simulation running at ~30fps on every window

📦 Requirements

RustKlip shells out to external tools at runtime. You need:

Tool Version Notes
gst-launch-1.0 1.20+ GStreamer base tools
gst-inspect-1.0 1.20+ Used at startup to detect the best encoder
GStreamer plugins pipewiresrc, videoconvert, videorate, matroskamux, and either vah264enc (VA-API) or x264enc (libx264)
ffmpeg 5+ Frame extraction, palette generation, GIF/WebP encoding
Wayland compositor Must support the XDG Screencast portal (GNOME 41+, KDE 5.25+)
PipeWire 0.3+ Screen sharing back-end

On Arch / CachyOS:

sudo pacman -S gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad \
               gst-plugin-pipewire ffmpeg

On Ubuntu / Debian:

sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-base \
                 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
                 gstreamer1.0-pipewire ffmpeg

🔨 Build

cargo build --release

The binary lands at target/release/rustklip.

Rust toolchain: 2024 edition — requires Rust 1.85+.


🎬 Usage

🔴 Recording a new clip

  1. Launch rustklip.
  2. Set the desired framerate (default 30 fps).
  3. Click Record rectangle — the system screen picker appears.
  4. Select a monitor or window and confirm.
  5. The button changes to Stop recording. Record your content.
  6. Click Stop recording — frames are extracted automatically, then the preview window opens.

📁 Loading existing frames

Click Choose folder… and select a directory containing JPEG or PNG files (sorted by filename).

🖼️ Preview window

The preview window shows your frames with a scrubber and segment strip across the top.

▶️ Playback

Key Action
Space Play / Pause
, or Step back one frame
. or Step forward one frame

🛠️ Frame tools

Key Button Action
1 Trim left of Delete all frames before current
2 Trim right of Delete all frames after current
3 Delete frame Remove current frame
4 Halve frames Keep every other frame
5 Append Reverse Append the reversed sequence (bounce loop)
6 Reset cuts Restore original loaded frames
Ctrl+Z Undo Undo last edit
Ctrl+Y Redo Redo last undone edit

🔪 Splicer

Split the timeline into segments to export or delete sections independently.

Key Button Action
T Split here Add a split point at the current frame
Tab Next Seg Jump to the start of the next segment
D Delete Seg Delete all frames in the current segment
C Clear splits Remove all split points

💾 Export

Both GIF and WebP export open a file-save dialog.

Key Action
P Save GIF
L Save WebP
[ / ] Decrease / increase GIF delay by the delay unit
; / ' Decrease / increase WebP delay by the delay unit
J / K Decrease / increase the delay unit step (ms)

🏗️ Architecture

src/
├── main.rs              — GTK app entry, global CSS theme, Tokio runtime setup
├── capture.rs           — Portal handshake, GStreamer pipeline, ffmpeg frame extraction
├── export.rs            — GIF (two-pass palettegen) and WebP export via ffmpeg
└── ui/
    ├── mod.rs           — Module re-exports
    ├── load_window.rs   — Launcher window: record button + folder picker
    ├── preview_window.rs — Frame editor, splicer, playback, export UI
    └── fire.rs          — Doom-fire particle simulation (GTK DrawingArea overlay)

📄 License

MIT — see LICENSE.

About

An app for clipping GIFs and WEBPs in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages