sgl-project/sglang · error · RuntimeError

generated MiniMax H3 MP4 must contain exactly one video stre

Error message

generated MiniMax H3 MP4 must contain exactly one video stream and one audio stream, got {len(video_streams)} video, {len(audio_streams)} audio, and {len(streams)} total streams

What it means

MiniMax H3's delivery contract requires each generated MP4 to contain exactly two streams: one video and one audio. If total streams != 2, video streams != 1, or audio streams != 1, the file is considered malformed (e.g. missing audio track or extra data streams) and validation fails.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py:419

            "ffprobe returned invalid JSON for MiniMax H3 output"
        ) from exc
    if not isinstance(payload, dict):
        raise RuntimeError("ffprobe returned invalid JSON for MiniMax H3 output")
    streams = payload.get("streams") or []
    if not isinstance(streams, list):
        raise RuntimeError("ffprobe returned invalid stream metadata")
    video_streams = [
        stream
        for stream in streams
        if isinstance(stream, dict) and stream.get("codec_type") == "video"
    ]
    audio_streams = [
        stream
        for stream in streams
        if isinstance(stream, dict) and stream.get("codec_type") == "audio"
    ]
    if len(streams) != 2 or len(video_streams) != 1 or len(audio_streams) != 1:
        raise RuntimeError(
            "generated MiniMax H3 MP4 must contain exactly one video stream and "
            f"one audio stream, got {len(video_streams)} video, "
            f"{len(audio_streams)} audio, and {len(streams)} total streams"
        )
    video_stream = video_streams[0]
    audio_stream = audio_streams[0]
    width = int(video_stream.get("width") or 0)
    height = int(video_stream.get("height") or 0)
    if width <= 0 or height <= 0:
        raise RuntimeError(
            f"generated MiniMax H3 MP4 has invalid size {width}x{height}"
        )
    if expected_size is not None and (width, height) != expected_size:
        raise RuntimeError(
            "generated MiniMax H3 MP4 size does not match the resolved request: "
            f"expected {expected_size[0]}x{expected_size[1]}, got {width}x{height}"
        )
    rate_raw = str(video_stream.get("avg_frame_rate") or "")

View on GitHub (pinned to 0132848349)

Solutions

  1. Check server logs for audio synthesis/muxing errors during generation
  2. Verify with `ffprobe -show_streams <file>` which stream is missing
  3. Retry the request; intermittent muxer failures occur under load
  4. Report as a bug if audio is consistently absent
Defensive patterns

Strategy: validation

Validate before calling

streams = json.loads(ffprobe_stdout)["streams"]
v = [s for s in streams if s.get("codec_type")=="video"]
a = [s for s in streams if s.get("codec_type")=="audio"]
assert len(streams)==2 and len(v)==1 and len(a)==1

Type guard

def is_valid_minimax_mp4(payload) -> bool:
    s = payload.get("streams") or []
    return (len(s)==2 and sum(1 for x in s if x.get("codec_type")=="video")==1
            and sum(1 for x in s if x.get("codec_type")=="audio")==1)

Prevention

When it happens

Trigger: Generated MP4 muxed without an audio track (audio generation/muxing step failed silently), or with extra streams (subtitle/data), or video-only because audio synthesis was skipped.

Common situations: Audio codec/muxer misconfiguration in the decoding/muxing stage; upstream changes dropping the audio track; requests whose pipeline variant omits audio.

Related errors


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