sgl-project/sglang · error · ValueError

MiniMax H3 video material has no usable frame rate

Error message

MiniMax H3 video material has no usable frame rate

What it means

Neither avg_frame_rate nor r_frame_rate of the video stream parsed to a positive FPS (both were 0/0, N/A, or non-positive). Frame rate is required to process video materials.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:443

    if condition_type in {"audio", "video_audio"} and not audio_streams:
        raise ValueError("MiniMax H3 audio material has no audio stream")

    primary_video: dict[str, Any] | None = None
    for stream in video_streams:
        try:
            width = int(stream.get("width") or 0)
            height = int(stream.get("height") or 0)
        except (TypeError, ValueError) as exc:
            raise ValueError(
                "MiniMax H3 video material has invalid dimensions"
            ) from exc
        if width <= 0 or height <= 0:
            raise ValueError("MiniMax H3 video material has no positive dimensions")
        fps = _parse_frame_rate(stream.get("avg_frame_rate")) or _parse_frame_rate(
            stream.get("r_frame_rate")
        )
        if fps <= 0:
            raise ValueError("MiniMax H3 video material has no usable frame rate")
        if primary_video is None:
            primary_video = stream

    for stream in audio_streams:
        try:
            sample_rate = int(stream.get("sample_rate") or 0)
            channels = int(stream.get("channels") or 0)
        except (TypeError, ValueError) as exc:
            raise ValueError("MiniMax H3 audio material has invalid metadata") from exc
        if sample_rate <= 0:
            raise ValueError("MiniMax H3 audio material has no usable sample rate")
        if channels <= 0:
            raise ValueError("MiniMax H3 audio material has no usable channel count")

    durations: list[float] = []
    for value in [
        (payload.get("format") or {}).get("duration"),
        *(stream.get("duration") for stream in streams),

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-encode forcing a frame rate: ffmpeg -i in.mp4 -r 30 -c:v libx264 out.mp4
  2. If the file is really a single image, submit it as an image material instead
  3. Check ffprobe avg_frame_rate and fix at the producing side

Example fix

# before
ffmpeg -i slides.mkv -c copy out.mkv   # r_frame_rate 0/0
# after
ffmpeg -i slides.mkv -r 25 -c:v libx264 out.mp4
Defensive patterns

Strategy: validation

Validate before calling

def fps_ok(s):
    num, _, den = str(s.get("avg_frame_rate") or s.get("r_frame_rate") or "0/0").partition("/")
    try:
        return int(den or 1) != 0 and int(num) / int(den) > 0
    except (ValueError, ZeroDivisionError):
        return False
assert all(fps_ok(s) for s in video_streams)

Prevention

When it happens

Trigger: Streams where ffprobe reports avg_frame_rate '0/0' and r_frame_rate '0/0' — common for single-frame streams, some VFR/concat outputs, and attached pictures.

Common situations: Slideshows/exported stills, concat demuxer outputs, streams from some screen recorders.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/e0172d7162d1303c. Report an issue: GitHub.