Video Crop (FFmpeg)
Crop Video Frames Without Leaving the Graph
- video
- cropped_video
So your LTX or Wan output is 1280 wide and your timeline needs 9:16, or you generated at a resolution that doesn't match your upload target, and now you're about to tab out to an external editor like it's 2019. This node is the "don't bother" answer: it crops an IMAGE tensor of video frames - pixel-precise x/y/width/height - right inside the workflow, using FFmpeg under the hood. Feed it frames, get cropped frames back, wire them into whatever comes next.
It's a small, single-purpose pack from snomiao (MIT), and it shows up whenever people on r/StableDiffusion ask how to crop video in ComfyUI. The honest caveat they always add: there's no mouse selection. You type coordinates, you don't drag a box. If you want interactive cropping, look at OLM Drag Crop instead. If you just need a repeatable crop that's part of the pipeline - say, prepping generations for TikTok/Reels/Shorts vertical framing - this is the one.
How it actually works
The mechanism is worth knowing before you wire it in, because it's not a memory operation. The node writes every frame to a temporary PNG, re-encodes those into a temp video file with libx264, runs FFmpeg's crop filter at your x/y/width/height, then decodes the result back into a fresh IMAGE tensor. That round trip through a real encode is what makes this a "fits anywhere" node - but it's also the source of its quirks:
- It's slow. You're doing a full re-encode of every frame, twice, on the temp files. Fine for short clips, annoying for minutes of video.
- It's lossy. The temp encode is yuv420p, so your alpha channel doesn't survive. RGBA in, RGB out.
- Odd dimensions get rounded. yuv420p needs even dimensions, so the node force-scales the output to
trunc(iw/2)*2. Crop 513 wide and you get 512 back. If your downstream model cares about exact resolution, crop to even numbers yourself.
The inputs that matter
Most of the seven required inputs are self-explanatory, but a few deserve attention:
- x / y - top-left corner of the crop in pixels. Defaults to 0,0 (top-left);
maxis 4096, same as width/height. To center-crop, do the math: x = (input_width − crop_width) / 2. - width / height - crop box size. These default to 512×512, which is a decent "sanity" size but almost certainly not what you want for your first run. Set them to your target output resolution.
- quality - this is a CRF value, 0–51, lower is better (default 23, the FFmpeg default). It's passed as
crffor libx264/libx265 and VP9. One trap: it's ignored for prores, which hardcodesprofile:v=2- so don't chase quality settings on ProRes. - codec + output_format - libx264/libx265/VP9/ProRes in mp4, webm, avi, mov. For delivery to social platforms, libx264 + mp4 at CRF ~18–23 is the boring, correct choice.
The two optional inputs are fps (output frame rate, default 30) and extra_ffmpeg_args, where you can slip in things like -preset slow. Caveat: the parser splits on whitespace and assumes key-value pairs, so a bare flag like -preset with no value will silently do nothing.
The single output is cropped_video, an IMAGE tensor - the same type that came in, so you can chain it to a preview node, a save-video node, or another image processor.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/snomiao/ComfyUI-Video-Crop.git
Then restart ComfyUI. Or search "ComfyUI Video Crop" in ComfyUI Manager. The one real dependency beyond the usual (pillow, numpy, torch - all already in ComfyUI's environment) is ffmpeg-python, plus a system FFmpeg binary on your PATH. On Ubuntu that's sudo apt install ffmpeg, on macOS brew install ffmpeg, on Windows grab it from ffmpeg.org. If the node throws an "FFmpeg not found" style error, that's the thing to check first - the node itself is just a wrapper around the binary.
When to reach for it
Reach for it when cropping is a fixed, reproducible step in your pipeline - reformatting a generated clip for vertical social, trimming the frame region that lands in a model's attention, or normalizing outputs before a save node. It's a utility, not a headline feature: no models to download, no config to babysit. Just remember it re-encodes, keep your dimensions even, and don't expect ProRes quality tuning. For the price of typing four numbers, you never have to leave the graph.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| video | IMAGE | — | |
| x | INT | 00–4096 | — |
| y | INT | 00–4096 | — |
| width | INT | 5121–4096 | — |
| height | INT | 5121–4096 | — |
| output_format | COMBO | 4 options: mp4, webm, avi, mov | |
| codec | COMBO | 4 options: libx264, libx265, libvpx-vp9, prores | |
| quality | INT | 230–51 | — |
| fpsopt | FLOAT | 30.01–120 | — |
| extra_ffmpeg_argsopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cropped_video | IMAGE | — |