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

πŸ‡ Unroll Frames

Undo a roll even after interpolation changed the frame count

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

Roll Frames shifts where your loop starts. This is its quiet bookend: Unroll Frames puts the order back. And it handles the one case that makes a naive undo fail - when you rolled the clip, then ran it through a RIFE interpolator that multiplied the frame count, so the original offset no longer lines up with anything.

Here's the situation it exists for. Say you roll a clip by 1 to start it on a nicer frame. Now you interpolate it 2Γ— - every gap gained an in-between frame, so the clip is twice as long and the frame that used to be first isn't first anymore. If you try to undo the roll with a plain shift of 1, you're off by a frame and the clip's motion is wrong for the rest of its life. Unroll Frames knows to compensate: it rotates by base_offset Γ— (m+1), where m is the interpolation multiple. That extra +1 is the correction for the in-betweens that interpolation inserted into every gap.

The inputs that matter

  • images - your clip after interpolation (framesβ€²Γ—HΓ—WΓ—C).
  • base_offset - the exact offset that came out of Roll Frames' offset_out output. Don't retype it; wire it.
  • m - how many in-betweens per gap were added, i.e. the interpolation multiple. Set 0 if no interpolation happened, and the node just becomes a plain roll-back.

Installing it

WhiteRabbit pack, installed once:

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. Requires a current ComfyUI (v3 node API).

Where people get burned

  • Guessing m wrong. This is the whole ballgame. If you interpolated 2Γ— (one in-between per gap), m is 1, not 2. The multiply node's multiplier is the frame count per gap after interpolation minus one - match it to the number of inserted frames, and you're aligned.
  • Using the wrong offset. Always wire base_offset from Roll Frames' offset_out rather than typing a number. Rolled twice by different amounts, and you'll want the exact value, not a recollection.

Used correctly, the chain is Roll Frames β†’ interpolate β†’ Unroll Frames, and the output has your original motion ordering back with the new smoothness intact. Without the m correction, that chain would silently corrupt the whole clip - which is why this little node earns its keep.

Categoryvideo utils

Inputs (3)

NameTypeDefaultDescription
imagesIMAGEClip after interpolation (framesβ€²Γ—HΓ—WΓ—C).
base_offsetINT1-9999–9999Use the exact offset_out that came from RollFrames.
mINT00–9999How many in-betweens per gap were added (the interpolation multiple).

Outputs (1)

NameTypeDescription
imagesIMAGEβ€”