Skip to content

VideoFromComponents crashes with 'Could not determine output format' when writing to BytesIO #12684

@artokun

Description

@artokun

Custom Node Testing

  • I have tried disabling custom nodes and the issue persists

Your question

When a tensor-based video (from Create Video or similar nodes) is passed to any node that calls validate_container_format_is_mp4() — like TopazVideoEnhance — it crashes with ValueError: Could not determine output format.

The issue is in VideoFromComponents.save_to(). When get_container_format() calls get_stream_source(), it passes a BytesIO() buffer to save_to(). Since BytesIO has no file extension, av.open can't infer the output format.

VideoFromFile.save_to() already handles this correctly via get_open_write_kwargs(), which detects BytesIO and sets the format explicitly. VideoFromComponents just never got the same treatment.

Logs

File "comfy_api/latest/_input_impl/video_types.py", line 411, in save_to
    with av.open(path, mode='w', options={'movflags': 'use_metadata_tags'}, **extra_kwargs) as output:
ValueError: Could not determine output format

OS

Windows 11

ComfyUI Revision / Version

v0.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions