From 0864bcec00022ac2b18c78abc6e1da707955b277 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Sat, 31 Jan 2026 00:01:27 -0800 Subject: [PATCH] Added strict_duration bool to node definition --- comfy_extras/nodes_video.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_video.py b/comfy_extras/nodes_video.py index 84351dbed..cd765a7c1 100644 --- a/comfy_extras/nodes_video.py +++ b/comfy_extras/nodes_video.py @@ -232,6 +232,11 @@ class VideoSlice(io.ComfyNode): step=0.001, tooltip="Duration in seconds, or 0 for unlimited duration", ), + io.Boolean.Input( + "strict_duration", + default=False, + tooltip="If True, when the specified duration is not possible, an error will be raised.", + ), ], outputs=[ io.Video.Output(), @@ -239,8 +244,8 @@ class VideoSlice(io.ComfyNode): ) @classmethod - def execute(cls, video, start_time, duration) -> io.NodeOutput: - trimmed = video.as_trimmed(start_time, duration, strict_duration=False) + def execute(cls, video: io.Video.Type, start_time: float, duration: float, strict_duration: bool) -> io.NodeOutput: + trimmed = video.as_trimmed(start_time, duration, strict_duration=strict_duration) if trimmed is not None: return io.NodeOutput(trimmed) raise ValueError(