Nodes/Load GIF as Video/Load GIF as Video
ComfyUI Node

Load GIF as Video

Load GIF as Video — your GIF wants to loop, this node finally lets it

By id-fa·Created 2 months ago·Updated 14 days ago· 1
Load GIF as Video
    • video
    • images
    file
    length_modeframes
    frames16
    seconds2.0
    loops1
    speed1.00
    backgroundblack

    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. loops is the one that always lands on a clean loop boundary with no partial pass at the end.
    • speed - 1.0 is original speed, 2.0 plays 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 VIDEO type (comfy_api.input_impl). Older builds load the nodes fine, then raise this exact error at runtime. Update ComfyUI, not the pack.
    • images doesn't always have the same frame count as video. Speed is expressed as a frame rate on the VIDEO output, but an IMAGE batch carries no frame rate - so the node bakes speed into the frames instead. Slow down and frames duplicate; speed up and frames get dropped. If you need every source frame, leave speed at 1.0 and 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 speed on 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 black or white. If your GIF has hard black edges, flip background to white and 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.

    Categoryload-gif-as-video

    Inputs (7)

    NameTypeDefaultDescription
    fileCOMBOAnimated GIF / APNG / WEBP in the ComfyUI input directory.
    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 animation 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.
    backgroundCOMBOblackColor transparent pixels are composited over — VIDEO has no alpha channel.

    Outputs (2)

    NameTypeDescription
    videoVIDEO
    imagesIMAGE