Nodes/WhiteRabbit/πŸ‡ Roll Frames
ComfyUI Node

πŸ‡ Roll Frames

Where your loop starts is a choice β€” this node makes it a setting

By Artificial-SweetenerΒ·Created about a year agoΒ·Updated about a month agoΒ· 82
πŸ‡ Roll Frames
  • images
  • images
  • offset_out
β—„offset1β–Ί

A seamless loop is a circle, and a circle has no natural starting point. But the moment you save it as a video file, it has one. Roll Frames is the tiny node that lets you choose it. It takes your clip and cyclically shifts the frame order - rotate by 1 and the second frame becomes the first, rotate by -1 and the last frame leads. The loop itself is unchanged; you've just changed where it begins.

Why would you care? Because a loop that starts on a high-energy frame and one that starts on a calm frame feel completely different even though the content is identical. If you're putting a looping background in a UI or a wallpaper, you often want the "invisible" part of the motion at the start or end - and finding that spot by hand means re-encoding the video a dozen times. Roll it instead.

How it works

It's a cyclic shift, pure and simple - the same operation as numpy.roll on the frame axis. offset is the amount and direction: positive rolls forward in time, negative rolls backward. Values wrap around the clip, so rolling a 60-frame clip by 60 is a no-op. Because it's a batch operation on tensors, it's instant regardless of resolution.

The one thing worth paying attention to is the second output, offset_out: it echoes back the offset you used. That's there for the pack's other node, Unroll Frames, which needs to know the exact offset to undo a roll after interpolation has multiplied the frame count. Roll first, interpolate, then unroll by the same offset - and the ordering comes out right again.

The inputs that matter

  • images - your clip (framesΓ—HΓ—WΓ—C).
  • offset - how far to rotate. Positive = forward, negative = backward.
  • images (output) - the rolled clip.
  • offset_out (output) - the offset, kept so you can undo it later.

Installing it

Standard WhiteRabbit install, done once for the whole pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Artificial-Sweetener/comfyui-WhiteRabbit
cd comfyui-WhiteRabbit
python -m pip install -r requirements.txt

or ComfyUI Manager β†’ "WhiteRabbit" β†’ install β†’ restart.

Where people get burned

  • Rolling after interpolation. If you roll then interpolate, the frame count changes and a plain roll back won't restore the original order - that's exactly what Unroll Frames is for. Feed it offset_out plus your interpolation multiplier.
  • Forgetting it's cyclic. Rolling a clip by its full length changes nothing; if your "new starting frame" looks identical, check whether your offset wrapped around to a no-op.

It's a one-trick node, but the trick is exactly what you need when a loop's starting frame is the last thing standing between you and a finished wallpaper.

Categoryvideo utils

Inputs (2)

NameTypeDefaultDescription
imagesIMAGEYour clip (framesΓ—HΓ—WΓ—C).
offsetINT1-9999–9999How far to rotate the clip. Positive = forward in time; negative = backward.

Outputs (2)

NameTypeDescription
imagesIMAGEβ€”
offset_outINTβ€”