Skip to content

Commit 028e17d

Browse files
bigcat88comfyanonymous
authored andcommitted
add check for the format arg type in VideoFromComponents.save_to function (#11046)
* add check for the format var type in VideoFromComponents.save_to function * convert "format" to VideoContainer enum
1 parent 30c259c commit 028e17d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

comfy_api/latest/_input_impl/video_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def save_to(
337337
if codec != VideoCodec.AUTO and codec != VideoCodec.H264:
338338
raise ValueError("Only H264 codec is supported for now")
339339
extra_kwargs = {}
340-
if format != VideoContainer.AUTO:
340+
if isinstance(format, VideoContainer) and format != VideoContainer.AUTO:
341341
extra_kwargs["format"] = format.value
342342
with av.open(path, mode='w', options={'movflags': 'use_metadata_tags'}, **extra_kwargs) as output:
343343
# Add metadata before writing any streams

comfy_extras/nodes_video.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def define_schema(cls):
8888
)
8989

9090
@classmethod
91-
def execute(cls, video: VideoInput, filename_prefix, format, codec) -> io.NodeOutput:
91+
def execute(cls, video: VideoInput, filename_prefix, format: str, codec) -> io.NodeOutput:
9292
width, height = video.get_dimensions()
9393
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
9494
filename_prefix,
@@ -108,7 +108,7 @@ def execute(cls, video: VideoInput, filename_prefix, format, codec) -> io.NodeOu
108108
file = f"{filename}_{counter:05}_.{VideoContainer.get_extension(format)}"
109109
video.save_to(
110110
os.path.join(full_output_folder, file),
111-
format=format,
111+
format=VideoContainer(format),
112112
codec=codec,
113113
metadata=saved_metadata
114114
)

0 commit comments

Comments
 (0)