Comfy-Org/ComfyUI · error · ValueError
SeedVR2TemporalChunk: frames_per_chunk must be a 4n+1 pixel-
Error message
SeedVR2TemporalChunk: frames_per_chunk must be a 4n+1 pixel-frame count (1, 5, 9, 13, 17, 21, ...); got {frames_per_chunk}. What it means
In manual mode, SeedVR2TemporalChunk requires frames_per_chunk to satisfy t = 4n+1 (1, 5, 9, 13, ...) because the SeedVR2 causal VAE encodes temporal length as 4n+1 pixel frames per latent segment. Any other positive count — or a value < 1 — fails with the offending number.
Source
Thrown at comfy_extras/nodes_seedvr.py:494
)
t_latent = samples.shape[2]
t_pixel = 4 * (t_latent - 1) + 1
if mode == "auto":
free_gb = comfy.model_management.get_free_memory(
comfy.model_management.get_torch_device()) / (1024 ** 3)
mpx_per_frame = (samples.shape[0] * samples.shape[3] * samples.shape[4]) * (BYTEDANCE_VAE_SPATIAL_DOWNSAMPLE ** 2) / 1e6
budget_gb = free_gb - SEEDVR2_CHUNK_RESERVED_GIB - SEEDVR2_CHUNK_SIGMA_K * SEEDVR2_CHUNK_SIGMA_GIB
chunk_latent_max = max(1, int(budget_gb / (SEEDVR2_CHUNK_GIB_PER_MPX_FRAME * mpx_per_frame)))
frames_per_chunk = min(4 * (chunk_latent_max - 1) + 1, t_pixel)
logging.info(
"SeedVR2TemporalChunk auto: free=%.2fGiB, %.2fMpx -> frames_per_chunk=%d (t_pixel=%d).",
free_gb, mpx_per_frame, frames_per_chunk, t_pixel,
)
else:
frames_per_chunk = chunking_mode["frames_per_chunk"]
if frames_per_chunk < 1 or (frames_per_chunk - 1) % 4 != 0:
raise ValueError(
f"SeedVR2TemporalChunk: frames_per_chunk must be a 4n+1 pixel-frame count "
f"(1, 5, 9, 13, 17, 21, ...); got {frames_per_chunk}."
)
if t_pixel <= frames_per_chunk:
return io.NodeOutput([latent], 0)
chunk_latent = (frames_per_chunk - 1) // 4 + 1
temporal_overlap = min(temporal_overlap, chunk_latent - 1)
step = chunk_latent - temporal_overlap
chunks = []
for start in range(0, t_latent, step):
end = min(start + chunk_latent, t_latent)
chunk = latent.copy()
chunk["samples"] = samples[:, :, start:end].contiguous()
chunks.append(chunk)
if end >= t_latent:View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Choose a 4n+1 value: 1, 5, 9, 13, 17, 21, 25, ...
- Compute it from the desired latent length: frames_per_chunk = 4 * (latent_frames - 1) + 1.
- Or switch chunking_mode to 'auto' and let the node derive a valid count from free VRAM.
Example fix
# before
mode = {'chunking_mode': 'manual', 'frames_per_chunk': 16} # not 4n+1 -> error
# after
mode = {'chunking_mode': 'manual', 'frames_per_chunk': 17} # 17 = 4*4+1 Defensive patterns
Strategy: validation
Validate before calling
frames_per_chunk = int(frames_per_chunk)
if frames_per_chunk < 1 or (frames_per_chunk - 1) % 4 != 0:
frames_per_chunk = 4 * ((frames_per_chunk - 1) // 4) + 1 # snap down to nearest 4n+1
frames_per_chunk = max(1, frames_per_chunk) Type guard
def is_4n_plus_1(n) -> bool:
return isinstance(n, int) and n >= 1 and (n - 1) % 4 == 0 Prevention
- Compute chunk sizes as 4*(latent_frames-1)+1 instead of round numbers.
- Prefer 'auto' mode unless you need exact chunk boundaries.
- Remember valid values: 1, 5, 9, 13, 17, 21, ...
When it happens
Trigger: Setting chunking_mode to manual with frames_per_chunk values like 4, 8, 16, 0, or -5 in the chunking_mode primitive or via the API.
Common situations: Users assuming power-of-two or round chunk sizes (8, 16) from other video tools; porting settings from a different chunking node; API prompts with unvalidated integers.
Related errors
- SeedVR2TemporalChunk: temporal_overlap must be >= 0; got {te
- SeedVR2Preprocess expected at least one frame.
- SeedVR2TemporalChunk: expected a 5-D video latent (B, C, T,
- SeedVR2TemporalChunk: expected {SEEDVR2_LATENT_CHANNELS} lat
- SeedVR2TemporalChunk: chunking_mode must be 'auto' or 'manua
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/19a346f1a9d095e3.
Report an issue: GitHub.