Comfy-Org/ComfyUI · error · ValueError

Only MP4 container format supported. Got: {container_format}

Error message

Only MP4 container format supported. Got: {container_format}

What it means

Raised by validate_container_format_is_mp4() in comfy_api_nodes/util/validation_utils.py when the video's container (probed via video.get_container_format()) is not MP4. The odd second entry 'mov,mp4,m4a,3gp,3g2,mj2' is the raw major-brand list FFprobe-style probes return for MOV/MP4 family files, so both spellings are accepted. Exists because target APIs (e.g. certain lip-sync/upload endpoints) only ingest MP4 payloads.

Source

Thrown at comfy_api_nodes/util/validation_utils.py:199

    if string is None:
        raise Exception(f"Field '{field_name}' cannot be empty.")
    if strip_whitespace:
        string = string.strip()
    if min_length and len(string) < min_length:
        raise Exception(
            f"Field '{field_name}' cannot be shorter than {min_length} characters; was {len(string)} characters long."
        )
    if max_length and len(string) > max_length:
        raise Exception(
            f" Field '{field_name} cannot be longer than {max_length} characters; was {len(string)} characters long."
        )


def validate_container_format_is_mp4(video: Input.Video) -> None:
    """Validates video container format is MP4."""
    container_format = video.get_container_format()
    if container_format not in ["mp4", "mov,mp4,m4a,3gp,3g2,mj2"]:
        raise ValueError(f"Only MP4 container format supported. Got: {container_format}")


def _ratio_from_tuple(r: tuple[float, float]) -> float:
    a, b = r
    if a <= 0 or b <= 0:
        raise ValueError(f"Ratios must be positive, got {a}:{b}.")
    return a / b


def _assert_ratio_bounds(
    ar: float,
    *,
    min_ratio: tuple[float, float] | None = None,
    max_ratio: tuple[float, float] | None = None,
    strict: bool = True,
) -> None:
    """Validate a numeric aspect ratio against optional min/max ratio bounds."""
    lo = _ratio_from_tuple(min_ratio) if min_ratio is not None else None

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Re-container or transcode the input to MP4 (ffmpeg -i in.webm -c copy out.mp4, or full re-encode if codecs are incompatible).
  2. If the file is already H.264/AAC in another container, remux without re-encoding to save time.
  3. Regenerate the video from a ComfyUI video-output node (VHS or built-in), which produces MP4 by default.
  4. If you truly have MOV content, ensure the probe brand string matches the accepted pair — otherwise remux to plain MP4.

Example fix

# before: WebM input
validate_container_format_is_mp4(video)  # ValueError: Only MP4 container format supported. Got: webm

# after: remux first
# ffmpeg -i input.webm -c:v copy -c:a aac input.mp4
# then load input.mp4 into the workflow
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, json
fmt = json.loads(subprocess.check_output(['ffprobe','-v','quiet','-show_format','-print_format','json',path]))['format']['format_name']
if fmt not in ('mp4,mov', 'mov,mp4,m4a,3gp,3g2,mj2', 'mp4'):
    raise ValueError(f'container {fmt!r} is not MP4; remux with ffmpeg')

Try / catch

try: validate_container_format_is_mp4(video) except ValueError as e: raise UserVisibleError(f'Re-encode input to MP4: {e}') from e

Prevention

When it happens

Trigger: Connecting a WebM, MKV, AVI, GIF-as-video, or raw .mov file whose probe string differs from the accepted pair into a node that calls validate_container_format_is_mp4(video) before upload.

Common situations: Videos downloaded from the web (often WebM), screen recordings in MKV, or outputs of other video tools that default to non-MP4 containers. Also a .mov that probes with a different brand string. Some pipelines emit 'mp4' vs 'mov,mp4,...' inconsistently depending on the muxer version.

Related errors


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