From 13a40087351c6d52a3b151394fd586ac7d2078d5 Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 20 Jan 2026 12:55:34 -0800 Subject: [PATCH] refactor: simplify redundant code in video encoding - Remove redundant pix_fmt assignment (set once instead of in both branches) - Remove unnecessary VideoContainer.AUTO check (format already normalized) --- comfy_api/latest/_input_impl/video_types.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/comfy_api/latest/_input_impl/video_types.py b/comfy_api/latest/_input_impl/video_types.py index 72f149978..6a8fbe713 100644 --- a/comfy_api/latest/_input_impl/video_types.py +++ b/comfy_api/latest/_input_impl/video_types.py @@ -393,9 +393,7 @@ class VideoFromComponents(VideoInput): raise ValueError(f"Unsupported codec: {resolved_codec}") ffmpeg_codec = codec_map[resolved_codec] - extra_kwargs = {} - if resolved_format != VideoContainer.AUTO: - extra_kwargs["format"] = resolved_format.value + extra_kwargs = {"format": resolved_format.value} container_options = {} if resolved_format == VideoContainer.MP4: @@ -411,11 +409,9 @@ class VideoFromComponents(VideoInput): video_stream.width = self.__components.images.shape[2] video_stream.height = self.__components.images.shape[1] + video_stream.pix_fmt = 'yuv420p' if resolved_codec == VideoCodec.VP9: - video_stream.pix_fmt = 'yuv420p' video_stream.bit_rate = 0 - else: - video_stream.pix_fmt = 'yuv420p' if quality is not None: crf = quality_to_crf(quality, ffmpeg_codec)