SCAIL-2 Loop Sampler
One node for the whole clip
- model
- positive
- negative
- vae
- pose_video
- reference_image
- sampler
- sigmas
- pose_video_mask
- reference_image_mask
- clip_vision_output
- images
If you've run SCAIL-2's official ComfyUI workflow, you know the pain this node exists to kill. SCAIL-2 is a Z.ai motion-transfer model on a Wan 2.1 base - reference image plus driving video plus masks, no stick-figure pose. It's the best open option for character replacement that doesn't stretch your subject to fit the driving video's proportions. But it's trained with a native window of 81 frames, and everything longer means duplicating the Base/Extend sampler subgraphs by hand and doing arithmetic: divide your clip into 81-frame chunks, then hand-calculate the last segment against the 4n+1 frame requirement and the overlap. Get it wrong and the video comes out too short, or the tail behaves weirdly.
SCAIL-2 Loop Sampler replaces all of that with one node. Feed it the model, conditioning, pose video, reference image, and the pieces of a sampler - it splits, samples, decodes, stitches, color-matches the seams, and hands you one image batch at the end. Same family as SCAIL-2 Infinity and scail-auto-extend, with a different split of labor: those wrap the stock graph, while this one calls the native WanSCAILToVideo node directly from inside the loop.
How it works
The node reads the frame count of your pose_video and builds a segment plan. First pass is up to segment_length frames; every extension after that advances by segment_length - previous_frame_count new frames, re-anchored on previous_frame_count overlapping frames. It pads the pose video (and mask) to whatever that plan needs, then loops:
- Build native
WanSCAILToVideoconditioning for the current frame offset. - Sample and decode that segment independently.
- Drop the overlapping anchor frames from each extension.
- Apply the workflow's Reinhard seam color transfer.
- Append and crop back to your driving video's length.
One subtlety the README calls out: a full-size extension reuses the reference conditioning built for the first segment, but a shorter final segment rebuilds it - because SCAIL-2's reference mask has a segment-length-dependent temporal shape. That's exactly the kind of detail that made the manual graph such a trap.
The inputs that matter
The plumbing - model, positive, negative, vae, sampler, sigmas - is standard. Wire pose_video from the images output of GetVideoComponents (the driving clip), reference_image to your character still, and pass clip_vision_output from a CLIPVisionEncode if you have it. Audio and FPS stay on your existing CreateVideo path; this node only produces the frames.
The three you should actually think about:
segment_length(81) andprevious_frame_count(5) - keep the defaults. SCAIL-2 is trained with these; the author says so in the tooltips. 81 frames is about five seconds at 16fps.replacement_mode- true replaces the tracked subject with the reference; false animates the reference itself.pose_strength- how hard the driving pose pulls. 1 is the default, dial it down if motion looks oversaturated.
color_match_extensions does per-frame Reinhard color transfer at seams (default on - leave it on), cfg defaults to 1.0, and noise_seed steps per segment so each chunk isn't identical. Output is a single images batch, cropped to the driving-video length.
Installing it
ComfyUI Manager search "SCAIL-2 Loop Sampler", or:
cd ComfyUI/custom_nodes
git clone https://github.com/vjumpkung/comfyui-scail-2-loop-sampler
Then restart. The critical requirement isn't this pack - it's your ComfyUI. The node uses the V3 node API and needs a build with the native WanSCAILToVideo and SCAIL2ColoredMask nodes, which means core SCAIL-2 support (the PR that landed it in ComfyUI proper). If the node throws "no such node type", update ComfyUI first. There are no pip dependencies and nothing to download from this repo. The heavy stuff is the model itself: SCAIL-2's fp8 weights from Comfy-Org (the raw zai-org repo is 65.6GB - don't), plus the Wan 2.1 pieces and the tracking/mask nodes your workflow already uses.
Where people get burned
- The validation errors are honest.
segment_lengthmust be 4n+1 and greater thanprevious_frame_count;width/heightmust be divisible by 32. The node tells you precisely when you break these. - It's slow, and that's SCAIL-2, not this node. Minutes per segment even on a 5090; a mid-range card can be looking at 15+ minutes for a ten-second clip. Plan around it.
- Identity drifts across chunk seams. The node removes the overlap and color-matches, but cross-chunk drift is a model limitation every SCAIL-2 chunker inherits - not a settings bug.
If you're doing a single short clip, you don't need this. If you've ever chained SCAIL-2 segments by hand and swore at the arithmetic, this is the one you reach for.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| pose_video | IMAGE | — | |
| reference_image | IMAGE | — | |
| sampler | SAMPLER | — | |
| sigmas | SIGMAS | — | |
| width | INT | 89632–16384 | — |
| height | INT | 51232–16384 | — |
| segment_length | INT | 811–16385 | Frames per full pass. SCAIL-2 is trained with 81. |
| previous_frame_count | INT | 51–4097 | Overlap used to anchor each extension. SCAIL-2 is trained with 5. |
| noise_seed | INT | 00–18446744073709550000 | — |
| cfg | FLOAT | 1.00–100 | — |
| add_noise | BOOLEAN | true | — |
| replacement_mode | BOOLEAN | true | True replaces the tracked subject; false animates the reference. |
| pose_strength | FLOAT | 1.000–10 | — |
| pose_start | FLOAT | 0.000–1 | — |
| pose_end | FLOAT | 1.000–1 | — |
| color_match_extensions | BOOLEAN | true | Apply the workflow's per-frame Reinhard color transfer at seams. |
| color_match_strength | FLOAT | 1.000–10 | — |
| pose_video_maskopt | IMAGE | — | |
| reference_image_maskopt | IMAGE | — | |
| clip_vision_outputopt | CLIP_VISION_OUTPUT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |