Video Crop Region
Crop the letterbox bars off a video without loading it all
- video
- video
VideoCropRegion crops pixels off the edges of a video - top, bottom, left, right - and returns the trimmed result as a new video. Simple operation, and on the surface it's the kind of thing you'd expect to be a stock ComfyUI feature. The reason it lives in this pack is the same reason the pack exists at all: doing a crop on a long video without decoding the whole thing into memory first.
How it works
Four crop inputs, one output:
crop_top,crop_bottom,crop_left,crop_right(all INT, default 0) - how many pixels to shave off each edge. All four default to 0, so if you wire nothing you get the video back unchanged.- Output:
video(VIDEO) - the cropped video, same frame rate as the source.
The mechanism is worth knowing because it's where the memory safety comes from. It reads the video's dimensions and frame count from metadata, then processes the crop in chunks (64 frames at a time by default): decode a chunk, crop it, release it, move on. Memory stays bounded no matter how long the file is - that's the pattern this whole pack uses, and it's why you can point this at a 30-minute file without watching your RAM bar spike.
Two details the code handles for you: the crop region is validated (you can't crop more pixels than the dimension has), and the output is auto-aligned to even dimensions. Video encoders and most diffusion video pipelines are picky about odd widths and heights, so if the crop leaves you with an odd number of pixels, it shaves one extra pixel off the trailing edge to keep everything even. You don't have to think about it.
Where you'd actually use it
Stripping black bars from a letterboxed clip is the textbook case - crop the bars, then feed the clean footage into a video model or a save node. Removing a burned-in timestamp or watermark strip. Or trimming a clip down to the content region before upscaling, so you're not wasting compute on borders. Because it keeps the crop even and chunked, it slots into "prep the footage before the heavy nodes" workflows without drama.
Common issues
- "Vertical crop >= height" / "Horizontal crop >= width." The error message says it plainly: you asked to remove more pixels than exist on that axis. Check your crop numbers against the source resolution (Video Load Preview gives you
widthandheightoutputs precisely for this). - Odd-dimension surprise. If you crop down to an odd size, the node quietly makes it even by dropping a pixel. If you then wonder why the output is one pixel narrower than the math said - that's it, and it's on purpose.
- The result is still a VIDEO. To see it or save it you need a save/preview node - Video Save from this pack, or the usual suspects.
Install
cd ComfyUI/custom_nodes/
git clone https://github.com/guchendesigndog/comfyui-video-edit.git
pip install -r comfyui-video-edit/requirements.txt
Or search "ComfyUI-Video-Edit" in ComfyUI Manager and restart. The only real dependency is PyAV (av>=10.0.0), which needs FFmpeg. Small MIT-licensed pack, solo author, no model downloads - the install is the whole cost, and the chunked-processing trick here is one of the pack's genuinely good ideas.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| video | VIDEO | — | |
| crop_top | INT | 00–8192 | — |
| crop_bottom | INT | 00–8192 | — |
| crop_left | INT | 00–8192 | — |
| crop_right | INT | 00–8192 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |