Smart Mobius VAE Decode
Fix the VAE seam that ruins seamless Wan loops
- samples
- vae
- image
If you've ever made a Wan loop where the first and last frames meet but there's a visible "seam" flicker right at the join, you've met the 3D VAE problem. Video VAEs compress time as well as space - Wan's VAE squashes ~4 frames into one latent - and at the loop boundary that temporal compression produces an artifact where the end frame doesn't decode as if it's next to the start frame. Smart Mobius VAE Decode attacks exactly that seam.
It's the decode-side companion to this pack's SmartMobiusWanLoop: that node handles the denoising side of seamless looping, and this one fixes the VAE's contribution to the same goal. Use them together for a Wan 2.2 loop, or use this node alone on any looped latent that decodes with a boundary artifact.
How it works
Normal VAE decode treats every frame of the latent clip in order. The problem: a frame near the end has no awareness of the frames that should follow it (the loop's start frames), so it decodes with a "end of the world" bias. This node's frame-invariance mode is a neat workaround:
- Decode the full clip normally.
- Take the last
boundary_frameslatents and the firstboundary_frameslatents, and concatenate them into one wrapped chunk - end frames and start frames sitting next to each other. - Decode that wrapped chunk, so those boundary latents get full temporal context from both sides.
- Splice the correctly-contextualized boundary pixels back into the main decode.
The result: the loop point decodes as if the sequence really is continuous, killing the seam. The enable_frame_invariance toggle (default on) turns the whole thing off if you ever want a plain decode, and boundary_frames (2–5, default 3) controls how deep the correction reaches into the clip.
The inputs and outputs that matter
samples- the LATENT to decode.vae- the video VAE.enable_frame_invariance- the fix, on by default.boundary_frames- how many latent frames to wrap on each side.
Output: image (IMAGE), ready for a video combine node.
Where it shines
Seamless loop workflows on Wan - the "start image becomes end image, forever" style clips that used to be AnimateDiff's turf. The 4n+1 frame math of video VAEs already trips people up (N frames become ((N-1)//4)+1 latents), and this node is squarely aimed at the artifact that lingers even when you've gotten the frame counts right. Note the boundary_frames counts are latent frames, not output frames - 3 latent frames covers ~12 output frames at Wan's compression, which is more than enough for the join region.
Installing it
Part of SmartHelperNodes, installed with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/slvslvslv/ComfyUI-SmartHelperNodes
Restart ComfyUI, or use ComfyUI Manager ("SmartHelperNodes"). No pip dependencies, no model downloads.
Common issues
If your latent clip is shorter than boundary_frames × 2 + 1 latent frames, the node falls back to a plain decode - you'll see the seam again, but that's the safety valve working, not a crash. And if you only care about the seam at the start of the clip (say, an I2V where the first frame must stay locked), raise boundary_frames a bit and it will hold the head frames to the reference more firmly. For a true loop, keep the start and end frames close - this node removes the decode artifact, but it can't manufacture a loop the denoiser never made.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| vae | VAE | — | |
| enable_frame_invarianceopt | BOOLEAN | true | Decode boundary region with wrapped context to fix 3D VAE seam artifacts |
| boundary_framesopt | INT | 32–5 | Latent frames to wrap at each boundary side |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |