Nodes/IAMCCS-nodes/IAMCCS Wan-Animate-2 Extends
ComfyUI Node

IAMCCS Wan-Animate-2 Extends

Chunked sampling that actually carries continuity

By IAMCCS·Created 11 months ago·Updated 4 days ago· 113
IAMCCS Wan-Animate-2 Extends
  • 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
width832
height480
target_frames0
chunk_length81
noise_seed0
seed_modefixed
cfg1.0
reference_image_strength1.00
pose_strength1.00
pose_start_percent0.00
pose_end_percent1.00
add_noisetrue
enable_context_windowstrue
context_length_latents21
context_overlap_latents8
context_schedulestandard_static
context_fuse_methodpyramid
enable_pose_cachetrue
cache_devicecpu
cache_dtypeint8
reference_background_modekeep_reference_background
output_background_modenative_generated
live_chunk_previewmiddle_frame
empty_cache_each_chunkfalse

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_background or isolate_character (needs reference_character_mask).
  • output_background_mode - native_generated, or composite over source_video, reference_image, or a custom_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.

CategoryIAMCCS/video/WanAnimate-2

Inputs (39)

NameTypeDefaultDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
samplerSAMPLER
sigmasSIGMAS
reference_imageIMAGE
pose_videoIMAGERaw driving-video frames. Wan-Animate-2 does not require a DWPose render here.
widthINT83216–8192
heightINT48016–8192
target_framesINT00–1000000 uses the complete driving-video frame count.
chunk_lengthINT815–1025Wan-Animate-2 official workflow default is 81 frames.
noise_seedINT00–18446744073709550000
seed_modeCOMBOfixed2 options: fixed, increment
cfgFLOAT1.00–100
reference_image_strengthFLOAT1.000–10
pose_strengthFLOAT1.000–10
pose_start_percentFLOAT0.000–1
pose_end_percentFLOAT1.000–1
add_noiseBOOLEANtrue
enable_context_windowsBOOLEANtrue
context_length_latentsINT211–1024
context_overlap_latentsINT80–1023
context_scheduleCOMBOstandard_static4 options: standard_static, standard_uniform, looped_uniform, batched
context_fuse_methodCOMBOpyramid4 options: pyramid, relative, flat, overlap-linear
enable_pose_cacheBOOLEANtrue
cache_deviceCOMBOcpu2 options: cpu, gpu
cache_dtypeCOMBOint83 options: int8, int4, default
reference_background_modeCOMBOkeep_reference_background2 options: keep_reference_background, isolate_character
output_background_modeCOMBOnative_generated4 options: native_generated, source_video_composite, reference_image_composite, custom_background_composite
live_chunk_previewCOMBOmiddle_frame4 options: off, first_frame, middle_frame, last_frame
empty_cache_each_chunkBOOLEANfalse
positive_poseoptCONDITIONING
clip_vision_outputoptCLIP_VISION_OUTPUT
clip_vision_output_poseoptCLIP_VISION_OUTPUT
reference_character_maskoptMASKWhite character mask used only by isolate_character.
composite_maskoptMASKWhite selects generated character; black selects the background plate.
background_imageoptIMAGE
background_videooptIMAGE

Outputs (6)

NameTypeDescription
imagesIMAGE
native_imagesIMAGE
frame_countINT
source_framesINT
trimmed_framesINT
chunk_planSTRING