Comfy-Org/ComfyUI · error · ValueError
Only MP4 format is supported for now
Error message
Only MP4 format is supported for now
What it means
mp4_output_open_kwargs builds PyAV open options for video output and currently supports only the MP4 container. Passing any VideoContainer enum value other than AUTO or MP4 (e.g. WEBM, MKV, AVI) raises 'Only MP4 format is supported for now' — a deliberate capability gate, not a runtime failure.
Source
Thrown at comfy_api/latest/_input_impl/video_types.py:105
return frames[0].sample_rate, frames[0].layout.nb_channels
if i >= max_packets:
break
return 0, 0
def write_output_metadata(container: InputContainer, output, metadata: dict | None):
"""Copy the source container's metadata, then overlay the caller's tags."""
for key, value in container.metadata.items():
if metadata is None or key not in metadata:
output.metadata[key] = value
if metadata is not None:
for key, value in metadata.items():
output.metadata[key] = value if isinstance(value, str) else json.dumps(value)
def mp4_output_open_kwargs(path: str | io.BytesIO, format: VideoContainer, codec: VideoCodec) -> dict:
if format != VideoContainer.AUTO and format != VideoContainer.MP4:
raise ValueError("Only MP4 format is supported for now")
if codec != VideoCodec.AUTO and codec != VideoCodec.H264:
raise ValueError("Only H264 codec is supported for now")
# FFmpeg's faststart pass reopens the output by filename, so it cannot be used with file-like objects.
movflags = "use_metadata_tags+faststart" if isinstance(path, (str, os.PathLike)) else "use_metadata_tags"
open_kwargs = {"mode": "w", "options": {"movflags": movflags}}
if isinstance(format, VideoContainer) and format != VideoContainer.AUTO:
open_kwargs["format"] = format.value
elif isinstance(path, io.BytesIO):
open_kwargs["format"] = "mp4" # no file extension to infer the format from
return open_kwargs
class VideoFromFile(VideoInput):
"""
Class representing video input from a file.
"""
def __init__(self, file: str | io.BytesIO, *, start_time: float=0, duration: float=0):View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Select MP4 (or AUTO, which resolves to mp4) as the output container
- Restrict the UI/API option list to MP4/AUTO until other containers are implemented
- For other containers, transcode externally with ffmpeg after saving MP4
Example fix
// before save_video(..., format=VideoContainer.WEBM) # after save_video(..., format=VideoContainer.MP4)
Defensive patterns
Strategy: validation
Validate before calling
if format not in (VideoContainer.AUTO, VideoContainer.MP4):
format = VideoContainer.MP4 # or surface an option error in the UI before calling Type guard
def is_supported_container(f) -> bool:
return f in (VideoContainer.AUTO, VideoContainer.MP4) Prevention
- Keep the container dropdown limited to mp4/auto until more are supported
- Test new enum values against the writer before exposing them in the UI
When it happens
Trigger: Calling the video transcode/output path with format=VideoContainer.WEBM (or any non-MP4, non-AUTO container) from a node option or API parameter.
Common situations: Frontend exposes a container dropdown copied from another tool; user scripts pass webm/mkv hoping for support; version upgrades that added the enum before the encoders.
Related errors
- Only H264 codec is supported for now
- Only MP4 container format supported. Got: {container_format}
- {type(model).__name__} must implement map_context_window_to_
- ar_video sampler requires 5-D video latents [B,C,T,H,W], got
- MiniMax H3 supports batch size 1
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/28380b08f58a98a2.
Report an issue: GitHub.