The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Fix VideoFromComponents.save_to crash when writing to BytesIO (#12683)
Arthur R Longbottomeb011733b6e4
diff --git a/comfy_api/latest/_input_impl/video_types.py b/comfy_api/latest/_input_impl/video_types.pyindex a3d48c87f..58a37c9e8 100644--- a/comfy_api/latest/_input_impl/video_types.py+++ b/comfy_api/latest/_input_impl/video_types.py@@ -401,6 +401,7 @@ class VideoFromComponents(VideoInput):codec: VideoCodec = VideoCodec.AUTO,metadata: Optional[dict] = None,):+ """Save the video to a file path or BytesIO buffer."""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:@@ -408,6 +409,10 @@ class VideoFromComponents(VideoInput):extra_kwargs = {}if isinstance(format, VideoContainer) and format != VideoContainer.AUTO:extra_kwargs["format"] = format.value+ elif isinstance(path, io.BytesIO):+ # BytesIO has no file extension, so av.open can't infer the format.+ # Default to mp4 since that's the only supported format anyway.+ extra_kwargs["format"] = "mp4"with av.open(path, mode='w', options={'movflags': 'use_metadata_tags'}, **extra_kwargs) as output:# Add metadata before writing any streamsif metadata is not None: