Nodes/ComfyUI-SCAIL2-LongVideoContext/SCAIL-2 Smart Long Video Context
ComfyUI Node

SCAIL-2 Smart Long Video Context

Your SCAIL-2 clip doesn't have to be 81 frames — this node does the 4n+1 chunk math for you

By 1GirlUniversity·Created 3 months ago·Updated 3 months ago· 9
SCAIL-2 Smart Long Video Context
  • model
  • model
  • chosen_segment_len
  • chosen_segment_overlap
  • latent_context_length
  • latent_context_overlap
  • decision
total_frames237
strategyauto_smooth_rtx6000
manual_segment_len205
manual_segment_overlap73
context_schedulestandard_static
context_stride1
fuse_methodpyramid
freenoisefalse
causal_window_fixtrue
bypass_when_single_passtrue
cond_retain_index_list0

SCAIL-2's native context window is 81 frames. Everything longer than that is chunked - split into overlapping windows, sampled separately, fused back together. The stock ComfyUI workflow makes you do that arithmetic by hand: divide your clip into 81-frame segments, keep the frame count on the 4n+1 pattern the VAE demands, and hand-tune the overlap so windows stitch without a visible seam. It's tedious, easy to get wrong, and it's the exact pain this node exists to remove. You feed it a frame count, it picks your segment length and overlap, and patches your model so the sampler just works.

It's a model patch, not a replacement for the official SCAIL-2 graph. You still need WanSCAILToVideo, the masks, replacement_mode and the rest - this node sits between the diffusion model loader and the sampler and rewraps the MODEL with ComfyUI's built-in comfy.context_windows.IndexListContextHandler, the same machinery behind the core Long Video Context nodes.

How it works

The node does three things. First it clamps your total_frames to the 4n+1 pattern (n - ((n-1) % 4)), because the latent VAE works in units of four pixel frames plus one anchor. Then a strategy table picks a segment_len / segment_overlap pair. For the default auto_smooth_rtx6000 strategy, ~237 frames - that's a 15-second clip at 16fps, the default total_frames - resolves to 205 frames with 73 of overlap, sized to minimize the visible seam where windows meet. It converts those to latent lengths ((frames-1)//4 + 1), so 205 becomes a latent context length of 52, and hands it to the context handler.

The part that matters for SCAIL-2 specifically: cond_retain_index_list defaults to "0", which keeps condition index 0 - your reference frame - present in every window. Without that, each chunk re-anchors from scratch and identity drifts across boundaries, the failure mode the community hits on long clips. If your whole clip fits in a single window, bypass_when_single_pass (on by default) returns your model untouched rather than patching it for nothing.

The inputs that actually matter

  • total_frames - the one you'll actually feed. Use the same effective frame count you send to WanSCAILToVideo length (e.g. VHS frame_count through a a - ((a-1) % 4) expression). It steps by 4.
  • strategy - auto_smooth_rtx6000 (default), auto_safe (lighter, for OOM), auto_quality_rtx6000, force_official_81_5 (replicates the official 81/5 chunking), or manual.
  • cond_retain_index_list - keep "0". Comma-separated if you ever need more.
  • Leave causal_window_fix true and freenoise false; context_schedule / context_stride / fuse_method are for when you're tuning beyond defaults.

Outputs are the patched model (wire it into your sampler) plus chosen_segment_len, latent_context_length, and a decision string telling you what it actually did - useful when something looks off and you want to know if you got a single pass or real chunking.

Install

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/1GirlUniversity/ComfyUI-SCAIL2-LongVideoContext.git

Restart ComfyUI. That's it - there are no Python dependencies beyond a ComfyUI build recent enough to have comfy.context_windows (essentially any current build). The pack ships no weights; you still need the SCAIL-2 model itself, so grab Comfy-Org's scaled/MXFP8 weights rather than the 65.6GB raw repo.

Gotchas

The rtx6000 in those strategy names is a hint about tuning targets, not a hard requirement - the defaults assume a big-VRAM card, so if you OOM or crawl, switch to auto_safe. If the node appears to do nothing, check the decision output: a short clip may legitimately single-pass. And if you're on an old ComfyUI, update core first, because the import will fail without context_windows.

Categorymodel_patches/scail2

Inputs (12)

NameTypeDefaultDescription
modelMODEL
total_framesINT2371–99999
strategyCOMBOauto_smooth_rtx60005 options: auto_smooth_rtx6000, auto_safe, auto_quality_rtx6000, force_official_81_5, manual
manual_segment_lenINT2051–99999
manual_segment_overlapINT730–99999
context_scheduleCOMBOstandard_static4 options: standard_static, standard_uniform, looped_uniform, batched
context_strideINT11–32
fuse_methodCOMBOpyramid4 options: pyramid, relative, flat, overlap-linear
freenoiseBOOLEANfalse
causal_window_fixBOOLEANtrue
bypass_when_single_passBOOLEANtrue
cond_retain_index_listSTRING0

Outputs (6)

NameTypeDescription
modelMODEL
chosen_segment_lenINT
chosen_segment_overlapINT
latent_context_lengthINT
latent_context_overlapINT
decisionSTRING