{"record":{"id":"19a346f1a9d095e3","repo":"Comfy-Org/ComfyUI","slug":"seedvr2temporalchunk-frames-per-chunk-must-be-a-4","errorCode":null,"errorMessage":"SeedVR2TemporalChunk: frames_per_chunk must be a 4n+1 pixel-frame count (1, 5, 9, 13, 17, 21, ...); got {frames_per_chunk}.","messagePattern":"SeedVR2TemporalChunk: frames_per_chunk must be a 4n\\+1 pixel-frame count \\(1, 5, 9, 13, 17, 21, \\.\\.\\.\\); got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":494,"sourceCode":"            )\n        t_latent = samples.shape[2]\n        t_pixel = 4 * (t_latent - 1) + 1\n\n        if mode == \"auto\":\n            free_gb = comfy.model_management.get_free_memory(\n                comfy.model_management.get_torch_device()) / (1024 ** 3)\n            mpx_per_frame = (samples.shape[0] * samples.shape[3] * samples.shape[4]) * (BYTEDANCE_VAE_SPATIAL_DOWNSAMPLE ** 2) / 1e6\n            budget_gb = free_gb - SEEDVR2_CHUNK_RESERVED_GIB - SEEDVR2_CHUNK_SIGMA_K * SEEDVR2_CHUNK_SIGMA_GIB\n            chunk_latent_max = max(1, int(budget_gb / (SEEDVR2_CHUNK_GIB_PER_MPX_FRAME * mpx_per_frame)))\n            frames_per_chunk = min(4 * (chunk_latent_max - 1) + 1, t_pixel)\n            logging.info(\n                \"SeedVR2TemporalChunk auto: free=%.2fGiB, %.2fMpx -> frames_per_chunk=%d (t_pixel=%d).\",\n                free_gb, mpx_per_frame, frames_per_chunk, t_pixel,\n            )\n        else:\n            frames_per_chunk = chunking_mode[\"frames_per_chunk\"]\n            if frames_per_chunk < 1 or (frames_per_chunk - 1) % 4 != 0:\n                raise ValueError(\n                    f\"SeedVR2TemporalChunk: frames_per_chunk must be a 4n+1 pixel-frame count \"\n                    f\"(1, 5, 9, 13, 17, 21, ...); got {frames_per_chunk}.\"\n                )\n\n        if t_pixel <= frames_per_chunk:\n            return io.NodeOutput([latent], 0)\n\n        chunk_latent = (frames_per_chunk - 1) // 4 + 1\n        temporal_overlap = min(temporal_overlap, chunk_latent - 1)\n        step = chunk_latent - temporal_overlap\n\n        chunks = []\n        for start in range(0, t_latent, step):\n            end = min(start + chunk_latent, t_latent)\n            chunk = latent.copy()\n            chunk[\"samples\"] = samples[:, :, start:end].contiguous()\n            chunks.append(chunk)\n            if end >= t_latent:","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L476-L512","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nmode = {'chunking_mode': 'manual', 'frames_per_chunk': 16}  # not 4n+1 -> error\n\n# after\nmode = {'chunking_mode': 'manual', 'frames_per_chunk': 17}  # 17 = 4*4+1","handlingStrategy":"validation","validationCode":"frames_per_chunk = int(frames_per_chunk)\nif frames_per_chunk < 1 or (frames_per_chunk - 1) % 4 != 0:\n    frames_per_chunk = 4 * ((frames_per_chunk - 1) // 4) + 1  # snap down to nearest 4n+1\n    frames_per_chunk = max(1, frames_per_chunk)","typeGuard":"def is_4n_plus_1(n) -> bool:\n    return isinstance(n, int) and n >= 1 and (n - 1) % 4 == 0","tryCatchPattern":null,"preventionTips":["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, ..."],"tags":["seedvr","chunking","validation","video","api"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}