Nodes/ComfyUI Wan Animate 2 Loop Sampler/Wan Animate 2 Loop Sampler
ComfyUI Node

Wan Animate 2 Loop Sampler

Wan Animate 2 past 5 seconds without hand-chaining six copies of the same subgraph

By vjumpkung·Created about a month ago·Updated about a month ago· 4
Wan Animate 2 Loop Sampler
  • model
  • positive
  • negative
  • vae
  • pose_video
  • reference_image
  • sampler
  • sigmas
  • positive_pose
  • clip_vision_output
  • clip_vision_output_pose
  • images
width832
height480
segment_length81
noise_seed0
cfg1.0
add_noisetrue
pose_strength1.00
pose_start_percent0.00
pose_end_percent1.00
reference_image_strength1.00

Wan Animate 2 - Alibaba's motion-transfer model on the frozen Wan 2.2 base - has a wall at 81 frames. That's about five seconds at 16fps, and the stock video_wan_animate2.json workflow gets you past it the hard way: you duplicate the WanAnimate2ToVideo → SamplerCustom → TrimVideoLatent → VAEDecode block for every segment, carry the last generated frame into the next pass, bump the pose-video offset, and trim the overlap by hand. It works, and it's miserable. WanAnimate2LoopSampler is a single V3 node that runs that whole loop internally, so you feed it a pose video of any length and get back one image batch covering every frame.

First, the name is slightly misleading, so let's kill that upfront. This is not a seamless-loop node in the AnimateDiff ping-pong sense. The "loop" is the internal chaining loop - sample a segment, keep going until the pose video runs out. What you get is a long continuous take driven by your reference image and the pose frames, which is exactly the workflow everyone building talking-head or dance transfer content ends up re-creating by hand.

How it works

Read the source and it's clean. The node takes your pose_video, plans segments so each one is a valid Wan length, then for each pass it calls ComfyUI's stock WanAnimate2ToVideo and samples with the same path SamplerCustom uses (comfy.sample.sample_custom). Between passes it:

  • carries the accumulated generated frames in as continue_motion, so motion flows across the boundary;
  • advances video_frame_offset using Animate 2's native behavior, so the pose window slides forward correctly;
  • trims the reference-image latent frames and the one-frame extension overlap before decoding; and
  • concatenates everything and crops to your pose video's original frame count.

Segments are 4n+1 frames because that's what the Wan temporal VAE needs. With the default segment_length of 81 you get 81 frames on the first pass and 77 new frames per extension (81 minus Animate 2's built-in continue-motion overlap), and the noise seed is advanced per segment so extensions aren't identical.

The inputs that matter

Most inputs are the things you already had in the stock workflow - you're just moving them outside the loop. Keep the reusable setup outside the node: load the model, LoRA, CLIP, CLIP Vision and VAE, encode your prompts, apply context windows / WanAnimate2Cache / ModelSamplingSD3, and build sampler + sigmas with KSamplerSelect and BasicScheduler. Then wire:

  • model - the prepared sampling model (the tooltip spells it out: apply LoRA, context windows, cache and ModelSamplingSD3 first).
  • pose_video - the driving video's frames, straight from GetVideoComponents. The output is cropped to this count.
  • reference_image - the character still you're animating.
  • sampler + sigmas - should match the SamplerCustom / BasicScheduler from the original graph.
  • segment_length - the one you're most likely to touch. 81 is the default and the normal choice; it must be 4n+1.
  • pose_strength, pose_start_percent, pose_end_percent - dials for how hard the pose drives the output.
  • Optional positive_pose, clip_vision_output, clip_vision_output_pose feed Animate 2's extra conditioning.

The single output is images - one IMAGE batch the length of your pose video, ready for CreateVideo / SaveVideo.

Installing it

Same story as any custom node. ComfyUI Manager → search "Wan Animate 2 Loop Sampler" (or comfyui-wan-animate-2-loop-sampler), install, restart. Or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/vjumpkung/comfyui-wan-animate-2-loop-sampler

Then restart ComfyUI. There are no extra Python dependencies - the pack has no requirements.txt because it leans entirely on core ComfyUI. What you do need: a current ComfyUI build with WanAnimate2ToVideo in comfy_extras and the V3 custom-node API, plus the Wan Animate 2 model files (the Animate-14B checkpoint) and supporting nodes the source workflow already uses. This pack is V3-only - it registers via ComfyExtension/comfy_entrypoint and exposes no legacy NODE_CLASS_MAPPINGS, so on an old ComfyUI it just won't show up.

Where people get burned

The most common error is segment_length not being 4n+1 - 80 is rejected, 81 isn't. The node also raises if pose_start_percent exceeds pose_end_percent, if your sigmas have fewer than two values, or if pose_video is empty, and it demands segment_length greater than Animate 2's overlap.

Bigger picture: chaining segments is an ergonomics fix, not a quality fix. The community consensus on long Wan Animate takes is that quality starts to deteriorate after a few batches - identity drifts, the motion gets mushy - and the same applies to anything that chains these passes. This node removes the tedious wiring, not the underlying drift. For short-to-medium takes it's the node you reach for. For a genuinely long continuous take, keep your expectations about chunk-boundary consistency in line with what the model actually does.

Categoryvideo/wan animate 2

Inputs (21)

NameTypeDefaultDescription
modelMODELPrepared sampling model. Apply LoRA, optional context windows, Wan Animate 2 Cache, and ModelSamplingSD3 before this input.
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
pose_videoIMAGEDriving-video frames. The output is cropped to this frame count.
reference_imageIMAGE
samplerSAMPLER
sigmasSIGMAS
widthINT83216–16384
heightINT48016–16384
segment_lengthINT815–16385Frames per full pass. Must be 4n+1; Wan Animate 2 is normally used with 81.
noise_seedINT00–18446744073709550000
cfgFLOAT1.00–100
add_noiseBOOLEANtrue
pose_strengthFLOAT1.000–10
pose_start_percentFLOAT0.000–1
pose_end_percentFLOAT1.000–1
reference_image_strengthFLOAT1.000–10
positive_poseoptCONDITIONING
clip_vision_outputoptCLIP_VISION_OUTPUT
clip_vision_output_poseoptCLIP_VISION_OUTPUT

Outputs (1)

NameTypeDescription
imagesIMAGE