Comfy-Org/ComfyUI · error · ValueError
Video duration must be at least {min_duration}s, got {durati
Error message
Video duration must be at least {min_duration}s, got {duration}s What it means
ValueError from validate_video_duration when the video is shorter than the API's minimum duration. Duration comes from video.get_duration(); an epsilon of 0.0001s absorbs float rounding, so the check is effectively duration < min_duration. Read failures are logged and return silently, so this raise means a valid but too-short clip.
Source
Thrown at comfy_api_nodes/util/validation_utils.py:132
raise ValueError(f"Video height must be at least {min_height}px, got {height}px")
if max_height is not None and height > max_height:
raise ValueError(f"Video height must be at most {max_height}px, got {height}px")
def validate_video_duration(
video: Input.Video,
min_duration: float | None = None,
max_duration: float | None = None,
):
try:
duration = video.get_duration()
except Exception as e:
logging.error("Error getting duration of video: %s", e)
return
epsilon = 0.0001
if min_duration is not None and min_duration - epsilon > duration:
raise ValueError(f"Video duration must be at least {min_duration}s, got {duration}s")
if max_duration is not None and duration > max_duration + epsilon:
raise ValueError(f"Video duration must be at most {max_duration}s, got {duration}s")
def validate_video_frame_count(
video: Input.Video,
min_frame_count: int | None = None,
max_frame_count: int | None = None,
):
try:
frame_count = video.get_frame_count()
except Exception as e:
logging.error("Error getting frame count of video: %s", e)
return
if min_frame_count is not None and min_frame_count > frame_count:
raise ValueError(f"Video frame count must be at least {min_frame_count}, got {frame_count}")
if max_frame_count is not None and frame_count > max_frame_count:View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Extend the clip (loop frames, slower FPS export, or additional source footage) to reach min_duration.
- Choose a provider/node with a lower minimum duration.
- Check the exported file's duration (ffprobe) to confirm it matches what you expect.
Defensive patterns
Strategy: validation
Validate before calling
duration = video.get_duration()
if duration is not None and duration < MIN_DUR:
raise ValueError(f"clip too short: {duration:.2f}s < {MIN_DUR}s") Prevention
- Confirm clip length with ffprobe before running video nodes
- Loop or extend short clips to meet provider minimums
When it happens
Trigger: validate_video_duration(video, min_duration=N) with duration < N - epsilon — e.g., a 2-second clip into a video-generation node requiring min_duration=5.
Common situations: Short loops or GIFs converted to video; trimmed clips that fell under the provider minimum; first/last-frame nodes fed very short segments.
Related errors
- Reference video {i} is too short: {dur:.1f}s. Minimum durati
- Total reference video duration is {total_video_duration:.1f}
- Video duration must be at most {max_duration}s, got {duratio
- Failed to slice video:\nSource duration: {video.get_duration
- ar_video sampler requires 5-D video latents [B,C,T,H,W], got
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/e94b881ee15ee319.
Report an issue: GitHub.