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

Video Crop Upload (Purz)

Crop or reframe a whole video without ever opening a video editor

By purzbeats·Created about a year ago·Updated 3 months ago· 24
Video Crop Upload (Purz)
    • video
    video(no video)
    width1024
    height1024
    fit_modecover
    anchorcenter
    background_color#000000
    zoom1.00
    offset_x0.00
    offset_y0.00

    Video diffusion models are picky about aspect ratio and resolution - feed Wan or LTX a 1920×1080 clip when the model wants 1024×1024 and you'll fight the pipeline the whole way down. PurzVideoCropUpload is the "fit this video to those dimensions" node: upload a clip, pick a target size and a fit mode, and it hands you back a VIDEO at exactly that resolution, audio intact. No ffmpeg, no leaving ComfyUI.

    It's one of the two crop flavors in purzbeats' ComfyUI-Purz pack. The Upload suffix means your source file goes into ComfyUI's input/ directory and persists across browser reloads - reload the page and the video, the crop settings, everything is still there. (The plain Video Crop node does the same job client-side, source never touching the server, but loses state on refresh.)

    How it works

    On queue, the backend reads the source from input/ and resizes it frame by frame with OpenCV - INTER_AREA when scaling down, INTER_LANCZOS4 when scaling up, roughly 10× faster than the old per-frame PIL path. The fit modes are the classic four:

    • stretch - squish the source to fill the target, aspect ratio be damned.
    • cover - scale to fill, then crop the overflow using the anchor (center, top, bottom, left, right, corners).
    • contain - scale to fit inside, letterboxing the leftover with background_color.
    • crop - like cover, plus manual zoom and offset_x / offset_y so you can punch in and reposition by hand.

    Audio passes through. The output is a ComfyUI VIDEO, so it plugs straight into a video preview node or anything downstream that eats the VIDEO type.

    The inputs that matter

    • video - a dropdown of video files in input/; upload one via the node's button. It'll read (no video) until you do.
    • width / height - 16–16384, default 1024. The target canvas.
    • fit_mode - stretch / cover / contain / crop. cover is the sane default.
    • anchor - where the crop window sits when you're cropping; center is right most of the time.
    • background_color - the letterbox color for contain.
    • zoom / offset_x / offset_y - only active in crop mode; offsets are normalized −1…1.

    Output is a single video (VIDEO).

    Install

    Standard for this pack:

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

    then restart ComfyUI (or install "ComfyUI-Purz" from ComfyUI Manager). Requirements are OpenCV, Pillow, NumPy, and torch - no models to download.

    Where people get burned

    • It needs a modern ComfyUI. The node outputs the VIDEO type, which depends on the newer comfy_api video support. On an old install the node still loads but hands back a tiny 64×64 black fallback frame and prints diagnostic lines in the console. Update ComfyUI first.
    • This is a re-encode, not a passthrough. It's fast, but the clip is resized frame-by-frame and muxed back; don't expect a byte-identical stream.
    • Big targets get slow and hungry. The max is 16384 on a side - nobody actually wants that. 1024–2048 is where this node stays comfortable.
    • Pick the right flavor for the job. If you need persistence across reloads and don't mind the source sitting in input/, use this one. If you'd rather the source never leave your browser, use the client-side Video Crop node instead.

    If you're normalizing source footage before a video pass, cover + center at the model's native size is the setup you'll use 90% of the time.

    CategoryPurz/Interactive

    Inputs (9)

    NameTypeDefaultDescription
    videoCOMBO(no video)1 options: (no video)
    widthINT102416–16384
    heightINT102416–16384
    fit_modeCOMBOcover4 options: stretch, cover, contain, crop
    anchorCOMBOcenter9 options: center, top, bottom, left, right, top-left, +3
    background_colorSTRING#000000
    zoomFLOAT1.000.1–10
    offset_xFLOAT0.00-1–1
    offset_yFLOAT0.00-1–1

    Outputs (1)

    NameTypeDescription
    videoVIDEO