Basic video editing utilities #49

Merged
parkerhdavis merged 3 commits from video-editor into main 2026-06-04 18:24:54 -06:00
parkerhdavis commented 2026-06-04 18:24:10 -06:00 (Migrated from github.com)

Adds a base built-in video editor — the video equivalent of the image editing utilities — on a separate /edit-video route, mirroring the image editor's deferred-ops/commit model. Shells out to system ffmpeg/ffprobe (the posture thumbnails already use).

Features

  • Trim (in/out on a scrubbable timeline), crop / resize / rotate (90°), brightness / contrast / saturation / hue.
  • Export to MP4·H.264, WebM·VP9, MOV·H.264, MP4·H.265, GIF.
  • Frame-based preview: the canvas shows a frame extracted at the playhead (served via the media server) with crop/resize/rotate previewed client-side via the shared EditorCanvas/CropOverlay and color via a CSS filter — chosen because inline <video> is unreliable in Linux webkit2gtk.
  • Keyboard: Spacebar play/pause (frame-stepping playback within the trim range), [ / ] set trim in/out, plus a timeline play/pause button. Entry points: "Edit video" button + Ctrl/Cmd+E on the detail page (catalog and ad-hoc).

Color accuracy

The commit replicates the W3C/CSS Filter Effects math in RGB rather than ffmpeg's eq — eq's brightness is additive (CSS multiplies), runs in YUV, and tints neutral grays (~157 preview vs ~177 out of eq). Brightness×contrast fold into one lutrgb affine; saturate·hue premultiply into one colorchannelmixer; all in format=gbrp. Preview now matches output to ~1–3 levels.

Backend

  • New shared ffmpeg.rs (availability probe + concurrency limiter, extracted from thumbnails.rs).
  • New video_editor.rs: video_info (ffprobe), video_frame (preview), commit_video_edit (one ffmpeg invocation; writes to a temp sibling then renames so overwrite is safe). Pure filterchain/output-arg builders are unit-tested; an ffmpeg-gated integration test round-trips trim+crop+color.
  • make setup now probes ffprobe.

Deferred (follow-ups)

Audio track, transcode progress, native/<video> smooth playback, lossless stream-copy trim, video Automation steps, indexer video metadata, and the bundled-ffmpeg packaging story.

Adds a base built-in **video editor** — the video equivalent of the image editing utilities — on a separate `/edit-video` route, mirroring the image editor's deferred-ops/commit model. Shells out to system ffmpeg/ffprobe (the posture thumbnails already use). ## Features - **Trim** (in/out on a scrubbable timeline), **crop / resize / rotate (90°)**, **brightness / contrast / saturation / hue**. - **Export** to MP4·H.264, WebM·VP9, MOV·H.264, MP4·H.265, GIF. - **Frame-based preview**: the canvas shows a frame extracted at the playhead (served via the media server) with crop/resize/rotate previewed client-side via the shared `EditorCanvas`/`CropOverlay` and color via a CSS filter — chosen because inline `<video>` is unreliable in Linux webkit2gtk. - **Keyboard**: Spacebar play/pause (frame-stepping playback within the trim range), `[` / `]` set trim in/out, plus a timeline play/pause button. Entry points: "Edit video" button + Ctrl/Cmd+E on the detail page (catalog and ad-hoc). ## Color accuracy The commit replicates the **W3C/CSS Filter Effects math in RGB** rather than ffmpeg's `eq` — `eq`'s brightness is additive (CSS multiplies), runs in YUV, and tints neutral grays (~157 preview vs ~177 out of `eq`). Brightness×contrast fold into one `lutrgb` affine; saturate·hue premultiply into one `colorchannelmixer`; all in `format=gbrp`. Preview now matches output to ~1–3 levels. ## Backend - New shared `ffmpeg.rs` (availability probe + concurrency limiter, extracted from `thumbnails.rs`). - New `video_editor.rs`: `video_info` (ffprobe), `video_frame` (preview), `commit_video_edit` (one ffmpeg invocation; writes to a temp sibling then renames so overwrite is safe). Pure filterchain/output-arg builders are unit-tested; an ffmpeg-gated integration test round-trips trim+crop+color. - `make setup` now probes ffprobe. ## Deferred (follow-ups) Audio track, transcode progress, native/`<video>` smooth playback, lossless stream-copy trim, video Automation steps, indexer video metadata, and the bundled-ffmpeg packaging story.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
parker/garnet!49
No description provided.