Skip to content

Crop clips in the editor and export the region - #221

Open
mintycw wants to merge 6 commits into
mainfrom
220-crop-export
Open

mintycw wants to merge 6 commits into
mainfrom
220-crop-export

Conversation

@mintycw

@mintycw mintycw commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Closes #220.

Ultrawide recordings used to go to ganked.tv whole and get cropped there. The editor now has a crop rectangle over the preview, and Save, Save as copy and Upload write only that region.

What's in it

  • crop.rs: the pure crop math (normalized rect, presets Original / 16:9 / 21:9 / 4:3 / 9:16 / Free, ratio-locked resize with anchored edges, even-pixel snapping for yuv420p), ported from ganked.tv's cropper with its test suite.
  • cropbox.rs: the overlay widget stacked over the preview and the fullscreen view. Eight handles, body drag, arrows move, shift+arrows resize, esc resets. It draws over the same contain rect the video shader uses, so the detail-page still switched from Cover to Contain.
  • export.rs: the one re-encode path in the app, through the bundled ffmpeg: trim and crop in one pass, libx264 at CRF 18 / veryfast, audio copied, progress on stdout, cancellable. Trim-only stays the lossless stream copy.
  • Library wiring: preset pills and an output-size readout under the preview, TRIM & CROP panel with progress and Cancel, upload crops locally first. The rectangle is editor state like the trim range, not persisted.
  • macOS bundles no ffmpeg, so the crop controls show a "needs ffmpeg" state, re-probed on each clip open until one is found.
  • ADR 0025 records why cropping lives at export and not at record time (ADR 0019 still holds for recording).
  • Also clears the chunks_exact lints the current stable clippy raises, so CI stays green when it moves.

Verified

  • cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings, rustfmt --check over every crate: green.
  • The ffmpeg-gated #[ignore] tests (real export of a synthesised clip, read back through our MP4 reader and the openh264 thumbnail path; upload crop temp) pass against ffmpeg 9.
  • Not yet checked by eye: the overlay on a real ultrawide clip in the running app, the Overwrite round-trip in the GUI, and the pill row at the narrowest window width. Worth a look on the Linux box before merging.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 09c1405e-157d-4bbf-a562-44ffd193ab47


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crop a clip in the editor and export the region

1 participant