WanVideoLongCatAvatarExtendEmbeds
The node that makes a LongCat talking head longer than one window
- prev_latents
- audio_embeds
- ref_latent
- samples
- prev_images
- vae
- image_embeds
- samples_slice
What this thing actually does
LongCat-Video-Avatar is Meituan's audio-driven talking-head model - filed by the community as "smoother, more realistic talking vids but it ain't exactly instant." The quality end of the avatar spectrum; InfiniteTalk is the fast end. It isn't a Wan model at all; it just ships inside Kijai's WanVideoWrapper because the plumbing was close enough.
One generation gets you one window - 93 frames, about six seconds at 16 fps. Longer needs a second pass, and a naive second pass drifts the face, desyncs the mouth by a fraction of a second, and loops the body gesture. This node is the glue for pass two, three and eight: previous latents in, overlap kept, next audio slice aligned, a bundle out. Chain one copy per window, bumping frames_processed each time.
How the mechanism works
Latent continuation. With overlap above zero it keeps the tail of the previous latents as conditioning. The VAE compresses time about 4x, so overlap in latent frames is ((overlap - 1) // 4) + 1 - the 13-frame default is four latent frames of context, not thirteen. They ride along in the embeds as an extra conditioning latent, which the sampler reads as already-decided frames at the head of the new window. overlap=0 means no continuation, i.e. text-to-video.
Audio windowing. MULTITALK_EMBEDS hold per-frame audio features for the whole clip. The node derives a start index from frames_processed - overlap and slices exactly num_frames worth, so window two gets window two's audio. Misfeed frames_processed and you get the wrong slice - the "why is he saying that line again" bug.
Reference attention masking. LongCat conditions on a reference latent sitting at a RoPE temporal position you set with ref_frame_index. The failure mode is entropy collapse - it likes that pose so much it repeats it. ref_mask_frame_range drops reference attention for a span of frames around that position, freeing them to invent motion.
Inputs that matter, and the two outputs
prev_latents- the previous sampler'sLATENToutput, full length. On the first window Kijai's example feeds the encoded still in here withoverlap=1, pinning frame one to your image.audio_embeds-MULTITALK_EMBEDS, full length, fromMultiTalkWav2VecEmbeds(v1.0) orLongCatAvatarWhisperEmbeds(v1.5, Whisper-large-v3).num_frames/overlap- 93 frames per window, 13 overlapping, ceiling 256 and 16. Keepnum_framesat 4n+1 or you'll come up short after encoding; bigger overlap is a smoother seam and less new content.frames_processed- frames generated so far. Increment by your window length every pass, or the chain lies.ref_frame_index/ref_mask_frame_range- the anti-repetition pair. Tooltip suggests 0–24 for consistency, higher values (like 30) to break loops, and 3 as a sane mask range; wider helps more but smears.
Optional ref_latent wants the init image latent, for identity lock. samples is the vid2vid path: the sampler's samples get sliced per window. The 1.5-only pair, prev_images plus vae, re-encodes the trailing overlap decoded frames through the VAE as overlap conditioning instead of slicing latents. Both or neither.
Two outputs: image_embeds (WANVIDIMAGE_EMBEDS) into the sampler's image embeds input, and samples_slice (LATENT) into its samples input for vid2vid.
Installing it
ComfyUI Manager, search "ComfyUI-WanVideoWrapper", or by hand (deps are accelerate, diffusers, peft, gguf, pyloudnorm):
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
pip install -r ComfyUI-WanVideoWrapper/requirements.txt
On a portable install, swap pip for python_embeded\python.exe -m pip and run it from the ComfyUI_windows_portable folder.
Weights: the Avatar checkpoint into ComfyUI/models/diffusion_models (Kijai's conversions live under Kijai/LongCat-Video_comfy), a Wan 2.1 VAE, a UM-T5 text encoder, Wav2Vec2 in models/wav2vec2 or Whisper large-v3 for 1.5. Then load the bundled LongCatAvatar_audio_image_to_video_example_01.json before building your own - three chained copies of this node, wired right.
Where people get burned
bf16 only, and SageAttention 1.0.6 is broken with it. Both straight from Kijai's workflow notes. Don't get clever with a quantized checkpoint; if attention output looks like noise, that's suspect one.
The old LongCat distill LoRA isn't for the Avatar model. Kijai warns it hurts extension specifically - the thing this node does.
The node is missing from the menu. LongCat is an optional module in the pack's __init__.py. If its import fails, the pack logs WanVideoWrapper WARNING: LongCat nodes not available: … and loads the rest fine. Read the startup log before reinstalling.
A visible seam, or an obvious loop. Seam: raise overlap and make sure stitching drops the duplicates - the example uses KJNodes' ImageBatchExtendWithOverlap. Loop: nudge ref_frame_index up, widen the mask range to 5–7.
Not enough audio features in the console. Audio shorter than the window pads per if_not_enough_audio: pad_with_start holds frame one, mirror_from_end plays the tail backwards. Harmless at the very end, a red flag elsewhere.
VRAM. LongCat is a 48-block model and block-swaps; reports put Avatar 1.5 near 16GB, and the example swaps 25 blocks.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prev_latents | LATENT | Full previous latents to be used to continue generation, continuation frames are selected based on 'overlap' parameter | |
| audio_embeds | MULTITALK_EMBEDS | Full length audio embeddings | |
| num_frames | INT | 931–256 | Number of new frames to generate |
| overlap | INT | 130–16 | Number of overlapping frames from previous latents for video continuation, set to 0 for T2V |
| frames_processed | INT | 00–10000 | Number of frames already processed in the video, used to select audio features |
| if_not_enough_audio | COMBO | pad_with_start | What to do if there are not enough frames in pose_images for the window |
| ref_frame_index | INT | 100–1000 | Values between 0 - 24 ensures better consistency, while selecting other ranges (e.g., -10 or 30) helps reduce repeated actions |
| ref_mask_frame_range | INT | 30–20 | Larger range can further help mitigate repeated actions, but excessively large values may introduce artifacts |
| ref_latentopt | LATENT | Reference latent used for consistency, generally should be either the init image, or first latent from first generation | |
| samplesopt | LATENT | For the sampler 'samples' input, used for slicing samples per window for vid2vid | |
| prev_imagesopt | IMAGE | LongCat-Avatar-1.5: decoded frames from the previous segment. When provided together with `vae`, the trailing `overlap` frames are re-encoded through the VAE and used as the overlap conditioning (matches v1.5's use_vcond=False behavior). Leave disconnected for v1.0. | |
| vaeopt | WANVAE | LongCat-Avatar-1.5: VAE used to re-encode `prev_images` for the overlap region. Only used when `prev_images` is also provided. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image_embeds | WANVIDIMAGE_EMBEDS | Embeds for WanVideo LongCat Avatar generation |
| samples_slice | LATENT | Sliced latent samples for the new frames |