Comfy-Org/ComfyUI · error · ValueError

Reference video {index} is too large: {w}x{h} = {pixels:,} t

Error message

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.

What it means

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.

Source

Thrown at comfy_api_nodes/nodes_bytedance.py:150

    if not model_limits:
        return
    limits = model_limits.get(resolution)
    if not limits:
        return
    try:
        w, h = video.get_dimensions()
    except Exception:
        return
    pixels = w * h
    min_px = limits.get("min")
    max_px = limits.get("max")
    if min_px and pixels < min_px:
        raise ValueError(
            f"Reference video {index} is too small: {w}x{h} = {pixels:,} total pixels. "
            f"Minimum for this model is {min_px:,} total pixels."
        )
    if max_px and pixels > max_px:
        raise ValueError(
            f"Reference video {index} is too large: {w}x{h} = {pixels:,} total pixels. "
            f"Maximum for this model is {max_px:,} total pixels. Try downscaling the video."
        )


def _prepare_seedance_image(image: Input.Image) -> Input.Image:
    """Auto-downscale a Seedance image input to the per-side limits, then validate it."""
    validate_image_aspect_ratio(image, (2, 5), (5, 2), strict=False)  # 0.4 to 2.5
    image = downscale_image_tensor_by_max_side(image, max_side=6000)
    validate_image_dimensions(image, min_width=300, min_height=300, max_width=6000, max_height=6000)
    return image


# Supported output aspect ratios, used to pre-size FLF frames to matching pixel pair to avoid the 1080p stretch jump.
SEEDANCE2_RATIO_WH = {
    "16:9": (16, 9),
    "4:3": (4, 3),
    "1:1": (1, 1),

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Downscale the reference video before the node (e.g. ffmpeg or a video resize node) to fit the pixel budget.
  2. Trim/crop to fewer pixels if downscaling quality is a concern.
  3. Use an image keyframe instead of a video reference where possible - images are auto-downscaled.

Example fix

# ffmpeg: bring reference under the pixel budget
# ffmpeg -i ref.mp4 -vf "scale=1280:720" ref_small.mp4
Defensive patterns

Strategy: validation

Validate before calling

w, h = ref_video.get_dimensions()
limits = model_limits.get(resolution, {})
if limits.get('max') and w * h > limits['max']:
    scale = (limits['max'] / (w * h)) ** 0.5
    ref_video = resize_video(ref_video, int(w * scale), int(h * scale))

Prevention

When it happens

Trigger: Reference video with w*h > limits['max'] for the selected Seedance resolution/model (e.g. 4K footage as reference).

Common situations: 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.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/597b58fcb2800060. Report an issue: GitHub.