Video Trim Upload (Purz)
Instant server-side trims that survive a browser reload
- video
If the client-side Video Trim node is the one with the pretty timeline, PurzVideoTrimUpload is the practical one. Upload a video once, set a start and end in seconds, and the node returns the trimmed segment as a VIDEO - instantly, because nothing gets re-encoded. It's the "I just need these 2.5 seconds, server-side, and I want it to still be there after I reload the page" node.
It's from purzbeats' ComfyUI-Purz pack, and it's the Upload flavor in the trim pair: the source file goes into ComfyUI's input/ directory and persists across browser reloads, along with your trim settings. The tradeoff versus the client-side trim is that you're editing with numbers, not a draggable timeline, and the file lives on disk rather than in your browser.
How it works
The trimming itself is the clever part. On execute the backend wraps the source with ComfyUI's VideoFromFile and calls as_trimmed(start, duration) - a lazy windowed read that just marks which bytes of the video to use, with no re-encode. A 90-second source trims as fast as a 3-second one. It also passes strict_duration=False, so if your requested end runs past the end of the source, you get a clip anyway instead of an error.
The node caches on the file's modified time plus your trim params, so re-queuing an unchanged trim short-circuits instantly.
The inputs that matter
- video - a dropdown of video files in
input/; upload via the node's button. It reads(no video)until you do. - trim_start_seconds - where the clip begins, default 0.
- trim_end_seconds - where it ends, default 1. The code clamps start at 0 and forces the end to be at least a hair past the start, so degenerate ranges won't crash.
Output is a single video (VIDEO), ready for a preview node or anything downstream that accepts the VIDEO type.
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 model downloads, no ffmpeg needed on your end.
Where people get burned
- It needs a modern ComfyUI. The
VIDEOoutput type depends on the newercomfy_apivideo plumbing. On older installs you'll get a tiny 64×64 black fallback frame plus[Purz ...]diagnostics in the console. Update ComfyUI before debugging anything else. - Numbers, not a timeline. You're setting seconds by hand -
trim_end_secondsfor a 45-second clip is45, fine, but precise frame-in-frame-out edits are what the client-side trim node's handles are for. This node is for "cut roughly here to here, fast, persistently." - The file stays in
input/. That's the point (reload persistence), but it means your source footage sits on disk under ComfyUI's input directory. If that bothers you, use the client-side Video Trim node instead. - No trim UI preview here. There's no Play Loop scrubber on the Upload variant - you set the numbers and trust them, or check the result in a downstream preview node.
The one-liner: if your trim is a "set it and forget it" cut that should survive a refresh and cost nothing to compute, this is the node. The client-side one is for interactive fine-tuning.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| video | COMBO | (no video) | 1 options: (no video) |
| trim_start_seconds | FLOAT | 0.0000–99999 | — |
| trim_end_seconds | FLOAT | 1.0000–99999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |