Skip to content

build(container): backport media-codec compliance to release/1.3.0 - #11846

Closed
saturley-hall wants to merge 13 commits into
release/1.3.0from
release/1.3.0-glm-5.2-dev.1
Closed

build(container): backport media-codec compliance to release/1.3.0#11846
saturley-hall wants to merge 13 commits into
release/1.3.0from
release/1.3.0-glm-5.2-dev.1

Conversation

@saturley-hall

@saturley-hall saturley-hall commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • backport the complete media-codec compliance change set from build(container): media-codec cleanup + build gate + NVDEC video decode (OPS-7665) #11836 at head dd29e8f8daa
  • restrict the in-tree FFmpeg 8.1.2 build to the required VP8/VP9/rawvideo surface while retaining the H.264 parser and fd protocol needed by the sanctioned h264_nvenc MP4 encode path
  • remove codec-bearing media packages from vLLM and SGLang, remove opencv-python-headless from TensorRT-LLM, and add the final filesystem/SBOM compliance gate
  • preserve the existing release/1.3.0 NIXL refs and vLLM, SGLang, and TensorRT-LLM image/version pins

The backport cherry-picks #11836's 13 feature commits and intentionally excludes its merge-only synchronization commits. Its 19-file net diff matches #11836 exactly: 738 additions and 61 deletions.

Validation

  • 13 passedcontainer/compliance/tests/test_scan_codecs.py
  • rendered vLLM CUDA 13.0, SGLang CUDA 13.0, and TensorRT-LLM CUDA 13.1 runtime Dockerfiles for both linux/amd64 and linux/arm64
  • ran docker buildx build --check for all three amd64 runtime Dockerfiles; each completed with only the existing manylinux platform warning
  • ruff check and ruff format --check passed for the new Python scanner/tests
  • python3 -m py_compile passed for the new Python scanner/tests
  • git diff --check github/release/1.3.0..HEAD
  • full runtime images not built locally

Source PR: #11836


Open in Devin Review

dmitry-tokarev-nv and others added 13 commits July 17, 2026 17:22
…stage (OPS-7665)

Add a compliance scan that fails the image build if a media-codec
library/binary ships outside our in-tree ffmpeg allowlist. We build an
in-tree ffmpeg to a narrow media set; this keeps the finished image aligned
by catching a distro libav*, a wheel-bundled libavcodec, libx264/265, or a
stray/imageio-bundled ffmpeg pulled in by a base-image or dependency bump.

The gate is a filesystem scan (bundled codec .so files don't appear as SBOM
components) plus an optional SBOM version floor, driven by
container/compliance/policy/codec_policy.yaml. Matches under our in-tree
allow_paths pass; a reasoned per-entry exception (e.g. NVIDIA DALI's bundled
libav*, owned by its own team) is logged but does not fail. It runs in the
licenses stage of compliance.Dockerfile, so a violation fails the build.

Unit-tested against the real bundled-library paths; see OPS-7665 for background.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
… allowlist (OPS-7665)

The in-tree ffmpeg restricted encoders/muxers but still shipped ffmpeg's full
default decoder set (291 video + 212 audio decoders) in the libav*.so copied
into every runtime image. Narrow it to the media formats we actually build and
use.

Switch the wheel_builder configure to an allowlist: blanket
--disable-decoders/--disable-demuxers/--disable-parsers/--disable-protocols
plus exactly the components the two real paths need:
- encode CLI (imageio): rawvideo demux/decode over a pipe -> h264_nvenc/vp9
- Rust media-ffmpeg VideoDecoder: VP8/VP9 in mp4/webm/mkv
Image decode does not use ffmpeg (Rust `image` crate), so no still-image
decoders are enabled. HW NVDEC (h264_cuvid/hevc_cuvid) can be re-added if a
decode feature needs it.

Also bump ffmpeg 8.1 -> 8.1.2 (an upstream maintenance release) to pick up
security fixes and trim the decode surface further.

Test fixtures are re-encoded to VP9-in-mp4; filenames and the Rust/Python tests
that consume them are unchanged. Validated by building ffmpeg 8.1.2 with this
exact allowlist and decoding every fixture to the expected frame counts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
…m images (OPS-7625)

Upstream TRT-LLM made cv2 an optional video extra
(NVIDIA/TensorRT-LLM#16206) and no longer preinstalls it on main; its
imports were already function-local in 1.3.x, so nothing in the image
needs it at import time. Align the trtllm runtime images with that:
uninstall the package (via the system interpreter -- with VIRTUAL_ENV
set, plain pip targets the venv and exits 0 without touching the
system-site install) and mirror the removal in the pre_runtime
whiteout, since the squash COPY cannot represent deletions. Build
fails if cv2 survives either stage, and a dependencies test guards
against a base-image bump reintroducing it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
Remove codec-bearing Python packages inherited from the SGLang base, build the Dynamo runtime without media-ffmpeg, and fail the image build if FFmpeg, H.264, H.265, or AAC libraries remain.

Signed-off-by: Harrison King Saturley-Hall <hsaturleyhal@nvidia.com>
The ARM64 Inkling base installs the distribution as decord2, whose wheel bundles FFmpeg, x264, and x265 shared libraries. Remove that package and its residual files before the final codec guard.

Signed-off-by: Harrison King Saturley-Hall <hsaturleyhal@nvidia.com>
Address review: hoist the `pathlib` import in test_no_opencv.py to module
scope per the repo import-placement rule, and remove the internal ticket
reference from the docstring.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
- Move the optional `packaging.version` import to module scope and narrow the
  fallback to ImportError only, so a malformed version string surfaces (and
  fails the scan) instead of silently degrading to the naive comparator.
- Rename unused unpacked values in the tests (RUF059).
- Drop internal ticket references from the policy/scanner comments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
- Scan /tmp and /run: only the virtual kernel filesystems (proc/sys/dev)
  are pruned now, so a codec left in /tmp still gets flagged.
- Fail when an explicitly-supplied --sbom path is missing, instead of
  silently disabling the version-floor gate.
- Flag denied SBOM components that carry no version (cannot prove they
  meet the fixed floor) rather than letting them pass.
- Add the required pytest markers to the test module and cover the three
  behaviors above.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
- Drop internal ticket references from the wheel_builder + media README comments.
- Make the fixture-regeneration ffmpeg command in the video.rs docstring
  executable by adding the output filename.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
The TRT-LLM diffusion encode path (imageio -> ffmpeg -c:v h264_nvenc -> mp4)
regressed after the decoder allowlist. The h264 *parser* (not the H.264
decoder) is needed for the mp4 muxer to package the h264_nvenc bitstream, so
add it back. A parser carries no codec implementation, so this does not
reintroduce any software H.264 encode/decode surface; h264_nvenc remains the
NVIDIA hardware encoder (the sanctioned path).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
The vllm-openai base ships PyAV, opencv, decord, torchcodec, and PyNvVideoCodec,
each bundling its own full ffmpeg with software H.264/H.265/AAC (PyAV and decord
also ship GPL libx264/libx265). Dynamo's vLLM component imports none of them, so
they are unused decode-side dead weight. Uninstall + remove them, with a guard
that fails the build if cv2/av survive.

The in-tree LGPL ffmpeg and imageio-ffmpeg are kept for the omni HW video-encode
path (h264_nvenc, the sanctioned NVIDIA hardware encoder). This drops software
video *decode* from the vLLM images (mirrors the SGLang codec removal).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
DALI vendors its full ffmpeg stack under nvidia/dali/.libs — libavcodec plus
the libsw*/libpostproc companions. The exception only matched libav*, so DALI's
libswscale tripped the gate and failed the trtllm build. Waive the whole
vendored dir instead, and cover it in the test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
The narrow in-tree ffmpeg protocol allowlist enabled only file,pipe. On
ffmpeg 8.x, `ffmpeg -i -` (reading rawvideo frames from stdin, as the
imageio encode path does) resolves stdin through the `fd:` protocol, not
`pipe:`. With fd disabled, opening the stdin input fails immediately with
"Error opening input: Protocol not found. Did you mean file:fd:?", breaking
the video encode path.

Add fd to the protocol allowlist. It is pure file-descriptor I/O and
carries no codec implementation, so it does not widen the media-format
surface. Reproduced and confirmed against a locally built allowlisted
ffmpeg: file,pipe fails to open stdin; file,pipe,fd opens it cleanly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
@saturley-hall
saturley-hall requested review from a team as code owners July 17, 2026 21:26
@github-actions github-actions Bot added build documentation Improvements or additions to documentation backend::trtllm Relates to the trtllm backend frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` container labels Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@saturley-hall

Copy link
Copy Markdown
Member Author

Superseded by #11852, which targets release/1.3.0-glm-5.2-dev.1 from the separate backport branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend::trtllm Relates to the trtllm backend build container documentation Improvements or additions to documentation frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants