{"record":{"id":"597b58fcb2800060","repo":"Comfy-Org/ComfyUI","slug":"reference-video-index-is-too-large-w-x-h-p","errorCode":null,"errorMessage":"Reference video {index} is too large: {w}x{h} = {pixels:,} total pixels. Maximum for this model is {max_px:,} total pixels. Try downscaling the video.","messagePattern":"Reference video (.+?) is too large: (.+?)x(.+?) = (.+?) total pixels\\. Maximum for this model is (.+?) total pixels\\. Try downscaling the video\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":150,"sourceCode":"    if not model_limits:\n        return\n    limits = model_limits.get(resolution)\n    if not limits:\n        return\n    try:\n        w, h = video.get_dimensions()\n    except Exception:\n        return\n    pixels = w * h\n    min_px = limits.get(\"min\")\n    max_px = limits.get(\"max\")\n    if min_px and pixels < min_px:\n        raise ValueError(\n            f\"Reference video {index} is too small: {w}x{h} = {pixels:,} total pixels. \"\n            f\"Minimum for this model is {min_px:,} total pixels.\"\n        )\n    if max_px and pixels > max_px:\n        raise ValueError(\n            f\"Reference video {index} is too large: {w}x{h} = {pixels:,} total pixels. \"\n            f\"Maximum for this model is {max_px:,} total pixels. Try downscaling the video.\"\n        )\n\n\ndef _prepare_seedance_image(image: Input.Image) -> Input.Image:\n    \"\"\"Auto-downscale a Seedance image input to the per-side limits, then validate it.\"\"\"\n    validate_image_aspect_ratio(image, (2, 5), (5, 2), strict=False)  # 0.4 to 2.5\n    image = downscale_image_tensor_by_max_side(image, max_side=6000)\n    validate_image_dimensions(image, min_width=300, min_height=300, max_width=6000, max_height=6000)\n    return image\n\n\n# Supported output aspect ratios, used to pre-size FLF frames to matching pixel pair to avoid the 1080p stretch jump.\nSEEDANCE2_RATIO_WH = {\n    \"16:9\": (16, 9),\n    \"4:3\": (4, 3),\n    \"1:1\": (1, 1),","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L132-L168","documentation":"Seedance reference-video upper bound: when a reference video's total pixels exceed the 'max' entry for the selected model/resolution, the node raises and suggests downscaling, since oversized uploads waste quota and can be rejected server-side.","triggerScenarios":"Reference video with w*h > limits['max'] for the selected Seedance resolution/model (e.g. 4K footage as reference).","commonSituations":"User wires full-quality source footage as a first/last-frame reference; only the image path auto-downscales (downscale_image_tensor_by_max_side is applied to images, not videos), so videos must be pre-sized by the user.","solutions":["Downscale the reference video before the node (e.g. ffmpeg or a video resize node) to fit the pixel budget.","Trim/crop to fewer pixels if downscaling quality is a concern.","Use an image keyframe instead of a video reference where possible - images are auto-downscaled."],"exampleFix":"# ffmpeg: bring reference under the pixel budget\n# ffmpeg -i ref.mp4 -vf \"scale=1280:720\" ref_small.mp4","handlingStrategy":"validation","validationCode":"w, h = ref_video.get_dimensions()\nlimits = model_limits.get(resolution, {})\nif limits.get('max') and w * h > limits['max']:\n    scale = (limits['max'] / (w * h)) ** 0.5\n    ref_video = resize_video(ref_video, int(w * scale), int(h * scale))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unlike images, Seedance video references are NOT auto-downscaled - always pre-downscale.","Keep reference clips at working resolution (720p-1080p) rather than source quality."],"tags":["comfyui","seedance","bytedance","video","limits","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}