Skip to content

Trim and crop

Khryz-Navarro edited this page Nov 9, 2026 · 1 revision

Status: Planned · Phase 2 of the Roadmap · Issue #30

What it does

Cut a video down to the part you want, crop it, or change its shape, for example 16:9 to 9:16 for phones or 1:1 for posts.

How it would work

  • Where: in the Tools tab, on a file you pick or one you just downloaded.
  • Previewing:
    • The page plays the video so you can set the start and end and see the crop box.
    • That needs Tauri's asset protocol, with a scope limited to the one file the backend opened. It's a new entry in capabilities/.
    • The content security policy in tauri.conf.json has to allow that media source.
  • Trimming:
    • ffmpeg -ss START -to END.
    • Fast mode copies the streams (-c copy). It's instant, but cuts at the nearest keyframe.
    • Exact mode re-encodes, cutting at the exact frame.
  • Cropping and reshaping: ffmpeg's crop filter for a chosen area. For a new aspect ratio, either:
    • crop to fill: cut the sides off;
    • fit with bars: scale plus pad, with black or blurred bars.
  • The code:
    • The numbers from the page (times, crop box) are checked in the backend: inside the video's length and size, and whole pixels.
    • They're turned into filter arguments in a pure, tested function in src/ytdlp.rs.
    • Nothing from the page goes to ffmpeg as text.

Open questions

  • Several cuts from one video (keep 0:10–0:20 and 1:00–1:30) and join them? It's more complex, so maybe later.
  • Should the crop box snap to common ratios (16:9, 9:16, 1:1, 4:5)?

Risks

  • Playback limits: the page's video player (WebView2 on Windows, WebKitGTK on Linux) can't play every format, such as some MKV or HEVC files. A fallback is to show still frames ffmpeg extracts at the chosen times.
  • Fast-mode cuts: they can start up to a few seconds early. The page has to explain that clearly.

Home

Roadmap

Phase 1: links you paste

Phase 2: tools for your files

Phase 3: new engines

Phase 4: beyond the desktop

Clone this wiki locally