Comfy-Org/ComfyUI · error · ValueError

Video size ({video_size / 1024 / 1024:.1f}MB) exceeds 50MB l

Error message

Video size ({video_size / 1024 / 1024:.1f}MB) exceeds 50MB limit.

What it means

Thrown by the Grok video edit node when the local video file (measured via get_fs_object_size on the stream source) exceeds 50 MB. The video is uploaded to the ComfyAPI proxy and then forwarded to xAI's /v1/videos/edits endpoint, which enforces a 50 MB upload cap. The check runs after validate_video_duration (1-8.7 s) and before the upload, so it fails fast without wasting bandwidth.

Source

Thrown at comfy_api_nodes/nodes_grok.py:811

            price_badge=IO.PriceBadge(
                expr="""{"type":"usd","usd": 0.06, "format": {"suffix": "/sec", "approximate": true}}""",
            ),
        )

    @classmethod
    async def execute(
        cls,
        model: str,
        prompt: str,
        video: Input.Video,
        seed: int,
    ) -> IO.NodeOutput:
        validate_string(prompt, strip_whitespace=True, min_length=1)
        validate_video_duration(video, min_duration=1, max_duration=8.7)
        video_stream = video.get_stream_source()
        video_size = get_fs_object_size(video_stream)
        if video_size > 50 * 1024 * 1024:
            raise ValueError(f"Video size ({video_size / 1024 / 1024:.1f}MB) exceeds 50MB limit.")
        initial_response = await sync_op(
            cls,
            ApiEndpoint(path="/proxy/xai/v1/videos/edits", method="POST"),
            data=VideoEditRequest(
                model=model,
                video=InputUrlObject(url=await upload_video_to_comfyapi(cls, video)),
                prompt=prompt,
                seed=seed,
            ),
            response_model=VideoGenerationResponse,
        )
        response = await poll_op(
            cls,
            ApiEndpoint(path=f"/proxy/xai/v1/videos/{initial_response.request_id}"),
            status_extractor=lambda r: r.status if r.status is not None else "complete",
            response_model=VideoStatusResponse,
            price_extractor=_extract_grok_price,
        )

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Re-encode the video at a lower bitrate so the file is under 50 MB (e.g. ffmpeg -crf 23 H.264) while keeping duration within 1-8.7 s
  2. Reduce resolution/framerate of the clip before feeding it to the node
  3. Trim the clip to the shortest segment that still conveys the edit

Example fix

# before: 8s 4K ProRes clip (~120MB) -> error
# after: re-encode within the 50MB budget
ffmpeg -i input.mov -t 8 -vf scale=1920:-2 -c:v libx264 -crf 24 -c:a aac output.mp4
Defensive patterns

Strategy: validation

Validate before calling

import os
from comfy_api_nodes.utils import get_fs_object_size

def video_under_50mb(video) -> bool:
    return get_fs_object_size(video.get_stream_source()) <= 50 * 1024 * 1024

Prevention

When it happens

Trigger: Running Grok video edit on a video longer than ~8.7 s is blocked earlier, but a short, high-bitrate clip (e.g. 8 s of 4K ProRes/high-Mbps H.264) whose file size exceeds 50 MB.

Common situations: High-bitrate source footage from a phone or pro camera, lossless intermediates (ProRes, FFV1), or clips re-encoded at very high quality settings.

Related errors


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