IAMCCS Wan-Animate-2 Extends
Chunked sampling that actually carries continuity
- model
- positive
- negative
- vae
- sampler
- sigmas
- reference_image
- pose_video
- positive_pose
- clip_vision_output
- clip_vision_output_pose
- reference_character_mask
- composite_mask
- background_image
- background_video
- images
- native_images
- frame_count
- source_frames
- trimmed_frames
- chunk_plan
Wan-Animate-2 is officially a short-clip node: you give it a reference image and a driving video and it transfers the motion. "Extends" is the wrapper that turns it into a long-form engine. IAMCCS_WanAnimate2Extends samples the native WanAnimate2ToVideo in 4n+1 chunks, passes the previous generated frame through continue_motion so identity and motion survive across chunk boundaries, advances the driving-video offset each chunk, trims the latent/image anchors to the valid frame count, and - new in this edition - can composite the generated character over a background plate instead of whatever the model generated.
How it works
The loop is the whole story. Each iteration conditions on the reference image and a slice of the raw driving video (Wan-Animate-2 famously does not need a DWPose render - the pose_video input tooltip says it plainly), samples one 4n+1 chunk, then feeds the last generated frame back as the motion continuation for the next. The driving offset advances, so a long source video plays through in order. It validates the boring stuff up front - width/height divisible by 16, pose_start_percent ≤ pose_end_percent, a reference image and driving frames present - and clamps target_frames to the driving video's actual length (0 means "use all of it").
Chunk-to-chunk continuity comes from the context-window machinery it delegates to (ContextWindowsManualNode from ComfyUI core): context_length_latents (21), context_overlap_latents (8), context_schedule and context_fuse_method (pyramid/relative/flat/overlap-linear). There's also enable_pose_cache with CPU/GPU and int8/int4 caching so pose embeddings aren't re-encoded per chunk - the thing that makes long runs tolerable.
The inputs that matter
reference_image+pose_video- the identity anchor and the raw driving frames.chunk_length- 81 is the official Wan-Animate-2 default; it's normalized to 4n+1 regardless.target_frames- 0 = full driving video; anything else caps it.cfg(1.0 default),reference_image_strength,pose_strength,pose_start/end_percent.reference_background_mode-keep_reference_backgroundorisolate_character(needsreference_character_mask).output_background_mode-native_generated, or composite oversource_video,reference_image, or acustom_background(background_image/background_video+composite_mask, where white selects the generated character).
Outputs: images (the composited final), native_images (pre-composite), plus frame_count, source_frames, trimmed_frames, and chunk_plan so you can verify the math.
Where people get burned
context_overlap_latents must be smaller than context_length_latents or it raises - that's a real constraint of the context-window system, not a style choice. And the isolate_character path needs a white character mask, otherwise the masking silently conditions on the wrong thing. The trimmed_frames output is worth watching too: it reports the anchor trim after each chunk, which is where the 4n+1 shortfall shows up if something's off.
It's the backend that the Easy Shotboard shell (IAMCCS_V2VShotboardEasyWanAnimate2) and the IAMCCS_WanAnimate2ShotboardBridge drive, so if you're using those you may never touch this node directly. Install the pack once - ComfyUI Manager (search "IAMCCS") or git clone https://github.com/IAMCCS/IAMCCS-nodes.git - and remember this expects native Wan-Animate-2 model/VAE/CLIP-Vision loaders upstream.
Inputs (39)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| sampler | SAMPLER | — | |
| sigmas | SIGMAS | — | |
| reference_image | IMAGE | — | |
| pose_video | IMAGE | Raw driving-video frames. Wan-Animate-2 does not require a DWPose render here. | |
| width | INT | 83216–8192 | — |
| height | INT | 48016–8192 | — |
| target_frames | INT | 00–100000 | 0 uses the complete driving-video frame count. |
| chunk_length | INT | 815–1025 | Wan-Animate-2 official workflow default is 81 frames. |
| noise_seed | INT | 00–18446744073709550000 | — |
| seed_mode | COMBO | fixed | 2 options: fixed, increment |
| cfg | FLOAT | 1.00–100 | — |
| reference_image_strength | FLOAT | 1.000–10 | — |
| pose_strength | FLOAT | 1.000–10 | — |
| pose_start_percent | FLOAT | 0.000–1 | — |
| pose_end_percent | FLOAT | 1.000–1 | — |
| add_noise | BOOLEAN | true | — |
| enable_context_windows | BOOLEAN | true | — |
| context_length_latents | INT | 211–1024 | — |
| context_overlap_latents | INT | 80–1023 | — |
| context_schedule | COMBO | standard_static | 4 options: standard_static, standard_uniform, looped_uniform, batched |
| context_fuse_method | COMBO | pyramid | 4 options: pyramid, relative, flat, overlap-linear |
| enable_pose_cache | BOOLEAN | true | — |
| cache_device | COMBO | cpu | 2 options: cpu, gpu |
| cache_dtype | COMBO | int8 | 3 options: int8, int4, default |
| reference_background_mode | COMBO | keep_reference_background | 2 options: keep_reference_background, isolate_character |
| output_background_mode | COMBO | native_generated | 4 options: native_generated, source_video_composite, reference_image_composite, custom_background_composite |
| live_chunk_preview | COMBO | middle_frame | 4 options: off, first_frame, middle_frame, last_frame |
| empty_cache_each_chunk | BOOLEAN | false | — |
| positive_poseopt | CONDITIONING | — | |
| clip_vision_outputopt | CLIP_VISION_OUTPUT | — | |
| clip_vision_output_poseopt | CLIP_VISION_OUTPUT | — | |
| reference_character_maskopt | MASK | White character mask used only by isolate_character. | |
| composite_maskopt | MASK | White selects generated character; black selects the background plate. | |
| background_imageopt | IMAGE | — | |
| background_videoopt | IMAGE | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| native_images | IMAGE | — |
| frame_count | INT | — |
| source_frames | INT | — |
| trimmed_frames | INT | — |
| chunk_plan | STRING | — |