{"record":{"id":"e94b881ee15ee319","repo":"Comfy-Org/ComfyUI","slug":"video-duration-must-be-at-least-min-duration-s-g","errorCode":null,"errorMessage":"Video duration must be at least {min_duration}s, got {duration}s","messagePattern":"Video duration must be at least (.+?)s, got (.+?)s","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/util/validation_utils.py","lineNumber":132,"sourceCode":"        raise ValueError(f\"Video height must be at least {min_height}px, got {height}px\")\n    if max_height is not None and height > max_height:\n        raise ValueError(f\"Video height must be at most {max_height}px, got {height}px\")\n\n\ndef validate_video_duration(\n    video: Input.Video,\n    min_duration: float | None = None,\n    max_duration: float | None = None,\n):\n    try:\n        duration = video.get_duration()\n    except Exception as e:\n        logging.error(\"Error getting duration of video: %s\", e)\n        return\n\n    epsilon = 0.0001\n    if min_duration is not None and min_duration - epsilon > duration:\n        raise ValueError(f\"Video duration must be at least {min_duration}s, got {duration}s\")\n    if max_duration is not None and duration > max_duration + epsilon:\n        raise ValueError(f\"Video duration must be at most {max_duration}s, got {duration}s\")\n\n\ndef validate_video_frame_count(\n    video: Input.Video,\n    min_frame_count: int | None = None,\n    max_frame_count: int | None = None,\n):\n    try:\n        frame_count = video.get_frame_count()\n    except Exception as e:\n        logging.error(\"Error getting frame count of video: %s\", e)\n        return\n\n    if min_frame_count is not None and min_frame_count > frame_count:\n        raise ValueError(f\"Video frame count must be at least {min_frame_count}, got {frame_count}\")\n    if max_frame_count is not None and frame_count > max_frame_count:","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/validation_utils.py#L114-L150","documentation":"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.","triggerScenarios":"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.","commonSituations":"Short loops or GIFs converted to video; trimmed clips that fell under the provider minimum; first/last-frame nodes fed very short segments.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"duration = video.get_duration()\nif duration is not None and duration < MIN_DUR:\n    raise ValueError(f\"clip too short: {duration:.2f}s < {MIN_DUR}s\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm clip length with ffprobe before running video nodes","Loop or extend short clips to meet provider minimums"],"tags":["validation","video","duration"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}