Context Windows Visualizer (KJ)
Actually see how your context windows tile a long video
- model
- model
Long video generation works by chopping the clip into overlapping chunks - context windows - because the model can only hold so many frames at once. The trouble is that tuning those windows (how long, how much overlap, what schedule, how the chunks blend) is normally done blind: you type numbers, run a slow generation, squint at the seams, adjust, repeat. ContextWindowsVisualizerKJ makes that visible. It draws your window layout live - placement, overlap, fuse weights, per-frame blending - so you can see what your settings actually do before you spend minutes rendering.
The click-through on this node is high for a reason: people search for how context windows work, and a picture beats a paragraph. It's genuinely one of the more useful diagnostic nodes in the pack.
Why context windows matter
The whole reason long AI video exists is the sliding context window. The model has a native frame limit; the trick that broke past it (pioneered in the AnimateDiff era) is to process a window of frames at a time with overlap between windows, so VRAM scales with the window, not the total length. That's how 1000-frame videos become feasible on a 24GB card. But the seams between windows are where long video goes wrong - visible jumps, drift, flicker - and the settings that control the seams are exactly the ones that are hardest to reason about numerically. This node is the instrument for that.
How it works
You set the same parameters your real long-video setup uses, and the node renders a live diagram of the resulting window tiling. It optionally does more than visualize: connect a model and it can apply the settings, working like the core Context Windows (Manual) node - so the same node you use to understand the layout can also be the one that sets it.
The inputs and outputs that matter
The ones that shape the tiling:
num_frames(INT, default 161) - total length you're generating.context_length(INT, default 81) - frames per window. Bigger = more coherent per chunk, more VRAM.context_overlap(INT, default 30) - how much neighboring windows share. More overlap = smoother seams, more compute.context_scheduleandcontext_stride(INT, default 1) - how windows are stepped across the timeline.fuse_method(defaultpyramid) - how overlapping windows are blended together.pyramidweights the center of each window highest.closed_loop(BOOLEAN) - tile so the video loops seamlessly.freenoise(BOOLEAN, default on) - the noise-shuffling trick that improves temporal consistency across windows; generally worth leaving on.
Plus frame_units, dim, temporal_downscale, causal_window_fix, and cond_retain_index_list for finer control and model-specific quirks. The optional model (MODEL) input turns the node from pure visualizer into an applier, and the model (MODEL) output carries those settings onward to your sampler.
How to install it
ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt
Restart and it's under KJNodes/misc. No model downloads.
Common issues & troubleshooting
Visible seams / jumps between windows. Too little overlap. Raise context_overlap so neighboring windows share more frames and blend cleaner. The trade is more compute per window.
Out of memory. context_length is your VRAM lever, not num_frames. The window is what has to fit in memory at once - shrink context_length (or overlap) if you're OOMing, and total length can stay long.
Flicker or drift over the whole clip. Make sure freenoise is on; it's specifically there to keep noise consistent across windows and cut down inter-window drift. It's on by default for a reason.
"I set values here but generation didn't change." As a pure visualizer it doesn't touch your model - it just draws. To actually apply the settings, connect the model input/output through this node so it behaves like the manual context-windows node. If the model isn't routed through it, you're only looking at a diagram.
My numbers don't match my sampler. The visualization is only honest if the parameters mirror what your real setup uses. Feed it the same num_frames, context_length, and overlap your generation runs with, or you're diagnosing a layout you're not actually rendering.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| frame_units | COMBO | pixel | Units for the frame counts below. 'pixel' converts to latent via ((n - 1) // temporal_downscale) + 1. |
| dim | INT | 20–5 | Latent temporal dimension: 2 for WAN-like, 0 for AnimateDiff-style. Model path only. |
| temporal_downscale | INT | 41–16 | VAE temporal compression for pixel->latent. WAN/Hunyuan/CogVideoX=4, Mochi=6, LTXV=8. |
| num_frames | INT | 1611–100000 | Total frames to visualize. Ignored on the model path (the real latent length is used). |
| context_length | INT | 811–100000 | Window length. |
| context_overlap | INT | 300–100000 | Overlap between windows. |
| context_schedule | COMBO | Window placement. standard_static_balanced: static with windows spread evenly (uniform seams, any frame count). batched_shifted: zero-overlap windows whose seams roll each step (~1.0x compute, pairs with freenoise). Uniform schedules also shift per step. | |
| context_stride | INT | 11–32 | Max stride power for uniform schedules (adds dilated windows: 1, 2, 4...). |
| closed_loop | BOOLEAN | false | Wrap looped-schedule windows around the end back to frame 0. |
| fuse_method | COMBO | pyramid | How overlapping windows are blended. |
| causal_window_fix | BOOLEAN | false | Prepend an anchor frame to non-0 windows, stripped after the model call. |
| freenoise | BOOLEAN | true | FreeNoise noise shuffling for smoother blending. Model path only. |
| cond_retain_index_list | STRING | Comma-separated window-relative indices that keep their original conditioning, e.g. '0' reuses the start frame's cond per window. No viz effect; model path only. | |
| modelopt | MODEL | Optional model to apply the context windows to during sampling. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | Model with context windows applied; only valid when a model is connected. |