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

Video Trim (Purz)

Trim a video in the browser — the source never touches your server

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

    Clipping the good two seconds out of a twenty-second clip is the most annoying small task in a video workflow, mostly because every loader wants you to hand it a file path and pray. PurzVideoTrim flips it: you load the video into the node, drag two handles on a timeline to set in/out points, hit Play Loop to preview the exact segment, and on Queue it outputs the trimmed clip as a VIDEO. The kicker is where the trimming happens - in your browser.

    This is the client-side flavor from purzbeats' ComfyUI-Purz pack. The source file is wrapped in a blob URL and never uploaded; only the trimmed result is shipped to the backend. If you're working with footage you don't want sitting in ComfyUI's input/ directory, that's a real feature.

    How it works

    On Queue, the backend signals the node's frontend, which uses the browser's MediaRecorder to bake the in/out segment straight off the playing video (captureStream) into a webm blob - VP9/VP8 video with the audio preserved - and uploads that one small segment. The source file itself stays local. The tradeoff: baking takes about as long as the segment plays in real time.

    The dual-handle timeline is the whole UI. Drag the handles for in/out, click to seek, and Play Loop rewinds inside the handles so you preview exactly what'll render, not a guess.

    The inputs and outputs

    There are no numeric inputs to set - every control lives in the node's preview widget, which is why info_schema lists an empty required set. The single output is video, type VIDEO, which wires into any ComfyUI video preview or downstream video node.

    Install

    Same as every node in 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 "ComfyUI-Purz" via ComfyUI Manager). No model downloads - the dependencies are OpenCV, Pillow, NumPy, and torch.

    Where people get burned

    • State dies on refresh. The source video lives in the browser; reload the page and the node is empty. Reload-proofing is exactly what the Upload variant (PurzVideoTrimUpload) exists for.
    • Bake time ≈ playback time. A two-minute segment means roughly two minutes of wall clock while the browser plays and records it. Keep trims short and you'll never notice; don't trim a feature-length cut this way.
    • The fallback is a black square. If you queue before the bake lands, or ComfyUI is too old to speak the VIDEO type, the node returns a 64×64 black frame instead of your clip and prints [Purz ...] diagnostic lines in the console explaining the cache miss. Update ComfyUI and re-queue.
    • Pick the right variant. If you want the visual timeline and source privacy, this is your node. If you want a server-side, instant, no-re-encode cut that survives reloads, that's PurzVideoTrimUpload.

    It's the node you reach for when you need a quick segment for a video-to-video pass and don't want to stage files anywhere. The timeline UI is genuinely pleasant - drag, loop, queue, done.

    CategoryPurz/Interactive

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    videoVIDEO