ComfyUI Node

Loop Video

Loop Video — when your footage is 2 seconds and the video needs to be 20

By id-fa·Created 2 months ago·Updated 13 days ago· 1
Loop Video
  • video
  • video
  • images
length_modeframes
frames16
seconds2.0
loops1
speed1.00

Every video workflow hits this moment: you've got a perfect two-second clip - a camera pan, a flame loop, something you just generated - and the output needs to run for twenty. ComfyUI's stock Load Video happily plays those two seconds, and then the video just... ends. There's no native "repeat it" node. LoopVideo is that node.

It takes any VIDEO - an MP4 or WEBM from Load Video, a generated clip, or the output of its sibling LoadGifAsVideo - and repeats it until it fills the length you ask for: a frame count, a duration in seconds, or a number of whole playthroughs, at an adjustable playback speed.

Why you'd reach for it

Because most generated clips are short, and short clips don't fill a target runtime. LoopVideo is the closest ComfyUI gets to a one-node seamless loop; no stitching passes or last-frame-to-first-frame tricks required when all you want is the source repeated. It chains naturally too - feed it the output of LoadGifAsVideo and you've turned a one-second GIF into an arbitrarily long looped video with two nodes and zero custom wiring.

How it works

Mechanically it's simple and honest. Looping is a modulo over the source frames, the output frame rate is the source's rate times speed, and at speed = 1.0 the video output is a frame-exact copy of what you put in, just longer. Ask for fewer frames than the source and it truncates; ask for a length that doesn't divide evenly and it cuts off mid-loop. length_mode = loops is the one that always lands on whole passes - 3 loops of a 12-frame source is always exactly 36 frames.

The audio is where it gets interesting. At speed = 1.0 the node loops audio along with the frames: the source's audio is trimmed or zero-padded to fit exactly one video loop, then repeated, so every loop restarts in sync with frame 0 even when your source's audio and video tracks are different lengths. Change speed to anything else and only the frame rate changes, which would leave the audio drifting out of sync - so the audio is dropped entirely. That's a deliberate trade, and the honest one: silent beats unsynced. If you need retimed audio, handle it separately.

The inputs and outputs that matter

  • video - the clip to loop. Short material is the point, but it'll loop anything you give it, including another node's output.
  • length_mode - frames / seconds / loops, identical behavior to the GIF node in the same pack.
  • speed - 1.0 keeps everything frame-exact; other values scale the frame rate.

Outputs: video (VIDEO) and images (IMAGE), which carries the same speed baked into its frame selection - duplicate frames when you slow down, dropped frames when you speed up.

Installing it

Short version of the shared pack story: ComfyUI Manager (search "ComfyUI-LoadGifAsVideo"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/id-fa/ComfyUI-LoadGifAsVideo

Then restart. No extra dependencies - the pyproject.toml is empty and everything the node touches ships with ComfyUI.

Common issues

  • Audio disappears when you change speed. Not a bug. Audio is only kept at speed = 1.0 because any other speed desyncs it. Retime the audio separately if you need it.
  • "This ComfyUI build has no VIDEO support." You need a ComfyUI recent enough to have the native VIDEO type (comfy_api.input_impl). Older builds load the node but error at runtime with a message that tells you exactly what's missing - update ComfyUI.
  • images frame count doesn't match video at non-1.0 speed. Expected, same as the GIF node: speed is baked into the image batch's frames rather than expressed as a frame rate. Keep speed at 1.0 if you want the batch to be frame-for-frame identical to the source.
  • The 10,000-frame cap. Both outputs are capped, and exceeding it raises rather than OOMing. A low speed on a long clip can trip the cap on the images side first.

The honest framing: if your video is already the length you need, this node does nothing for you. Reach for it when the source and the target length don't agree - which, given how short generated clips tend to be, is most of the time.

Categoryload-gif-as-video

Inputs (6)

NameTypeDefaultDescription
videoVIDEOThe video to loop. Short clips are the point — MP4, WEBM, or another node's output.
length_modeCOMBOframesHow the output length is specified: a frame count, a duration in seconds, or whole playthroughs.
framesINT161–10000Number of frames to output (length_mode = frames).
secondsFLOAT2.00.01–3600Duration to output in seconds (length_mode = seconds).
loopsINT11–10000How many times the video plays through (length_mode = loops).
speedFLOAT1.000.01–100Playback speed multiplier. Scales the VIDEO output's frame rate; the IMAGE batch, which has no frame rate, gets the speed baked into its frames instead.

Outputs (2)

NameTypeDescription
videoVIDEO
imagesIMAGE