Comfy-Org/ComfyUI · error · ValueError
Video height must be at most {max_height}px, got {height}px
Error message
Video height must be at most {max_height}px, got {height}px What it means
ValueError from validate_video_dimensions when the video's height exceeds the allowed maximum. Enforced locally after a successful get_dimensions() call, mirroring the other dimension bounds, so oversized videos fail before consuming an upload slot or API credits.
Source
Thrown at comfy_api_nodes/util/validation_utils.py:116
min_width: int | None = None,
max_width: int | None = None,
min_height: int | None = None,
max_height: int | None = None,
):
try:
width, height = video.get_dimensions()
except Exception as e:
logging.error("Error getting dimensions of video: %s", e)
return
if min_width is not None and width < min_width:
raise ValueError(f"Video width must be at least {min_width}px, got {width}px")
if max_width is not None and width > max_width:
raise ValueError(f"Video width must be at most {max_width}px, got {width}px")
if min_height is not None and height < min_height:
raise ValueError(f"Video height must be at least {min_height}px, got {height}px")
if max_height is not None and height > max_height:
raise ValueError(f"Video height must be at most {max_height}px, got {height}px")
def validate_video_duration(
video: Input.Video,
min_duration: float | None = None,
max_duration: float | None = None,
):
try:
duration = video.get_duration()
except Exception as e:
logging.error("Error getting duration of video: %s", e)
return
epsilon = 0.0001
if min_duration is not None and min_duration - epsilon > duration:
raise ValueError(f"Video duration must be at least {min_duration}s, got {duration}s")
if max_duration is not None and duration > max_duration + epsilon:
raise ValueError(f"Video duration must be at most {max_duration}s, got {duration}s")View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Downscale the video so height <= max_height (ffmpeg -vf scale=-2:1280).
- Crop vertically if the composition allows.
- Use a provider tier that accepts higher resolutions.
Defensive patterns
Strategy: validation
Validate before calling
_, height = video.get_dimensions()
if height > MAX_H:
raise ValueError(f"downscale first: {height}px > {MAX_H}px") Prevention
- Downscale vertical/4K video before API nodes
- Verify final export resolution with ffprobe
When it happens
Trigger: validate_video_dimensions(video, max_height=N) with height > N — e.g., a 2160px-tall 4K video into a node capping max_height=1280.
Common situations: Portrait/vertical 4K video; upscaled footage; provider caps lower than the source resolution.
Related errors
- Video width must be at least {min_width}px, got {width}px
- Video width must be at most {max_width}px, got {width}px
- Video height must be at least {min_height}px, got {height}px
- ar_video sampler requires 5-D video latents [B,C,T,H,W], got
- unknown merge strategy {self.merge_strategy}
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/c9dc84b47040cdde.
Report an issue: GitHub.