逐帧独立 VAE 编码
Encode images one frame at a time so the Wan VAE can't leak across time
- images
- vae
- latent
Wan's VAE is a 3D VAE: it compresses along time as well as space, and its temporal attention means what one frame does influences its neighbors. That's usually a feature - it's how video latent frames stay temporally coherent. But when you feed it a batch of still reference images that aren't actually a video, that temporal attention becomes a bug: each image gets contaminated by the others, and a character's face in frame 1 starts bleeding into frame 5. This node exists to stop that.
SingleFrameVAEEncode takes an image batch, runs each frame through the VAE by itself - shape [1, H, W, 3] per pass, no neighbors - then concatenates the resulting single-frame latents along the time dimension. The output is one latent tensor with N frames where each frame was encoded as if it were the only one in existence. The node doc calls it out explicitly: it simulates EverAnimate's single-frame encode-and-replicate behavior, and it's the path this pack uses to build anchor latents for ComfyUI-EverAnimate projects, or for the "compatible mode" reference encoding in WanAnimateToVideoCustom.
Inputs and outputs
- images - the IMAGE batch. Each frame is encoded independently (required).
- vae - the Wan VAE (required).
Output is latent - the concatenated tensor. Feed it where you'd feed a latent reference video: into conditioning, or as the reference-latent anchor for a video model.
The trade-off to know about
Per-frame encoding costs you the temporal consistency the 3D VAE gives you, on purpose - that's the point when each frame is a different reference image that shouldn't influence its neighbors. But it also means the latent has no cross-frame coherence to lean on, so downstream you need the model's own conditioning to establish continuity. Use it for discrete reference frames, not for actual video footage; real footage should be batch-encoded so the temporal attention does its job. The node raises a clear error on an empty batch, which is the one failure mode you're likely to hit.
Install
Part of the ComfyUI-CustomNodeKit pack. ComfyUI Manager → search "ComfyUI-CustomNodeKit", or:
cd ComfyUI/custom_nodes
git clone https://github.com/user2318/ComfyUI-CustomNodeKit.git
cd ComfyUI-CustomNodeKit
pip install -r requirements.txt
Restart ComfyUI. No models to download - you're using the Wan VAE you already have for generation.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | 输入图像批次,每帧将单独编码。Input image batch, each frame will be encoded independently. | |
| vae | VAE | VAE 模型,用于将图像编码为潜在空间。VAE model used to encode images into latent space. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |