Comfy-Org/ComfyUI · error · ValueError
SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H
Error message
SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H, W); chunk 0 has shape {tuple(first.shape)}. What it means
SeedVR2TemporalMerge merges temporally-chunked video latents and requires each chunk to be a 5-D tensor shaped (B, C, T, H, W). The first chunk is checked with ndim != 5, so any 4-D image latent or differently-ranked tensor is rejected before concatenation. This guard exists because torch.cat along dim=2 and the overlap-blending logic only make sense for video latents produced by a video VAE.
Source
Thrown at comfy_extras/nodes_seedvr.py:547
io.Int.Input("temporal_overlap", default=0, min=0, max=16384, force_input=True,
tooltip="The temporal_overlap output of Split SeedVR2 Latent. 0 = plain concatenation."),
],
outputs=[
io.Latent.Output(display_name="latent", tooltip="The recombined full-length latent."),
],
)
@classmethod
def execute(cls, latents, temporal_overlap) -> io.NodeOutput:
temporal_overlap = temporal_overlap[0]
if temporal_overlap < 0:
raise ValueError(
f"SeedVR2TemporalMerge: temporal_overlap must be >= 0; got {temporal_overlap}."
)
chunks = [entry["samples"] for entry in latents]
first = chunks[0]
if first.ndim != 5:
raise ValueError(
f"SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H, W); "
f"chunk 0 has shape {tuple(first.shape)}."
)
for i, chunk in enumerate(chunks[1:], start=1):
if chunk.shape[:2] != first.shape[:2] or chunk.shape[3:] != first.shape[3:]:
raise ValueError(
f"SeedVR2TemporalMerge: chunk {i} shape {tuple(chunk.shape)} does not "
f"match chunk 0 shape {tuple(first.shape)} outside the temporal axis."
)
if i < len(chunks) - 1 and chunk.shape[2] != first.shape[2]:
raise ValueError(
f"SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent frames but "
f"chunk 0 has {first.shape[2]}; only the final chunk may be shorter."
)
out = latents[0].copy()
out.pop("noise_mask", None)
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Feed only video latents (5-D) from the SeedVR2 video VAE encode path into SeedVR2TemporalMerge
- If you have single-frame latents, unsqueeze/stack them to (B, C, T, H, W) with T frames before merging
- For image (non-video) restoration, bypass SeedVR2TemporalMerge entirely — it is only for chunked video processing
Example fix
# before: image latents (B, C, H, W) passed to temporal merge merge = SeedVR2TemporalMerge.execute(latents, overlap) # after: ensure 5-D video latents from the video VAE # latents[i]["samples"].shape == (B, C, T, H, W)
Defensive patterns
Strategy: type-guard
Validate before calling
chunks = [e["samples"] for e in latents]
if any(c.ndim != 5 for c in chunks):
raise SystemExit("Need 5-D (B, C, T, H, W) video latents; got " + str([tuple(c.shape) for c in chunks])) Type guard
def is_video_latent(t) -> bool:
return isinstance(t, torch.Tensor) and t.ndim == 5 Prevention
- Always source temporal-merge latents from the video VAE encode path, never image latents
- Log chunk shapes before merging when building custom chunk pipelines
When it happens
Trigger: Feeding the node a list of latents where entry['samples'] is 4-D (B, C, H, W) — e.g. outputs of an image VAE encode, a VAEDecode-to-latent round trip on single images, or a latent from LoadImage-based image workflows instead of the SeedVR2 video restoration path.
Common situations: Using SeedVR2 image restoration nodes (which emit 4-D latents) with the temporal merge node meant for SeedVR2 video chunked restoration; hand-building the latents list from image latents; converting a video workflow to images and forgetting the merge node is video-only.
Related errors
- SeedVR2TemporalMerge: chunk {i} shape {tuple(chunk.shape)} d
- SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent
- SeedVR2Preprocess expected at least one frame.
- SeedVR2Preprocess failed to pad video length to 4n+1; got {v
- SeedVR2TemporalChunk: frames_per_chunk must be a 4n+1 pixel-
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/921ccfefbcc1b9c1.
Report an issue: GitHub.