Skip to content

Trim some codecs from FFmpeg build#162

Open
JanuszL wants to merge 1 commit into
NVIDIA:mainfrom
JanuszL:trim_ffmpeg
Open

Trim some codecs from FFmpeg build#162
JanuszL wants to merge 1 commit into
NVIDIA:mainfrom
JanuszL:trim_ffmpeg

Conversation

@JanuszL
Copy link
Copy Markdown
Contributor

@JanuszL JanuszL commented May 18, 2026

No description provided.

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR extends the existing selective FFmpeg codec trimming by disabling five additional software decoders — hevc, h264, aac, aac_fixed, and aac_latm — from the bundled FFmpeg build. The intent is to reduce binary size and unused code surface, consistent with DALI's GPU-centric (NVDEC) decode pipeline that never calls these software decoders.

  • hevc and h264 software decoders are disabled while hevc_mp4toannexb and h264_mp4toannexb BSFs remain enabled; this is the correct setup for an NVDEC path, but could affect stream probing (avformat_find_stream_info) or break CPU-only environments entirely.
  • aac, aac_fixed, and aac_latm audio decoders are removed; safe assuming DALI does not need audio decode (aligns with typical DALI usage for video frames only).

Confidence Score: 4/5

The change is straightforward and follows the established pattern in this build script; the main risk is that disabling software H.264/HEVC decoders could break CPU-only environments or FFmpeg stream probing, but those are unlikely scenarios for a GPU-first library like DALI.

The five new --disable-decoder flags are consistent with the existing selective-disable approach. The AAC removals look clean. The H.264/HEVC removals are paired correctly with the BSFs needed for NVDEC, but removing the software decoders eliminates any CPU fallback path and could interfere with avformat_find_stream_info stream probing on H.264/HEVC content.

build_scripts/build_ffmpeg.sh — specifically the interaction between the newly disabled h264/hevc decoders and the still-enabled h264_mp4toannexb/hevc_mp4toannexb BSFs warrants a second look if DALI has any CPU-only test paths.

Important Files Changed

Filename Overview
build_scripts/build_ffmpeg.sh Adds five --disable-decoder flags (hevc, h264, aac, aac_fixed, aac_latm) to the FFmpeg configure step; consistent with existing selective-disable pattern but removes software fallback for the two video codecs whose BSFs are still actively enabled.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Video File / Container] --> B[avformat demuxer\nenabled]
    B --> C{Codec type}
    C -->|H.264| D[h264_mp4toannexb BSF\nenabled]
    C -->|HEVC| E[hevc_mp4toannexb BSF\nenabled]
    C -->|AAC Audio| F[AAC SW Decoder\ndisabled: aac / aac_fixed / aac_latm]
    D --> G[NVDEC Hardware Decoder\ngpu path]
    E --> G
    C -->|H.264 SW decode| H[H.264 SW Decoder\ndisabled: h264]
    C -->|HEVC SW decode| I[HEVC SW Decoder\ndisabled: hevc]
    style F fill:#f99,stroke:#c00
    style H fill:#f99,stroke:#c00
    style I fill:#f99,stroke:#c00
    style G fill:#9f9,stroke:#090
Loading

Fix All in Claude Code

Reviews (1): Last reviewed commit: "Trim some codecs from FFmpeg build" | Re-trigger Greptile

Comment on lines +51 to +52
--disable-decoder=hevc \
--disable-decoder=h264 \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Software H.264/HEVC decoders disabled while BSFs remain enabled

The h264_mp4toannexb and hevc_mp4toannexb BSFs are kept (line 56), which suggests the pipeline routes these bitstreams to a hardware decoder (NVDEC). Disabling the software decoders is therefore intentional for the GPU path. However, if FFmpeg calls avformat_find_stream_info() internally — which DALI's demuxer likely does — FFmpeg may attempt to probe the stream by decoding a few packets using the software decoder. With both hevc and h264 decoders disabled, probing such streams could yield incomplete or inaccurate stream metadata (e.g., missing width/height, frame rate, or pixel format). This is also a hard break for any CPU-only test or CI environment that exercises the video decode path without NVDEC available.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The DALI side rework will be done in a separate PR to the DLAI repo itself. This is fully intentional.

@JanuszL
Copy link
Copy Markdown
Contributor Author

JanuszL commented May 18, 2026

Related to NVIDIA/DALI#6352.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants