Load GIF as Video
Load GIF as Video — your GIF wants to loop, this node finally lets it
- video
- images
Animated GIFs are drawn to loop forever. That's the whole point of the format - a one-shot GIF is a mistake. So it's genuinely weird that ComfyUI's stock Load Video node opens a GIF and plays it exactly once before ending. One pass of a looping animation is almost never the clip you actually wanted, and turning that loop into usable video material meant hand-rolling a chain of image-batch loaders, frame counters and Create Video nodes.
LoadGifAsVideo fixes it at the source. It reads an animated GIF (plus APNG and animated WEBP) straight from your ComfyUI input folder and hands you a real VIDEO stream that loops for as long as you ask - a frame count, a duration in seconds, or a number of whole playthroughs - at whatever playback speed you like.
Why you'd reach for it
Video-to-video work, mostly. Drop a looping flame, a spinning fan, or a walk cycle into an image-to-video pipeline and you've got clean starting material instead of a source that dies after two seconds. It's also just the tidy way to stretch a one-second GIF into a five-second clip without gluing five nodes together. The KB's video coverage is all about the generative side - LTX, Wan, AnimateDiff - and treats the input stage, getting footage into the graph, as an afterthought. This pack is that missing input stage for anything animated.
How it works
Pillow's ImageSequence decodes every frame, transparency gets composited over a background color (black or white, since VIDEO carries no alpha), and because a GIF can give each frame a different delay while a video has exactly one frame rate, variable-delay animations are resampled onto their own average rate with a nearest-frame hold - no blending. A quirk worth knowing: GIFs that declare 0ms or 10ms delays mean "as fast as possible," and like every browser, the node substitutes 100ms. Looping itself is just a modulo over the source frames, and the output frame rate is the source's own rate multiplied by speed. Nothing is interpolated, so at speed = 1.0 the output is a frame-for-frame copy.
The inputs and outputs that matter
file- the animated file, picked from a dropdown of everything in your input directory. Drag-and-drop upload works. A fresh node starts blank and politely reports "No animation file selected" until you pick one.length_mode-frames/seconds/loops. Pick a frame count, a duration, or exact whole playthroughs.loopsis the one that always lands on a clean loop boundary with no partial pass at the end.speed-1.0is original speed,2.0plays twice as fast. It scales the output frame rate rather than dropping frames.
Outputs: video (VIDEO) feeds Save Video or any other VIDEO input; images (IMAGE) is the same footage as an image batch, ready to go straight into a sampler without a Get Video Components detour.
Installing it
Install is two lines and there's nothing heavy behind it. ComfyUI Manager (search "ComfyUI-LoadGifAsVideo"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/id-fa/ComfyUI-LoadGifAsVideo
Then restart ComfyUI. No extra Python dependencies - Pillow, NumPy and PyTorch all ship with ComfyUI, and the pack's pyproject.toml confirms an empty dependency list.
Common issues
The gotchas are few, and all telegraphed clearly:
- "This ComfyUI build has no VIDEO support." The one hard requirement is a ComfyUI recent enough to have the native
VIDEOtype (comfy_api.input_impl). Older builds load the nodes fine, then raise this exact error at runtime. Update ComfyUI, not the pack. imagesdoesn't always have the same frame count asvideo. Speed is expressed as a frame rate on the VIDEO output, but an IMAGE batch carries no frame rate - so the node bakesspeedinto the frames instead. Slow down and frames duplicate; speed up and frames get dropped. If you need every source frame, leavespeedat1.0and change the rate downstream.- The 10,000-frame cap. Output is capped, and exceeding it raises instead of trying to allocate memory. A very low
speedon a long clip can hit the cap on the images side while the video output is still well under it. - Transparent GIFs. There's no alpha in VIDEO, so transparency is composited over
blackorwhite. If your GIF has hard black edges, flipbackgroundtowhiteand see if that's the culprit.
The name is honest, which is the nicest thing about it: no API, no key, no ffmpeg wrapper - just the one job, done properly.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| file | COMBO | Animated GIF / APNG / WEBP in the ComfyUI input directory. | |
| length_mode | COMBO | frames | How the output length is specified: a frame count, a duration in seconds, or whole playthroughs. |
| frames | INT | 161–10000 | Number of frames to output (length_mode = frames). |
| seconds | FLOAT | 2.00.01–3600 | Duration to output in seconds (length_mode = seconds). |
| loops | INT | 11–10000 | How many times the animation plays through (length_mode = loops). |
| speed | FLOAT | 1.000.01–100 | Playback 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. |
| background | COMBO | black | Color transparent pixels are composited over — VIDEO has no alpha channel. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |
| images | IMAGE | — |