VAE Decode Loop KJ
Kill the seam on a looping video
- samples
- vae
- IMAGE
Made a looping video and noticed a little flicker or hitch right where the end meets the start? That seam is often a VAE decode artifact, not a problem with your generation. VAE Decode Loop is a drop-in replacement for the standard VAE Decode that fixes it, decoding video latents with overlap at the loop boundary so the join blends smoothly. If you're making seamless loops - AnimateDiff cycles, Wan loops, anything meant to repeat forever - this is the decode node you want.
It's part of KJNodes, kijai's utility pack. Kijai wrote a lot of the community's video-model plumbing, so a node like this - a small, targeted fix for a real video-workflow annoyance - is exactly the kind of thing that ends up here.
How it works
Video VAEs compress time as well as space - the Wan VAE, for instance, compresses roughly 4× along the time axis, so each latent frame stands in for several pixel frames. When you decode a loop, the model has no idea the last frame is supposed to flow back into the first, so the boundary can decode slightly differently and you see a pop. This node decodes with a few overlapping latent frames across that seam and blends them, so the transition from end to start is continuous instead of abrupt.
The inputs and output that matter
- samples - the video latent to decode.
- vae - your VAE.
- overlap_latent_frames - how many latent frames to overlap and blend at the loop seam (default 2, up to 8). Because these are latent frames, each one covers several actual frames after decoding. Bump it up if the seam still shows at the default; keep it modest since more overlap blends more of the boundary.
The output is the decoded IMAGE batch - your frames, with a clean loop point.
Installing it
ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt, and restart.
Where people get burned
- Using it on non-looping video. The overlap-blend only makes sense when the clip actually loops. On a normal one-shot video it does nothing useful and can subtly blend a boundary that shouldn't be blended - use the standard VAE Decode there.
- Expecting it to fix mid-clip flicker. This targets the loop seam specifically. Flicker scattered through the clip is a different problem (sampling, caching, or the model itself), not something a seam-aware decode addresses.
- Cranking overlap too high. More
overlap_latent_framessmooths the seam but also averages more of the boundary together, which can soften real motion at the loop point. Raise it only as far as you need to make the pop disappear.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | The latent to be decoded. | |
| vae | VAE | The VAE model used for decoding the latent. | |
| overlap_latent_frames | INT | 22–8 | Number of frames to blend for seamless loop, for Wan 2 works and HunyuanVideo 1.5 should use 4 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | The decoded images. |