Nodes/ComfyUI-FrameSkipping/Frame Truncating
ComfyUI Node

Frame Truncating

Keep the head, drop the tail — truncating a clip to its first N frames

By baicai99·Created 2 years ago·Updated about a year ago· 15
Frame Truncating
  • images
  • truncated_images
keep_frames10

Frame Truncating is the mirror image of its packmate Frame Skipping. Where Frame Skipping throws away the first N frames, Frame Truncating keeps the first N and throws away the rest - images[:keep_frames], a single torch slice, no dependencies, no models. That's the whole mechanism, and for a utility node that's a feature, not a limitation.

It exists for a very specific workflow shape, and the author is explicit about it: AnimateDiff's context window is 16 frames, and the classic trick is to process the first 16 frames one way and everything after another way. Frame Truncating is the "keep only the first 16" half; Frame Skipping is the "skip the first 16" half. Chain them off the same input batch and you can send the head down one path (say, a lower-denoise pass) and the tail down another, then stitch both back into one clip. That's the entire reason this pack exists - the author built it for a video where a hand's texture changes on touching an object, which meant splitting the clip into precise sections instead of one clean cut down the middle.

The input you actually set is keep_frames (default 10). The output is truncated_images, and it plugs into anything that takes an IMAGE batch - a sampler, a VAE encode, a concat node for the splice on the way out. There's a nice safety behavior baked in: if keep_frames is greater than or equal to the total frame count, the node just returns your original images unchanged instead of erroring. That's the opposite of Frame Skipping, which returns an empty tensor in the same situation - if you're swapping between the two, don't assume they fail the same way.

One real caveat before you reach for it: this is a blunt instrument. It keeps the head and discards everything after, full stop - no "keep frames 16 to 32," no offset. If you need a range in the middle of the clip, that's Frame Selector's job (same pack), which gives you start/end plus a num_frames output. Frame Truncating is specifically for "everything up to N," and it does exactly that.

Install is the same as the rest of the pack: ComfyUI Manager → search "ComfyUI-FrameSkipping", or git clone https://github.com/baicai99/ComfyUI-FrameSkipping into custom_nodes, then restart. There's no requirements.txt - it's pure torch, which ComfyUI already ships - and no model files to chase down. Cheap to install, cheap to run, and quietly useful the moment your video needs a different head and tail.

Categorybaicai/picture

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
keep_framesINT10

Outputs (1)

NameTypeDescription
truncated_imagesIMAGE