SeedVR2 Chunk Size
How Many Frames Will Your Card Actually Take? Ask It Instead of Guessing
- latent
- frames_per_chunk
SeedVR2 on video is a memory puzzle. You encode the clip, split the latent into chunks for the sampler, and if a chunk is too long you get an out-of-memory crash a third of the way through a twenty-minute job. ComfyUI's Split SeedVR2 Latent node has a manual chunking mode with a frames_per_chunk socket - it just expects you to know the number. This node works it out from your latent and your card.
What it computes
The pick is the largest 4n+1 frame count - the sampler only takes 4n+1, for the temporal compression - that satisfies:
8.36 GiB + 0.6075 GiB × megapixels × latent_frames × (1 + safety_margin) ≤ card's total memory
That line is a measurement, not a formula someone derived: the author fitted it to the KSampler's allocated peaks at 21 to 57 frames per chunk on a 5090, 720p → 1080p, 7B int8, dynamic VRAM. The fixed 8.36 GiB is the DiT's resident weights and the CUDA context; the rest is per-frame cost that scales with the frame's megapixels. The per-frame term lands within 3% of what the allocator actually reserved when it was checked against a 901-frame clip.
The important detail, and the reason this beats reading "free VRAM": it uses the card's total memory, not the memory free right now. Free memory depends on what else is resident, what ran before, and whether the Process Monitor is on; total is a constant. So you get the same answer on every run.
Rough numbers from the write-up at the default margin: 41 frames per chunk at 1080p on a 32 GB card, 161 on a 96 GB card. A 24 GB card gets 25 frames at 720p → 1080p, and exactly 1 frame if you're upscaling to 4K - which is a useful thing to know before you start.
Inputs and outputs
latent- the encoded clip, from SeedVR2 Preprocess (Compact)'slatentor SeedVR2 VAE Encode's. The node reads its frame count and frame size.safety_margin- default 0.64. Each frame's share is budgeted at(1 + margin) ×the measured line. 0.64 is what picks the longest chunk that was actually measured to run on a long clip. Raise it if a chunk still OOMs; lower it to gamble on longer chunks.- Output:
frames_per_chunk- an INT, 4n+1, never more than the clip's own length.
Wire it into Split SeedVR2 Latent's frames_per_chunk, with that node's chunking_mode set to manual. Split's own auto budgets the memory free at the time it runs, using a law fitted on the 3B model, and per the author it ran out of memory on both cards measured - including 281 frames at 1080p on an RTX PRO 6000. That's the specific failure this node exists to route around.
The node logs the card, the megapixels, the margin and the pick, so when a chunk dies you have the working numbers instead of a guess.
Install
Manager, search ComfyUI-BCNodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/0xBeycan/ComfyUI-BCNodes
pip install -r ComfyUI-BCNodes/requirements.txt
Restart and search BCNodes in the node library (it's under BCNodes/seedvr2, alongside the rest of this pack's SeedVR2 nodes). The requirements are opencv-python, postfx and caption-audit; none applies here. Delete a leftover ComfyUI-AutoBypass folder from the pack's old name.
You'll also need working SeedVR2 support in ComfyUI itself - the VAE, the DiT, the sampler and Split SeedVR2 Latent are core's, not this pack's.
Where it bites
The law is the 7B's. On the 3B the model is narrower, so you get chunks that are shorter than you could get away with. That's safe, not optimal - if you're on a 3B and you care about throughput, try raising the margin's counterpart by lowering safety_margin and testing.
The margin is one-sided in a way worth stating plainly: 0.64 is conservative because it's calibrated to measurements on a long clip, where allocator fragmentation has had time to build up. Lowering it gets you longer chunks and more risk, and the failure mode is a crash at minute fifteen.
Finally: this is a sizing hint for one stage. It won't save you if the VAE encode or decode is the thing running out of memory - those are different nodes with their own tile settings, and the pack's streaming versions exist because the native tiled decode keeps every decoded frame on the GPU.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | The encoded clip (SeedVR2 Preprocess (Compact) or SeedVR2 VAE Encode `latent`): its length and frame size. | |
| safety_margin | FLOAT | 0.640–4 | Each frame's share of the DiT's working set is budgeted at (1 + this) x the measured line. 0.64 picks the longest chunks measured on a long clip: 41 frames at 1080p on a 32 GB card, 161 on a 96 GB card. Raise it if a chunk runs out of memory, lower it to try longer chunks. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frames_per_chunk | INT | Pixel frames per chunk (4n+1), at most the clip's. Wire to Split SeedVR2 Latent's frames_per_chunk with its chunking_mode on manual. |