ComfyUI-LoadGifAsVideo Introduction
ComfyUI-LoadGifAsVideo helps you use short animations as longer clips in a ComfyUI workflow. It can load an animated GIF, APNG, or WebP as a VIDEO stream, repeat an existing video for a chosen length, and help you find a clean loop within a longer video. It also lets you save the result as an animated GIF or WebP.
This is useful when a source animation plays only once but your project needs several seconds of continuous motion. Instead of manually duplicating frames and assembling a new video, you can choose a length in frames, seconds, or complete loops. If you are starting with footage that does not already loop, you can inspect its frames and look for a point where the end joins naturally to the beginning.
Screenshot of ComfyUI-LoadGifAsVideo
The extension provides five nodes:
| Node | What it helps you do |
|---|---|
| Load GIF as Video | Turn an animated GIF, APNG, or WebP into a VIDEO stream or an IMAGE batch. |
| Loop Video | Repeat any VIDEO stream, including a loaded video or generated clip. |
| Load Video (Trim & Loop Assist) | Choose and crop a range from a video file, with tools for finding a convincing loop point. |
| Save as GIF | Export a VIDEO or IMAGE batch as an animated GIF, with control over color, texture, size, and file weight. |
| Save as Animated WebP | Export an animation as WebP, with full color and a choice of lossy or lossless encoding. |
How ComfyUI-LoadGifAsVideo Works
Think of an animation as a sequence of pictures shown at a particular pace. Load GIF as Video reads those pictures and their timing, then produces a VIDEO stream that other VIDEO-compatible nodes can use. Loop Video repeats a stream from its beginning until it reaches your requested length; if necessary, it stops partway through the last repetition.
You can describe the desired length in three ways:
- Frames: Choose an exact output frame count.
- Seconds: Choose a running time.
- Loops: Choose a number of complete passes through the source.
For example, choosing three loops for a 12-frame animation produces 36 VIDEO frames. Choosing a length that falls between complete loops produces a clip that ends partway through a pass.
The VIDEO and IMAGE outputs handle speed differently. A VIDEO carries a frame rate, so Load GIF as Video and Loop Video can change playback speed without dropping frames from that output. An IMAGE batch has no frame rate of its own, so its speed is expressed in the frames instead: faster settings skip some frames, while slower settings repeat them. At a speed other than 1.0, the two outputs may therefore contain different numbers of frames while representing the same motion and running time when the IMAGE batch is played at the source rate.
Load Video (Trim & Loop Assist) works differently. It selects a portion of a video and keeps the file’s frame rate. Its speed setting changes which frames are emitted: 2 keeps every other frame, 0.5 repeats frames, and a negative value plays the selected range backwards. Connect its VIDEO output to Loop Video when you want that range repeated.
No node creates new in-between frames. When a speed or format change calls for different frames, the extension selects or repeats existing ones.
ComfyUI-LoadGifAsVideo Features
Load GIF as Video
Choose an animated GIF, APNG, or WebP from the ComfyUI input directory, then set length_mode to frames, seconds, or loops. The corresponding frames, seconds, or loops control determines the output length. A new node remains blank until you select a file; drag-and-drop upload is supported.
Set speed to 1.0 for the original pace or 2.0 for twice the pace. The node outputs both a video stream and an images batch, so you can connect it either to a VIDEO input or to a workflow that works with individual frames.
Because VIDEO has no transparency channel, use background to choose whether transparent parts of the source appear over black or white. If an animation gives different frames different delays, the node places its frames on a regular video timeline using the nearest source frame, without blending. Animations with a uniform delay pass through at their original timing.
Loop Video
Connect a VIDEO stream and choose an output length in frames, seconds, or whole loops. This works with a clip from ComfyUI’s stock Load Video node, a generated video, or Load GIF as Video.
At speed = 1.0, source audio repeats with the picture. The node fits the audio to one video loop before repeating it so each pass starts in sync. At other speeds, it drops the audio because changing only the video’s playback rate would put sound out of sync. If your finished clip needs retimed sound, handle the audio separately.
The node also provides an images output. Remember that a faster setting skips frames in this batch and a slower setting repeats them; use speed = 1.0 if you need every source frame preserved in the IMAGE output.
Load Video (Trim & Loop Assist)
This node loads a selected frame range from a video file in the ComfyUI input directory. It supports formats such as MP4, WebM, MKV, MOV, and AVI. Its outputs are the selected video, the same frames as images, the source fps, and the emitted width and height. You can crop the range before passing it to another node.
The built-in panel lets you scrub through the file, drag the start and end of a range, and position a crop box. Its Find similar control searches for frames that resemble the one under the playhead. Search results appear with frame numbers, times, and similarity scores, so you can inspect possible joins before committing to a loop.
A few controls are especially helpful when a match is hard to find:
similarity %: Lower it if a visible repeat is missing; raise it if too many near-matches appear. The default is 98 because repeated pictures in compressed footage may not be pixel-identical.frames: Require more consecutive frames to match when you want the motion after the join to line up, not just one still picture. The default is 1.grid: Use a finer comparison grid when small movements are being overlooked. Finer grids take more memory.crop only: Compare only the chosen crop, useful when your subject occupies a small area against a large background.metric: Trymotion-weightedwhen a still background overwhelms a moving subject in the standardpixelscomparison.blur: A small value can reduce the effect of grain or compression noise.range only: Search within a rough range you have already selected, reducing memory use on long files.
The end frame is excluded. For example, start_frame = 100 and end_frame = 340 output frames 100 through 339. If frame 340 looks like frame 100, that exclusion avoids displaying the matching picture twice when the range loops. The panel shows thumbnails for the start frame and the excluded end frame to help you judge the join.
The panel works directly on the file, so you do not need to queue the workflow to search for matches. For a container the browser cannot play in its preview, the panel can still show server-rendered frames for stepping, though preview playback is unavailable.
This node selects a range rather than setting a final clip length. Once you have a satisfying range, connect its VIDEO output to Loop Video. Audio from the range is retained only when speed = 1; changing or reversing the frame sequence drops audio to avoid an out-of-sync result.
Save as GIF
Connect either video or images, not both. A VIDEO supplies its own source frame rate; for an IMAGE batch, set source_fps to the rate at which those frames should play. The file is written to the ComfyUI output directory using filename_prefix.
A GIF has a limited palette, so its export settings let you trade color detail, texture, and file size:
| Setting | What you can change |
|---|---|
fps | Lower the output frame rate to drop frames while keeping approximately the same running time. Raising it above the source rate does not add duplicate frames. |
width, height, size_mode | Resize without stretching the source. pad makes an exact-size canvas with transparent bars; fit stays inside the requested box without bars; long_side sizes the source’s longer side to the longer requested dimension. Use 0 on both axes to keep the source size. |
resample | Choose how scaling looks. lanczos is the default; nearest keeps pixel art and hard edges crisp. Other choices are bicubic, bilinear, hamming, and box. |
colors | Choose a palette of 2–256 colors. Fewer colors can reduce file size but may make color steps more visible. |
palette_scope | Use one global palette for consistent colors throughout, or per_frame palettes when the scene changes substantially. Per-frame palettes can increase file size or cause color flicker. |
quantizer | Choose how the limited set of GIF colors is selected. |
dither, dither_strength | Control how colors outside the palette are approximated, from no pattern to a full-strength grain or screen. |
loop_count | Set 0 for endless replay or choose a limited number of replays. |
frame_diff, pillow_optimize | Test optional file-size optimizations and compare the actual result in info; either can be unhelpful for some material. |
gamma | Brighten midtones above 1 or darken them below 1, particularly useful with black or white halftone masks. |
Quantizers offer different starting points. median_cut_aforge is the default and gives predictable results on photographic material. median_cut_gifsicle emphasizes color regions by their size and visible brightness. diversity can preserve small, vivid accents that might otherwise be averaged away; blend_diversity gives a somewhat softer version of that approach.
Dithering determines the appearance of colors the palette cannot represent exactly:
nonegives a clean, often smaller file, but smooth gradients may show bands.- Error-diffusion choices such as the default
floyd-steinberg,burkes,stucki,jarvis-judice-ninke, the Sierra variants, andatkinsondistribute color error into nearby pixels. They offer different grain and contrast. bayer-2x2,bayer-4x4,bayer-8x8, andrandom-64x64produce position-based patterns. Ordered patterns stay fixed from frame to frame, which can be useful when animated grain appears distracting.- The
halftonefamilies create visible dot patterns. Square, diamond, and brick variants change the dots’ arrangement.halftone_sizecontrols their scale,halftone_stepscontrols tonal steps, andhalftone_inkchooses a black- or white-oriented screen. -maskvariants lay fixed black or white dots over the image’s palette colors.-mask-invertedvariants show the image through the dots instead.-postervariants deliberately reduce colors to an even RGB grid for a bold, graphic look; theirquantizerandpalette_scopesettings do not apply.
For a practical first pass, try the defaults, then lower fps if the file is too large. If color detail is the concern, compare colors and quantizer. If the animation has distracting moving grain, compare an ordered dither with error diffusion. The images output shows the resulting frames, while info reports the written file’s size and settings. Connect info to ComfyUI’s Preview as Text node to read it in the graph.
Only bars added by pad can be transparent in the saved GIF. VIDEO and IMAGE inputs do not carry transparency for the picture itself.
Save as Animated WebP
This node accepts either a VIDEO or an IMAGE batch and provides the same frame-rate reduction, sizing modes, resampling choices, and gamma tone control as Save as GIF. It does not need a GIF palette or dithering because WebP can retain full-color frames.
Choose between two encoding modes:
- Lossy, the default, is useful when you want a smaller file for photographic or detailed animation.
qualitycontrols the visual tradeoff from 0 to 100. Theimagesoutput is read back from the saved file, so you can judge what viewers will actually see. - Lossless preserves the encoded pixels exactly. In this mode,
qualitychanges compression effort rather than picture quality: higher values take more work but do not alter the pixels.
method sets how hard the encoder tries, from 0 for the fastest setting to 6 for a slower setting that aims for a smaller file. Use loop_count = 0 for endless replay. As with GIF, the info output reports the file that was actually written.
Troubleshooting ComfyUI-LoadGifAsVideo
The animation node says “No animation file selected”
- Open the
fileselector in Load GIF as Video and choose an animated GIF, APNG, or WebP. - If the file is not listed, put it in ComfyUI’s
inputdirectory or use the node’s supported drag-and-drop upload. - Confirm you selected an animated file rather than leaving a newly added node blank.
My loop has a visible jump or repeats one picture at the join
- Open the source in Load Video (Trim & Loop Assist) and scrub to a plausible starting picture.
- Select Find similar, then inspect promising results rather than relying on the score alone.
- Set
start_frameto the chosen beginning andend_frameto the matching frame at the end. The end frame will be excluded. - Compare the panel’s Start and End (excluded, loop returns here) thumbnails. Try another candidate if the subject’s motion still jumps.
- Send the selected range to Loop Video to check repeated playback.
Find similar misses a movement I can see
- If the moving subject is small, crop around it and leave
crop onlyenabled. - Try a finer
gridso the search can distinguish smaller changes. - If a still background dominates the comparison, try
motion-weighted. - Adjust
similarity %gradually. Lower it to reveal missed candidates; raise it when the list contains too many near-misses. - For a long file, select a rough range and enable
range onlybefore using a very fine grid.
The preview will not play my video file
The browser preview cannot play every video container. Try stepping through the server-rendered frames in the panel; the range controls and frame inspection still work. If you need playback in the panel, use a file whose container your browser supports.
My audio disappeared
Check which node changed the speed. Loop Video retains looped audio only at speed = 1.0, and Load Video (Trim & Loop Assist) retains the selected range’s audio only at speed = 1. Other speeds change or reverse the frames without retiming the sound, so the node drops audio rather than producing an out-of-sync clip.
The IMAGE output has a different frame count from the VIDEO output
For Load GIF as Video and Loop Video, this is expected when speed is not 1.0. VIDEO represents speed through its frame rate; an IMAGE batch must represent it by dropping or repeating frames. Set speed = 1.0 when you need a frame-for-frame IMAGE batch.
The GIF is too large
- Check
infoto see the size of the file that was written. - Lower
fpsto keep fewer frames over the same running time. - Reduce
widthorheightif the final display does not need the original resolution. - Test fewer
colorsor a differentdither, watching for unacceptable loss of detail. - For a mostly still scene, compare
frame_diffon and off. Its benefit depends on how much of each frame changes. - For a different balance of size and appearance, compare an animated WebP export.
Frequently Asked Questions
Can I make a short GIF play for a precise number of seconds?
Yes. In Load GIF as Video, set length_mode to seconds and enter the duration. The source repeats as needed and the output stops at the requested length.
Can I use a regular video instead of a GIF?
Yes. Connect an existing VIDEO stream to Loop Video. For a video that needs trimming or a better join first, use Load Video (Trim & Loop Assist).
Does changing speed create smoother in-between frames?
No. The extension uses existing source frames; it does not generate new motion.
Why does lowering GIF or WebP fps not slow my animation?
The save nodes drop frames to reduce the output rate while preserving the animation’s running time. To change playback speed, use the relevant load or loop node’s speed control.
Which export should I choose?
Choose Save as GIF when you want GIF output or its limited-palette and dithered appearance. Choose Save as Animated WebP when you want full color and a choice between lossy compression and exact-pixel lossless output.
Is there a limit to the number of frames?
Yes. The load and loop outputs are capped at 10,000 frames; the selected range and speed-adjusted output of Load Video (Trim & Loop Assist) are also capped at 10,000. If you reach the limit, shorten the requested length or selected range, or adjust speed.
Learn More about ComfyUI-LoadGifAsVideo
The screenshot shows the extension’s nodes in ComfyUI. For the most useful hands-on introduction, start with a short animation in Load GIF as Video, connect its VIDEO output to your intended VIDEO input, and compare frames, seconds, and loops. Then try Load Video (Trim & Loop Assist) on footage that has an imperfect join: its preview, matching results, and start/end thumbnails make the effect of each range choice visible before you run the full workflow.
