Nodes/comfyui-mixlab-nodes/Generate Frames By Count
ComfyUI Node Runs on cloud

Generate Frames By Count

Stretch a frame batch to an exact length

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
Generate Frames By Count
  • frames
  • frames
frame_count72
reverttrue

You have a batch of frames, and the next step in your pipeline wants a specific number of them - not however many you happen to have. This node takes your frames and produces exactly the frame count you ask for, filling out or looping as needed. It's a small plumbing node, but the kind that saves a workflow that otherwise chokes on a mismatched frame count.

What it's for

Video and animation nodes are often picky about length. An interpolator wants a set input size; a video model expects a fixed number of frames; you want a clip to hit a round duration. Rather than hand-tweaking your generation to land on the exact number, you let this node normalize the batch to the target. Give it 40 frames, ask for 72, and it produces 72 by looping or repeating your source frames to fill the gap.

The revert flag is the clever bit: with it on, the fill runs the frames forward and then back (a boomerang) instead of hard-cutting from the last frame to the first. That makes a padded loop feel seamless - the motion reverses rather than snapping, which hides the seam you'd otherwise see when a short clip loops.

The inputs

  • frames - your source image batch. Required.
  • frame_count - the exact number of frames you want out (default 72). This is the target the node fills to.
  • revert - true (default) adds a reversed pass so the sequence ping-pongs to fill length seamlessly; false fills without the reverse. Keep it on for loopable output, turn it off if a straight forward fill is what your downstream node expects.

Output is frames - an IMAGE batch of exactly frame_count length. Wire it into your combiner, interpolator, or video model.

Installing it

Get the pack via ComfyUI Manager (search mixlab, install comfyui-mixlab-nodes, restart), or clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-mixlab-nodes

then install requirements and restart. No downloads.

Common snags

  • The loop looks jerky at the seam. Turn revert on if it isn't - the boomerang pass is exactly what smooths the wrap-around. If it's already on and still rough, your source clip's first and last frames are just far apart in content; no amount of padding fixes that, you'd want proper frame interpolation.
  • Motion feels stretched or repetitive. Padding to a much larger count than you generated means repeating frames - it doesn't invent new in-between motion. If you need genuine smoothness at a higher frame count, pair this with an interpolation node (RIFE/FILM) rather than leaning on the fill.
  • Downstream node still complains about length. Double-check frame_count matches exactly what the next node wants. This node's whole job is to hit that number, so the fix is usually a one-field correction here.
Category♾️Mixlab/Video

Inputs (3)

NameTypeDefaultDescription
framesIMAGE
frame_countINT72
revertBOOLEANtrue

Outputs (1)

NameTypeDescription
framesIMAGE