CogVideo Context Options
Making CogVideoX clips longer than they want to be
- context_options
Video models have a native length they're comfortable with, and pushing past it usually gets you looping or garbage. This node is how you go longer anyway. It bundles up a set of "context window" settings and feeds them into the sampler, which then generates your long clip in overlapping chunks instead of trying to hold the whole thing in memory at once. If you've used AnimateDiff's context options, this is the same idea ported to CogVideoX.
The trick is old and reliable: instead of denoising all N frames simultaneously (which the model wasn't trained for and your VRAM can't hold), you slide a fixed-size window across the timeline, generate each window, and blend the overlaps so the seams don't show. You get a longer video at the cost of some cross-window consistency - the classic long-video tradeoff that every model in this space fights.
The inputs that matter
Everything here is required, and the defaults are a reasonable starting point:
context_frames(default 48) - how many frames the model sees per window. This is the "native chunk size." Bigger windows mean better coherence within a chunk but more VRAM; smaller windows are cheaper but the model has less context to work with.context_overlap(default 4) - how many frames adjacent windows share. Overlap is what blends the seam between chunks. More overlap = smoother transitions but more redundant compute.context_stride(default 4) - how far the window jumps between passes. Controls the spacing of the sampling.context_schedule-uniform_standardis the normal sliding window;uniform_loopedis the one to pick if you want the clip to loop seamlessly back to its start;static_standardholds a fixed window.freenoise(default on) - a noise-scheduling technique that keeps the generated frames coherent across the windows. Leave it on; it's on by default for a reason.
The single output, context_options (a COGCONTEXT), plugs into the context_options slot on CogVideo Sampler. That's the only place it goes. Without it, the sampler just does a single-pass generation at whatever num_frames you asked for - which is fine for short clips and exactly what you want to skip for long ones.
How to install it
It ships with the CogVideoX wrapper; there's nothing to install for this node specifically:
- ComfyUI Manager - search ComfyUI-CogVideoXWrapper, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-CogVideoXWrapper, thenpip install -r ComfyUI-CogVideoXWrapper/requirements.txt, restart.
Common issues & troubleshooting
The video drifts or the subject changes across the clip. This is the fundamental limitation, not a bug you can fully tune away. The model only ever sees context_frames at a time, so it slowly forgets what it drew earlier. Bumping context_overlap up helps the transitions; picking a larger context_frames gives the model more memory per window. But identity drift over a long clip is the price of the technique.
Want a seamless loop. Set context_schedule to uniform_looped. That's what it's there for - the standard schedules don't try to close the loop.
No speed win, and it's slower. Expected - you're generating more total frames in overlapping passes, so it costs more compute than a short single-pass clip. Context options buy you length, not speed. If you only need a few seconds, skip this node entirely and just set num_frames on the sampler.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| context_schedule | COMBO | 3 options: uniform_standard, uniform_looped, static_standard | |
| context_frames | INT | 482–100 | Number of pixel frames in the context, NOTE: the latent space has 4 frames in 1 |
| context_stride | INT | 44–100 | Context stride as pixel frames, NOTE: the latent space has 4 frames in 1 |
| context_overlap | INT | 44–100 | Context overlap as pixel frames, NOTE: the latent space has 4 frames in 1 |
| freenoise | BOOLEAN | true | Shuffle the noise |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| context_options | COGCONTEXT | — |