mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-16 00:12:33 +08:00
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)
This commit is contained in:
parent
bb7c582b58
commit
13a4008735
@ -393,9 +393,7 @@ class VideoFromComponents(VideoInput):
|
|||||||
raise ValueError(f"Unsupported codec: {resolved_codec}")
|
raise ValueError(f"Unsupported codec: {resolved_codec}")
|
||||||
ffmpeg_codec = codec_map[resolved_codec]
|
ffmpeg_codec = codec_map[resolved_codec]
|
||||||
|
|
||||||
extra_kwargs = {}
|
extra_kwargs = {"format": resolved_format.value}
|
||||||
if resolved_format != VideoContainer.AUTO:
|
|
||||||
extra_kwargs["format"] = resolved_format.value
|
|
||||||
|
|
||||||
container_options = {}
|
container_options = {}
|
||||||
if resolved_format == VideoContainer.MP4:
|
if resolved_format == VideoContainer.MP4:
|
||||||
@ -411,11 +409,9 @@ class VideoFromComponents(VideoInput):
|
|||||||
video_stream.width = self.__components.images.shape[2]
|
video_stream.width = self.__components.images.shape[2]
|
||||||
video_stream.height = self.__components.images.shape[1]
|
video_stream.height = self.__components.images.shape[1]
|
||||||
|
|
||||||
|
video_stream.pix_fmt = 'yuv420p'
|
||||||
if resolved_codec == VideoCodec.VP9:
|
if resolved_codec == VideoCodec.VP9:
|
||||||
video_stream.pix_fmt = 'yuv420p'
|
|
||||||
video_stream.bit_rate = 0
|
video_stream.bit_rate = 0
|
||||||
else:
|
|
||||||
video_stream.pix_fmt = 'yuv420p'
|
|
||||||
|
|
||||||
if quality is not None:
|
if quality is not None:
|
||||||
crf = quality_to_crf(quality, ffmpeg_codec)
|
crf = quality_to_crf(quality, ffmpeg_codec)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user