Nodes/CS Hybrid 4K Image-to-Video/CS Tile Scheduler (measurement mask)
ComfyUI Node

CS Tile Scheduler (measurement mask)

Spend your full-res budget where it matters

By lvqunx·Created about a month ago·Updated about a month ago· 0
CS Tile Scheduler (measurement mask)
  • occlusion
  • refine_mask
num_frames121
height2160
width3840
tile512
overlap64
ratio0.25
keyframe_every8
seed0

Re-synthesizing a 4K video frame by frame at full resolution is exactly the VRAM and time bill this pack was built to dodge. CS Tile Scheduler is the part that decides what you don't have to render: it produces a per-frame refine mask telling your img2img refiner which regions actually need full-resolution work, and it makes sure the masked-out areas still get covered over time. Compressed sensing is the fancy phrase for "sample a fraction of the data cleverly and it's good enough" - this node is that idea turned into a mask.

It's one of seven nodes in CS Hybrid 4K Image-to-Video (lvqunx/comfyui-cs-hybrid), a new pack that runs the video model at 480P and rebuilds 4K detail via optical flow. The scheduler is the "where do we re-shoot the frame" step, sitting after the rebuild and before the refiner.

How it works

The frame is divided into a grid of tiles (tile size, overlap between neighbours). For each frame it picks a random subset of tiles - roughly ratio of the grid - to refine at full resolution, with the tile rotation seeded and reproducible. Then three things layer on top:

  • Full frames every keyframe_every frames - keyframes get the whole frame refined, not a subset.
  • Occlusion union - if you pass the occlusion MASK from CS Flow Estimate, any region flagged occluded (the flow can't be trusted there) gets refined too, no matter what the random draw said.
  • Per-frame randomness - because the tile subset rotates, different tiles get full-resolution treatment on different frames, so over a cycle every region gets touched.

The output is a single refine_mask: num_frames masks at your full 4K size (default 3840×2160), ready to feed an img2img refiner's mask conditioning.

The inputs that matter

Only a handful matter on a first pass:

  • ratio - default 0.25. Fraction of tiles refined per frame. This is the big VRAM/time lever, and the README is explicit: flow is unreliable on water, smoke, particles - raise ratio for that kind of content.
  • keyframe_every - default 8, frames between full refines.
  • tile / overlap - default 512/64; the tile grid geometry.
  • seed - default 0; locks the tile rotation so runs are reproducible.
  • occlusion - optional MASK; if it has one fewer frame than num_frames, a zero frame is prepended so it lines up. Unioned in at threshold 0.3.

One tuning rule from the README worth memorizing: keep keyframe_every × ratio ≥ 2 so every tile gets measured at least twice per cycle. At defaults (8 × 0.25 = 2) you're exactly at the floor; dropping ratio below 0.25 without touching keyframe_every puts you under it and you'll see tiles that never get cleaned.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/lvqunx/comfyui-cs-hybrid
# restart ComfyUI

Or ComfyUI Manager → search CS Hybrid 4K Image-to-Video. No extra pip dependencies; torch and torchvision come with ComfyUI.

Common issues

The most common mistake is feeding occlusion from the wrong place - for the GOP-based workflow, remember that CS GOP Recompose's occlusion_4k output is a placeholder; use CS Flow Estimate's occlusion MASK here. Second: if your refined output shows tile seams, bump overlap so neighbouring tile treatments blend. And if slow-moving shots look soft, ratio is probably too low - the random subset covers less ground per frame and motion isn't helping you by bringing fresh detail in.

CategoryCSHybrid

Inputs (9)

NameTypeDefaultDescription
num_framesINT1211–9999
heightINT216064–8192
widthINT384064–8192
tileINT512128–2048
overlapINT640–512
ratioFLOAT0.250.02–1
keyframe_everyINT82–120
seedINT00–18446744073709550000
occlusionoptMASK

Outputs (1)

NameTypeDescription
refine_maskMASK