{"record":{"id":"c917b97d31daa6d7","repo":"sgl-project/sglang","slug":"generated-minimax-h3-mp4-must-contain-exactly-one","errorCode":null,"errorMessage":"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","messagePattern":"generated MiniMax H3 MP4 must contain exactly one video stream and one audio stream, got (.+?) video, (.+?) audio, and (.+?) total streams","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py","lineNumber":419,"sourceCode":"            \"ffprobe returned invalid JSON for MiniMax H3 output\"\n        ) from exc\n    if not isinstance(payload, dict):\n        raise RuntimeError(\"ffprobe returned invalid JSON for MiniMax H3 output\")\n    streams = payload.get(\"streams\") or []\n    if not isinstance(streams, list):\n        raise RuntimeError(\"ffprobe returned invalid stream metadata\")\n    video_streams = [\n        stream\n        for stream in streams\n        if isinstance(stream, dict) and stream.get(\"codec_type\") == \"video\"\n    ]\n    audio_streams = [\n        stream\n        for stream in streams\n        if isinstance(stream, dict) and stream.get(\"codec_type\") == \"audio\"\n    ]\n    if len(streams) != 2 or len(video_streams) != 1 or len(audio_streams) != 1:\n        raise RuntimeError(\n            \"generated MiniMax H3 MP4 must contain exactly one video stream and \"\n            f\"one audio stream, got {len(video_streams)} video, \"\n            f\"{len(audio_streams)} audio, and {len(streams)} total streams\"\n        )\n    video_stream = video_streams[0]\n    audio_stream = audio_streams[0]\n    width = int(video_stream.get(\"width\") or 0)\n    height = int(video_stream.get(\"height\") or 0)\n    if width <= 0 or height <= 0:\n        raise RuntimeError(\n            f\"generated MiniMax H3 MP4 has invalid size {width}x{height}\"\n        )\n    if expected_size is not None and (width, height) != expected_size:\n        raise RuntimeError(\n            \"generated MiniMax H3 MP4 size does not match the resolved request: \"\n            f\"expected {expected_size[0]}x{expected_size[1]}, got {width}x{height}\"\n        )\n    rate_raw = str(video_stream.get(\"avg_frame_rate\") or \"\")","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py#L401-L437","documentation":"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.","triggerScenarios":"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.","commonSituations":"Audio codec/muxer misconfiguration in the decoding/muxing stage; upstream changes dropping the audio track; requests whose pipeline variant omits audio.","solutions":["Check server logs for audio synthesis/muxing errors during generation","Verify with `ffprobe -show_streams <file>` which stream is missing","Retry the request; intermittent muxer failures occur under load","Report as a bug if audio is consistently absent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"streams = json.loads(ffprobe_stdout)[\"streams\"]\nv = [s for s in streams if s.get(\"codec_type\")==\"video\"]\na = [s for s in streams if s.get(\"codec_type\")==\"audio\"]\nassert len(streams)==2 and len(v)==1 and len(a)==1","typeGuard":"def is_valid_minimax_mp4(payload) -> bool:\n    s = payload.get(\"streams\") or []\n    return (len(s)==2 and sum(1 for x in s if x.get(\"codec_type\")==\"video\")==1\n            and sum(1 for x in s if x.get(\"codec_type\")==\"audio\")==1)","tryCatchPattern":null,"preventionTips":["If your pipeline intentionally strips audio, expect this validation to fail and use a different model adapter","Smoke-test the muxing stage's output layout in CI"],"tags":["minimax-h3","mp4","stream-layout","validation"],"backgroundTag":"media-stream-layout-invalid","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}