Nodes/ComfyUI/WanDancerPadKeyframes
ComfyUI Node Runs on cloud

WanDancerPadKeyframes

The node that turns Wan-Dancer keyframes into segments the local model can refine

By Comfy-Org·Created 4 years ago·Updated about 10 hours ago· 130,663
WanDancerPadKeyframes
  • images
  • audio
  • keyframes_sequence
  • keyframes_mask
  • audio_segment
segment_length149
segment_index0

Wan-Dancer is Alibaba's music-to-dance model: give it a reference image of a character and an audio track, and it makes the character dance to the rhythm. The trick that gets it past the usual five-second video ceiling is a two-stage setup. A "global" model watches the whole track and plans sparse keyframes - the overall dance structure. Then a "local" model refines one ~5-second segment at a time, generating every in-between frame. This node is the bridge between those two stages. You feed it the keyframe images plus the full audio, and it hands back a padded keyframe sequence for one segment, a mask saying which frames are real, and the audio slice for that segment - the exact three things the local stage (WanDancerVideo) wants.

So it's not a generation node. It does zero inference and loads no model; it's pure bookkeeping: torch tensor placement and audio slicing. It runs in a blink next to the actual sampling.

How it works

The audio is the master clock. At a hardcoded 30 fps, the node works out how many 149-frame segments fit in your track (it shaves a 0.2s buffer off the end), then spaces your keyframe images evenly across that whole timeline. For the segment you ask for, it drops the keyframes that land inside it at their computed frame positions and zero-pads everything else. The mask marks exactly those keyframe positions with 1s - and WanDancerVideo's mask input reads "white is kept, black is generated," so the sampler holds the keyframes fixed and hallucinates the frames between them. It also slices the matching audio window so the beat lands in the right segment. That's the whole job.

The inputs that matter

  • images - the keyframes, usually frames sampled from the global-stage output, ordered across the full track. This is what gets spaced out and padded.
  • segment_length (149) - 149 frames is ~5 seconds at 30fps, which is exactly what the Wan-Dancer local model samples per pass. Leave it at the default.
  • segment_index - 0 for the first segment, 1 for the second, and so on. You place one copy of this node per segment and increment this by hand.
  • audio - drives both the segment count math and the audio slicing. Required.

Outputs: keyframes_sequence (IMAGE, the padded segment), keyframes_mask (MASK, 1 at keyframes), and audio_segment (AUDIO). Wire the first two into WanDancerVideo's start_image and mask, and route the audio_segment into the per-segment audio encode and the final merge.

Getting it

It ships with ComfyUI core - no install, no Manager. Native Wan-Dancer support landed in May 2026 in comfy_extras/nodes_wandancer.py. The nodes themselves load no model files, but the workflow around them needs the Wan-Dancer weights: wan2.2_dancer_14b_global_fp8_scaled.safetensors and wan2.2_dancer_14b_local_fp8_scaled.safetensors from Comfy-Org/Wan-Dancer on HuggingFace (into models/diffusion_models/), plus the Wan 2.1 VAE, the UMT5-XXL text encoder, clip_vision_h, and a lightx2v speed LoRA in their usual folders.

Common issues

  • Blank output? Check the audio first. Segment count is derived from audio length, so short tracks give you few segments, and with audio under ~0.2s or no images the node returns a fully zeroed sequence and mask by design (there's an explicit guard).
  • Don't set segment_index past what the audio implies. You get a segment of empty padded frames, not an error.
  • It assumes 30 fps. Generate your global keyframes at a different frame rate and the keyframes land at the wrong spots.
  • VRAM. The whole local pass samples 149 frames at once, and the official workflow warns you need real GPU headroom. That's a Wan-Dancer property, not this node's fault - this is the cheap, fast part.

If you're doing a multi-segment run, know there's a sibling: WanDancerPadKeyframesList does the same job for every segment in one node instead of one copy per segment.

Categoryimage/video

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
segment_lengthINT1491–10000Length of this segment (usually 149 frames)
segment_indexINT00–100Which segment this is (0 for first, 1 for second, etc.)
audioAUDIOAudio to calculate total output frames from and extract segment audio.

Outputs (3)

NameTypeDescription
keyframes_sequenceIMAGEPadded keyframe sequence
keyframes_maskMASKMask indicating valid frames
audio_segmentAUDIOAudio segment for this video segment