{"record":{"id":"dc4cb3da1d268217","repo":"Comfy-Org/ComfyUI","slug":"video-width-must-be-at-most-max-width-px-got-wi","errorCode":null,"errorMessage":"Video width must be at most {max_width}px, got {width}px","messagePattern":"Video width must be at most (.+?)px, got (.+?)px","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/util/validation_utils.py","lineNumber":112,"sourceCode":"\n\ndef validate_video_dimensions(\n    video: Input.Video,\n    min_width: int | None = None,\n    max_width: int | None = None,\n    min_height: int | None = None,\n    max_height: int | None = None,\n):\n    try:\n        width, height = video.get_dimensions()\n    except Exception as e:\n        logging.error(\"Error getting dimensions of video: %s\", e)\n        return\n\n    if min_width is not None and width < min_width:\n        raise ValueError(f\"Video width must be at least {min_width}px, got {width}px\")\n    if max_width is not None and width > max_width:\n        raise ValueError(f\"Video width must be at most {max_width}px, got {width}px\")\n    if min_height is not None and height < min_height:\n        raise ValueError(f\"Video height must be at least {min_height}px, got {height}px\")\n    if max_height is not None and height > max_height:\n        raise ValueError(f\"Video height must be at most {max_height}px, got {height}px\")\n\n\ndef validate_video_duration(\n    video: Input.Video,\n    min_duration: float | None = None,\n    max_duration: float | None = None,\n):\n    try:\n        duration = video.get_duration()\n    except Exception as e:\n        logging.error(\"Error getting duration of video: %s\", e)\n        return\n\n    epsilon = 0.0001","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/validation_utils.py#L94-L130","documentation":"ValueError from validate_video_dimensions when the video's width exceeds the allowed maximum. Dimensions are read via video.get_dimensions(); exceeding max_width raises before the upload/API call, saving a round-trip rejection from the provider.","triggerScenarios":"validate_video_dimensions(video, max_width=N) with width > N — e.g., 4K (3840px) footage into a node capping max_width=2048.","commonSituations":"4K/UHD source clips; upscaled video; screen recordings at native monitor width exceeding provider caps.","solutions":["Downscale/re-encode the video to width <= max_width before the node.","Trim the export resolution in your video editor or via ffmpeg: ffmpeg -i in.mp4 -vf scale=2048:-2 out.mp4.","Choose a provider supporting higher resolutions if you need full width."],"exampleFix":"# shell: downscale before loading\n# ffmpeg -i input.mp4 -vf scale=2048:-2 output.mp4","handlingStrategy":"validation","validationCode":"width, _ = video.get_dimensions()\nif width > MAX_W:\n    raise ValueError(f\"downscale first: {width}px > {MAX_W}px\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Re-encode 4K sources down to the provider cap with ffmpeg before loading","Cap export resolution in your editor"],"tags":["validation","video","dimensions"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}