Nodes/Eden.art nodesuite/Extend_Sequence
ComfyUI Node Runs on cloud

Extend_Sequence

Loop or ping-pong a frame sequence to any length β€” seamless animation loops

By edenartlabΒ·Created 3 years agoΒ·Updated 6 months agoΒ· 119
Extend_Sequence
  • images
  • IMAGE
β—„target_n_frames24β–Ί
β—„modeβ–Ύβ–Ί

Extend_Sequence is the node you reach for when you have a short run of frames and need a longer run of frames. You generated 12 frames of an animation and your video tool wants 24. Or you want a looping background that doesn't visibly restart. This node stretches a sequence to exactly target_n_frames using one of two strategies, and it's the rare "just do the math" node that video workflows genuinely depend on.

It's part of eden_comfy_pipelines, Eden.art's 70+ node suite, filed under Eden 🌱/Image.

What you set

  • images - the input frame stack as an IMAGE tensor (batch of frames).
  • target_n_frames - how many frames you want on the way out, default 24.
  • mode - the strategy, and this is the interesting choice:
    • wrap_around - just loops the sequence: A B C A B C A.... The catch: unless your sequence was built to loop, the seam where frame C meets frame A again will visibly jump. Use this when your animation already closes the loop.
    • ping_pong - plays forward, then reversed: A B C B A B C B A.... This is the workhorse for seamless looping, because the turnaround points are symmetric - frame A to B and B to A are both smooth transitions. Water ripples, clouds, fire flickers, camera bob - anything where you want infinite motion with no visible restart is ping_pong's territory.

One output, IMAGE, the extended sequence.

How it works

The mechanism is just fancy indexing: torch.arange(target_n_frames) % n_frames for wrap-around, and a mirrored index for ping-pong, then grab frames with that index array. No interpolation, no blending - it's pure repetition and mirroring. That's a feature: it's instant, deterministic, and never invents frames that weren't there.

Because it doesn't synthesize, the output frames are literally your input frames. That means quality is entirely up to your source sequence - if your 12 frames have a hard jump between frames 11 and 0, ping-pong saves you from that seam, but wrap_around will show it. If you need smooth in-between frames, pair this with a frame-interpolation node downstream; Extend_Sequence's job is just to hit the frame count.

Where it fits

Two common wiring patterns. First, feeding image-to-video: many video pipelines expect a specific frame count as the base sequence; extend your keyframes to that count and let the model generate between them. Second, looping video exports: generate a short clip, ping-pong it to whatever length your export node needs, and get an infinite-feeling loop with a clean turnaround.

A note on the input size: target_n_frames accepts very large values, but memory scales with output frames. Extending a handful of frames to a few hundred is nothing; don't ask it for 100,000 unless you enjoy OOM errors.

Installing it

Standard pack install - ComfyUI Manager (search "eden"), or:

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

Restart ComfyUI. Pure tensor indexing - no models, no keys, no downloads. If you've ever hand-built a looping animation by duplicating and reversing frames in an editor, this node just retired that chore.

CategoryEden 🌱/Image

Inputs (3)

NameTypeDefaultDescription
imagesIMAGEβ€”
target_n_framesINT241–9223372036854776000β€”
modeCOMBO2 options: wrap_around, ping_pong

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”