Nodes/ComfyUI-SmartImageTools/Smart Images Processor
ComfyUI Node

Smart Images Processor

Trim frames and fix the fps after you load a video

By slvslvslv·Created about a year ago·Updated 24 days ago· 2
Smart Images Processor
  • images
  • images
  • fps
  • first_frame
  • last_frame
cut_start0
cut_end0
fps_reduction_factor1
fps

Loading a video into ComfyUI is only half the job - the clip almost never arrives in the exact shape you want it. Too long, too many frames, wrong duration, and if you cut frames yourself you break the fps metadata that downstream video nodes rely on. Smart Images Processor is the trim/decimate helper: it cuts frames off either end, skips frames to reduce the rate, and keeps the fps number correct the whole way through.

How it works

You feed it an IMAGE batch (frames along the batch dimension - the same shape every video loader in this pack produces) and it does three things:

  • cut_start / cut_end - how many frames to drop from the front and back. Cut the intro and outro in one pass instead of fiddling with two slice nodes.
  • fps_reduction_factor - a decimation step. A factor of 2 keeps every second frame and halves the effective fps; a factor of 3 keeps every third. It's a clean way to shrink a clip for quick previews or rough drafts.
  • fps (optional) - the original frame rate, wired in as a float. If you provide it, the node recomputes the output fps as fps / factor (flooring at 1.0) so the number that comes out actually matches the frames you kept.

The outputs hand you the pieces video workflows usually need: images (the trimmed batch), fps (the corrected rate), plus first_frame and last_frame as standalone single-frame images - handy for image-to-video seeds or first/last-frame conditioners.

Inputs and outputs

  • images - the frame batch.
  • cut_start, cut_end - frames to drop from each end.
  • fps_reduction_factor - frame skipping, default 1 (no skipping).
  • fps (optional) - the original frame rate.

Outputs: images, fps, first_frame, last_frame.

Installing it

From the ComfyUI-SmartImageTools pack:

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

Restart ComfyUI, or install via ComfyUI Manager ("SmartImageTools"). Pure tensor slicing - nothing heavy.

The honest warnings

The node guards against over-cutting: if your cuts remove all frames it returns empty tensors and logs a warning instead of crashing, which is friendly but means you should check for empty batches downstream. And note the fps input is a dot-only input (the widget is intentionally stripped) - you're expected to wire it from a loader like SmartLoadVideo, not type it in. Used right, it slots between your loader and your video model as the "make this clip the length I want" step.

CategorySmartImageTools

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
cut_startINT0
cut_endINT0
fps_reduction_factorINT1
fpsoptFLOAT

Outputs (4)

NameTypeDescription
imagesIMAGE
fpsFLOAT
first_frameIMAGE
last_frameIMAGE