sgl-project/sglang · error · RuntimeError
generated MiniMax H3 MP4 frame rate must be {MINIMAX_H3_SUPP
Error message
generated MiniMax H3 MP4 frame rate must be {MINIMAX_H3_SUPPORTED_FPS} fps, got {rate_raw!r} What it means
Raised by the MiniMax H3 video adapter after probing a generated MP4: the container's video stream reports a frame rate that does not equal MINIMAX_H3_SUPPORTED_FPS. The pipeline validates its own generated output as a sanity check; a mismatch means the muxing/encoding path produced an unexpected fps (or the fps could not be parsed and defaulted to 0.0).
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py:447
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 "")
try:
if "/" in rate_raw:
numerator, denominator = rate_raw.split("/", 1)
fps = float(numerator) / float(denominator)
else:
fps = float(rate_raw)
except (TypeError, ValueError, ZeroDivisionError):
fps = 0.0
if abs(fps - float(MINIMAX_H3_SUPPORTED_FPS)) > 1e-6:
raise RuntimeError(
"generated MiniMax H3 MP4 frame rate must be "
f"{MINIMAX_H3_SUPPORTED_FPS} fps, got {rate_raw!r}"
)
try:
audio_sample_rate = int(audio_stream.get("sample_rate") or 0)
except (TypeError, ValueError):
audio_sample_rate = 0
expected_sample_rate = MiniMaxH3PipelineConfig.output_audio_sample_rate
if expected_sample_rate is not None and audio_sample_rate != expected_sample_rate:
raise RuntimeError(
"generated MiniMax H3 MP4 audio sample rate must be "
f"{expected_sample_rate} Hz, "
f"got {audio_sample_rate}"
)
try:
audio_channels = int(audio_stream.get("channels") or 0)
except (TypeError, ValueError):
audio_channels = 0View on GitHub (pinned to 0132848349)
Solutions
- Inspect the generated MP4 with ffprobe to see the actual avg_frame_rate/r_frame_rate and confirm what value the encoder wrote
- Ensure the muxing stage sets the stream frame rate to exactly MINIMAX_H3_SUPPORTED_FPS (matching numerator/denominator, not a decimal approximation)
- If rate parsing failed (TypeError/ValueError/ZeroDivisionError path yields fps=0.0), fix the container metadata so avg_frame_rate is a valid non-zero fraction
- If the fps constant legitimately changed, update MINIMAX_H3_SUPPORTED_FPS and the encoder together
Example fix
// before stream.set(avg_frame_rate=25.0) // float, muxer may round // after from fractions import Fraction fps = MINIMAX_H3_SUPPORTED_FPS stream.set(avg_frame_rate=Fraction(fps).limit_denominator(10**6))
Defensive patterns
Strategy: validation
Validate before calling
import subprocess, json
from fractions import Fraction
probe = subprocess.run(['ffprobe','-v','error','-select_streams','v:0','-show_entries','stream=avg_frame_rate','-of','json', mp4_path], capture_output=True, text=True)
rate = json.loads(probe.stdout)['streams'][0]['avg_frame_rate']
num, den = map(int, rate.split('/'))
assert abs(num/den - MINIMAX_H3_SUPPORTED_FPS) < 1e-6, f'fps mismatch: {rate}' Try / catch
try:
probe_output(mp4)
except RuntimeError as e:
if 'frame rate' in str(e):
logger.warning('regenerating with explicit fps metadata: %s', e)
remux_with_fps(mp4, MINIMAX_H3_SUPPORTED_FPS)
else:
raise Prevention
- Always set stream frame rate with an exact Fraction, never a float
- Run ffprobe on the first output of any new encoder/muxer configuration in CI
- Unit-test _probe_minimax_h3_output_fields against synthetic MP4s with known rates
When it happens
Trigger: Calling the MiniMax H3 video pipeline and probing the output MP4 via _probe_minimax_h3_output_fields / probe_output; triggers when the MP4 stream's avg_frame_rate or r_frame_rate (a 'num/den' Fraction, numeric, or malformed value) does not parse to the supported fps constant within 1e-6.
Common situations: A codec/container library change altering how frame rate is written or reported, a custom muxer writing r_frame_rate as '0/0' (caught and turned into fps=0.0), or the model config's supported fps constant being changed without updating the encoder settings.
Related errors
- hybrid ref2va layout only supports first/last keyframe ancho
- generated MiniMax H3 MP4 must contain exactly one video stre
- generated MiniMax H3 MP4 has invalid size {width}x{height}
- MiniMax-H3 adaln_t_table must have shape [N, D] with N >= 2,
- MiniMax H3 AdaLN cache has invalid timestep plans
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8c9a5e1b95bbfc4a.
Report an issue: GitHub.