← Back to Pull requests

fix(multimodal): hold every external decode to one demuxer list #10133

Open
unknown opened this pull request with 575 lines diff across 7 files
View on GitHub
unknown unknown commented on Dec 04, 2026 09:59 UTC
Author

Description

Changed reading: every ffmpeg and ffprobe run on a client's video or audio file now opens it through the file protocol alone and with one of sixteen demuxers: mov (MP4, M4A, 3GP, QuickTime), matroska (MKV, WebM), avi, ogg, mpeg (program stream), mpegts, wav, flac, mp3, aiff, caf, aac (ADTS), flv, asf (WMV, WMA), amr and gif. A part in a container outside this list is refused where main may decode it, and so is a raw stream with no container (h264, hevc, mjpeg, m4v); the list can be widened. Such a part gets the status and error code main gives a failed external decode.

Changed reading where the opencv-video feature is built (OpenCV decodes video by default): OpenCV takes a client video only where its leading bytes read as MP4 or QuickTime (ftyp), Matroska or WebM, AVI, Ogg or an MPEG program stream, also under SMG_VIDEO_DECODE_BACKEND=opencv; every other video takes the ffmpeg path above, where main hands it to OpenCV: one outside the list is refused, a listed one (MPEG-TS, FLV, ASF, GIF, QuickTime with no leading ftyp) is decoded by ffmpeg, and a process with no ffmpeg answers it with the error of a decoder it cannot run.

Problem

The external decoders (ffmpeg, ffprobe, and OpenCV where it is built) opened a client file with whatever demuxer its bytes probed to, under the protocol list the build gives a local file; they were not held to a list.

Solution

  • One demuxer list (CLIENT_FILE_FORMATS) and the input options built on it (CLIENT_FILE_INPUT: -protocol_whitelist file, -format_whitelist with the list) stand ahead of the input of every ffmpeg and ffprobe run on a client file (the seven runs of Numbers).

  • opencv_takes_client_file chooses the video decoder by video_container_suffix (the signatures the temp file suffix already read); it builds without the feature, so its case runs in every test build.
  • Changes

  • crates/multimodal/src/media.rs: the list, the options, the builders ffprobe_command and ffmpeg_input_command and their video callers; video_container_suffix (the table of video_temp_suffix, whose answers stand), opencv_takes_client_file and its call in decode_video_frames.

  • crates/multimodal/src/audio/decode.rs: the audio decode and probe use the builders.

  • crates/multimodal/src/media/tests/client_file_input.rs: the two new cases; the two cases that pin a video decode's arguments take the options.
  • Test Plan

  • cargo test -p llm-multimodal: every case passes. every_run_on_a_client_file_names_its_lists_ahead_of_the_input reads the arguments of each command; opencv_takes_a_client_file_only_in_a_listed_container reads the choice on short byte literals. No decoder runs. On main neither builds (the functions are new).

  • rustfmt (nightly, as the hook runs it), the unit test layout check and cargo clippy -p llm-multimodal --all-targets -- -D warnings pass.

  • The call in the opencv-video code is built and linted by the all-features lint build of CI alone; the ffmpeg refusal was read, not run. The clips the CI decodes with ffmpeg (MP4, AVI, MKV, WebM) are all on the list.

  • Ready check. Architecture: one list, two builders and one choice in the media module; no new dependency, flag or config key. Every engine alike (vLLM, TokenSpeed, TensorRT-LLM, SGLang): media is decoded in the gateway before any engine sees it; no engine code changes. CPU and memory: four arguments a run, one name check a file in ffmpeg, at most twelve leading bytes read a video; nothing is copied or held.
  • Release note

    Media inputs: ffmpeg and ffprobe open a client's video or audio file through the file protocol alone and with one of sixteen containers (MP4 and QuickTime, Matroska and WebM, AVI, Ogg, MPEG-PS, MPEG-TS, WAV, FLAC, MP3, AIFF, CAF, AAC, FLV, ASF, AMR, GIF); others are refused as a failed decode. OpenCV takes a video only in the first five, read by their leading bytes.

    Numbers

    | metric | before | after | setup |
    |---|---|---|---|
    | runs on a client file that name the file protocol and the demuxer list ahead of the input | 0 of 7 | 7 of 7 | read from the source: three video probes, the duration probe, the video decode builder, the audio decode and probe |
    | demuxer names a run lists for a client file | 0 | 16 | CLIENT_FILE_FORMATS |
    | protocol names a run lists for a client file | 0 | 1 | CLIENT_FILE_INPUT (file) |
    | leading-byte signatures that hand a client video to OpenCV where the feature is built | none read (every video) | 5, each a demuxer of the list | opencv_takes_client_file and its case |

    Diff: 575 lines (+431 / -144) across 7 files Reviewer: claude[bot] Review duration: 6m
    All Vouch review confidence checks passed
    Residual risk 0.35 = Change Risk (0.50) × (1 − Review Confidence (0.29)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 575 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 46% · Reviewer familiarity: 35%
    28%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.380
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #10133"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 28.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 28.9% · Lower = rushed or shallow review
    28.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 35.4% · Moderate risk
    35.4%