Wan Animate 2 Loop Sampler
Wan Animate 2 past 5 seconds without hand-chaining six copies of the same subgraph
- model
- positive
- negative
- vae
- pose_video
- reference_image
- sampler
- sigmas
- positive_pose
- clip_vision_output
- clip_vision_output_pose
- images
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_offsetusing 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 fromGetVideoComponents. The output is cropped to this count.reference_image- the character still you're animating.sampler+sigmas- should match theSamplerCustom/BasicSchedulerfrom the original graph.segment_length- the one you're most likely to touch. 81 is the default and the normal choice; it must be4n+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_posefeed 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.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Prepared sampling model. Apply LoRA, optional context windows, Wan Animate 2 Cache, and ModelSamplingSD3 before this input. | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| pose_video | IMAGE | Driving-video frames. The output is cropped to this frame count. | |
| reference_image | IMAGE | — | |
| sampler | SAMPLER | — | |
| sigmas | SIGMAS | — | |
| width | INT | 83216–16384 | — |
| height | INT | 48016–16384 | — |
| segment_length | INT | 815–16385 | Frames per full pass. Must be 4n+1; Wan Animate 2 is normally used with 81. |
| noise_seed | INT | 00–18446744073709550000 | — |
| cfg | FLOAT | 1.00–100 | — |
| add_noise | BOOLEAN | true | — |
| pose_strength | FLOAT | 1.000–10 | — |
| pose_start_percent | FLOAT | 0.000–1 | — |
| pose_end_percent | FLOAT | 1.000–1 | — |
| reference_image_strength | FLOAT | 1.000–10 | — |
| positive_poseopt | CONDITIONING | — | |
| clip_vision_outputopt | CLIP_VISION_OUTPUT | — | |
| clip_vision_output_poseopt | CLIP_VISION_OUTPUT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |