{"record":{"id":"d98af523bfb5cdd6","repo":"unslothai/unsloth","slug":"minimax-h3-reference-videos-run-h3-ref-video-min-d98af5","errorCode":null,"errorMessage":"MiniMax-H3 reference videos run {H3_REF_VIDEO_MIN_SECONDS:g} to {H3_REF_VIDEO_MAX_SECONDS:g} seconds; this one is {duration:.1f}s.","messagePattern":"MiniMax-H3 reference videos run (.+?) to (.+?) seconds; this one is (.+?)s\\.","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"studio/backend/core/inference/video_minimax_h3.py","lineNumber":422,"sourceCode":"                    f\"{H3_REF_VIDEO_MAX_SECONDS:g}s. Trim it first.\"\n                )\n            target_source = int(next_target * source_fps / H3_FPS)\n            if target_source > source_index:\n                continue\n            image = frame.to_image().convert(\"RGB\")\n            if fitted_size is None:\n                fitted_size = h3_reference_frame_size(*image.size)\n            if image.size != fitted_size:\n                image = image.resize(fitted_size, Image.LANCZOS)\n            while int(next_target * source_fps / H3_FPS) <= source_index:\n                frames.append(image)\n                next_target += 1\n\n    if decoded_count == 0:\n        raise ValueError(\"That reference video decoded to no frames.\")\n    duration = decoded_count / source_fps\n    if duration + 1e-6 < H3_REF_VIDEO_MIN_SECONDS:\n        raise ValueError(\n            f\"MiniMax-H3 reference videos run {H3_REF_VIDEO_MIN_SECONDS:g} to \"\n            f\"{H3_REF_VIDEO_MAX_SECONDS:g} seconds; this one is {duration:.1f}s.\"\n        )\n    frames = frames[: int(round(duration * H3_FPS))]\n\n    waveform, sample_rate = (None, None)\n    with av.open(io.BytesIO(blob)) as container:\n        if container.streams.audio:\n            waveform, sample_rate = _decode_audio_stream(container, np)\n    return frames, waveform, sample_rate\n\n\ndef decode_h3_reference_audio(blob: bytes) -> tuple[Any, int]:\n    \"\"\"Decode one uploaded audio file to a float32 ``(samples, channels)`` waveform + its rate.\"\"\"\n    import io\n\n    import av\n    import numpy as np","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/video_minimax_h3.py#L404-L440","documentation":"After decoding, duration = decoded_count / source_fps is compared against H3_REF_VIDEO_MIN_SECONDS (2.0s) with a 1e-6 tolerance, and a ValueError is raised when the reference video is shorter than the model's minimum. H3's reference window is 2-15s: too-short clips are refused rather than padded, because the model expects at least ~2s of motion to condition on.","triggerScenarios":"Uploading a 0.5s or 1-frame looping clip as a reference; very short GIF-converted-to-mp4 files; clips trimmed so aggressively they fall under 2.0s (error 514's trim advice can overshoot into this one).","commonSituations":"Users over-trimming after hitting the max-duration error; frame-accurate trims landing at 1.9s; single-shot motion snippets.","solutions":["Re-trim to at least 2.0s of footage (the valid window is 2-15s).","Loop or slow the clip to reach 2s if no more source footage exists.","Validate duration client-side before upload: 2.0 <= frames/fps <= 15.0."],"exampleFix":"# before: over-trimmed to 1.2s after the max-duration error\nffmpeg -t 1.2 -i take.mp4 ref.mp4\n\n# after: keep inside the 2-15s window\nffmpeg -ss 10 -t 5 -i take.mp4 ref.mp4","handlingStrategy":"validation","validationCode":"import av, io\n\nH3_REF_VIDEO_MIN_SECONDS = 2.0\n\nwith av.open(io.BytesIO(blob)) as c:\n    s = c.streams.video[0]\n    fps = float(s.average_rate or s.guessed_rate or 25)\n    n = s.frames or 0\n    if n and n / fps < H3_REF_VIDEO_MIN_SECONDS:\n        raise ValueError(\"reference video must be at least 2s; loop or slow the clip\")","typeGuard":null,"tryCatchPattern":"try:\n    frames, wf, sr = decode_h3_reference_video(blob)\nexcept ValueError as e:\n    if \"this one is\" in str(e) and \"seconds\" in str(e):\n        return HTTPException(400, \"reference must run 2-15s\") from e\n    raise","preventionTips":["Aim trims at the middle of the 2-15s window so rounding never undershoots 2.0s.","When fixing the too-long error, trim to >= 2s to avoid flipping into this one.","Validate duration on both bounds before upload."],"tags":["video","minimax-h3","upload","duration","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}