Nodes/ComfyUI-Purz/Video Crop (Purz)
ComfyUI Node

Video Crop (Purz)

Crop a clip by dragging a box, not doing math

By purzbeats·Created about a year ago·Updated 3 months ago· 24
Video Crop (Purz)
    • video

    Crop-and-resize a video is normally a "load the clip, count frames, punch in pixel coordinates, pray" exercise. PurzVideoCrop replaces all of that with a live preview and a draggable green box. You load a local video straight into the node, drag the crop rectangle to where you want it, pick a fit mode, and the node hands you a VIDEO that's ready for the rest of your video pipeline. It's the video sibling of the pack's Image Crop node, and it's the kind of thing that makes you wonder why every crop tool isn't this.

    It's from ComfyUI-Purz by PurzBeats - a Comfy Org staffer - and it sits in the Purz/Interactive category, a family of nodes that load their own media instead of demanding an upstream loader.

    How it works

    The clever bit is where the work happens. PurzVideoCrop is the client-side flavor: the source file stays in your browser the whole time - it never touches the server until you queue the workflow. On the preview canvas (capped at 720px on its longest side for smoothness), you drag the green overlay to set the crop window, pick from 14 aspect-ratio presets (1:1, 16:9, 9:16, 21:9, and friends), and choose a fit mode: Stretch (squish to fit), Cover (anchor-positioned crop), Contain (letterbox with a background color), or Crop (Cover plus manual zoom and offset). When you hit Queue, the node bakes the result in-browser via <canvas> + MediaRecorder - audio passes through - and ships the finished clip up once. Bake time is roughly the playback duration of the clip, so a two-minute video takes about two minutes.

    The upload variant, PurzVideoCropUpload, does it differently: the file lands in ComfyUI's input/ directory and the server resizes it with OpenCV (INTER_AREA for downscaling, INTER_LANCZOS4 for upscaling), which is dramatically faster on long clips and survives a browser reload.

    What you set

    The node itself takes no graph inputs - everything lives in the widget UI, driven by the unique_id of the node. The parts you actually interact with: the draggable crop overlay (anchor and offset_x/offset_y update automatically as you drag), the aspect-ratio presets, the fit mode dropdown, output width/height, and playback controls that let you watch the clip with audio while you frame it.

    The single output is video, type VIDEO, which wires straight into ComfyUI video combiners or the pack's own Media Extractor for pulling a frame out of the result.

    Installing it

    ComfyUI Manager - search ComfyUI-Purz - or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/purzbeats/ComfyUI-Purz.git
    cd ComfyUI-Purz
    pip install -r requirements.txt
    

    Then restart. Requirements are OpenCV, Pillow, torch, numpy - the OpenCV bit matters here since the server-side resize path leans on it, but you almost certainly have it. No models to download.

    Where people get burned

    The client-side bake outputs webm (VP8/VP9 + opus), so don't expect the original container back - if you need an exact codec, use the upload variant or re-encode downstream. And since the source file lives in the browser, state doesn't survive a page refresh; if you're tweaking a crop across sessions, use PurzVideoCropUpload instead. Also worth knowing: the crop is baked at queue time, not continuously, so every parameter change means another bake on the next run.

    CategoryPurz/Interactive

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    videoVIDEO