{"record":{"id":"5a3625052c5fed32","repo":"Comfy-Org/ComfyUI","slug":"only-mp4-container-format-supported-got-contain","errorCode":null,"errorMessage":"Only MP4 container format supported. Got: {container_format}","messagePattern":"Only MP4 container format supported\\. Got: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/util/validation_utils.py","lineNumber":199,"sourceCode":"    if string is None:\n        raise Exception(f\"Field '{field_name}' cannot be empty.\")\n    if strip_whitespace:\n        string = string.strip()\n    if min_length and len(string) < min_length:\n        raise Exception(\n            f\"Field '{field_name}' cannot be shorter than {min_length} characters; was {len(string)} characters long.\"\n        )\n    if max_length and len(string) > max_length:\n        raise Exception(\n            f\" Field '{field_name} cannot be longer than {max_length} characters; was {len(string)} characters long.\"\n        )\n\n\ndef validate_container_format_is_mp4(video: Input.Video) -> None:\n    \"\"\"Validates video container format is MP4.\"\"\"\n    container_format = video.get_container_format()\n    if container_format not in [\"mp4\", \"mov,mp4,m4a,3gp,3g2,mj2\"]:\n        raise ValueError(f\"Only MP4 container format supported. Got: {container_format}\")\n\n\ndef _ratio_from_tuple(r: tuple[float, float]) -> float:\n    a, b = r\n    if a <= 0 or b <= 0:\n        raise ValueError(f\"Ratios must be positive, got {a}:{b}.\")\n    return a / b\n\n\ndef _assert_ratio_bounds(\n    ar: float,\n    *,\n    min_ratio: tuple[float, float] | None = None,\n    max_ratio: tuple[float, float] | None = None,\n    strict: bool = True,\n) -> None:\n    \"\"\"Validate a numeric aspect ratio against optional min/max ratio bounds.\"\"\"\n    lo = _ratio_from_tuple(min_ratio) if min_ratio is not None else None","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/validation_utils.py#L181-L217","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-container or transcode the input to MP4 (ffmpeg -i in.webm -c copy out.mp4, or full re-encode if codecs are incompatible).","If the file is already H.264/AAC in another container, remux without re-encoding to save time.","Regenerate the video from a ComfyUI video-output node (VHS or built-in), which produces MP4 by default.","If you truly have MOV content, ensure the probe brand string matches the accepted pair — otherwise remux to plain MP4."],"exampleFix":"# before: WebM input\nvalidate_container_format_is_mp4(video)  # ValueError: Only MP4 container format supported. Got: webm\n\n# after: remux first\n# ffmpeg -i input.webm -c:v copy -c:a aac input.mp4\n# then load input.mp4 into the workflow","handlingStrategy":"validation","validationCode":"import subprocess, json\nfmt = json.loads(subprocess.check_output(['ffprobe','-v','quiet','-show_format','-print_format','json',path]))['format']['format_name']\nif fmt not in ('mp4,mov', 'mov,mp4,m4a,3gp,3g2,mj2', 'mp4'):\n    raise ValueError(f'container {fmt!r} is not MP4; remux with ffmpeg')","typeGuard":null,"tryCatchPattern":"try: validate_container_format_is_mp4(video) except ValueError as e: raise UserVisibleError(f'Re-encode input to MP4: {e}') from e","preventionTips":["Standardize on MP4 (H.264/AAC) outputs from upstream video tools.","Remux with ffmpeg -c copy rather than re-encoding when codecs already fit.","Avoid feeding WebM/MKV downloads directly into MP4-only API nodes."],"tags":["video","api-nodes","validation","container-format","mp4"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}