Skip to content

feat(video)!: make the OpenH264 fallback opt-in, enabled for releases - #5771

Open
kixelated wants to merge 11 commits into
mainfrom
openh264-opt-in
Open

kixelated wants to merge 11 commits into
mainfrom
openh264-opt-in

Conversation

@kixelated

@kixelated kixelated commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

We prioritize hardware encoding, so the vendored OpenH264 C++ is now opt-in everywhere except releases.

  • moq-video and moq-transcode drop openh264 from default. No workspace crate enables it unconditionally any more.
  • moq-ffi, moq-c, moq-boy, and moq-cli each forward an openh264 feature.
  • Every release path turns it on:
    • rs/moq-ffi/build.sh, which builds the libraries for every language binding. Under --no-default-features it's a no-op.
    • maturin, through [tool.maturin] features.
    • the C++ CMake source build (the prebuilt MOQ_FFI_DIR input comes from build.sh, so it already has it).
    • moq-c's CMake source build (add_subdirectory(rs/moq-c)), so it stays "the same moq::c target" as the release archive.
    • nix moq-c and moq-boy. moq-boy encodes 160x144, which is below every hardware encoder's minimum.
    • moq-c's Windows build.
  • The host builds behind the Go, Kotlin, Swift, Dart (the build hook and sh/dart/generate.sh), and Python (just py test, whose --features replaces pyproject's list) test suites, just rs android, and sh/swift/simulator.sh now build the same feature set that releases ship.
  • moq-boy refuses to start without openh264, naming the install command, instead of panicking while probing an encoder. Its README, demo/boy, and MIGRATE name the feature.

Tests stay in the merge gate

GPU-less CI has no encoder besides OpenH264. Gating the 38 affected tests would have pulled them out of the gate, which rs/AGENTS.md asks us not to do. Instead:

  • moq-c, moq-ffi, and moq-transcode enable moq-video/openh264 through a dev-dependency. Their test targets get the encoder; library and release builds still choose it explicitly.
  • just rs play passes openh264. moq-cli's moq-video dependency is optional, so a dev-dependency would drag moq-video into every moq-cli test build.
  • decode::consumer::tests::the_track_ending_drains_the_decoder encodes in software but was gated on vaapi alone. It now also requires openh264.

Decisions

Made unattended by the iterate agent; each picked the recommended option.

moq-boy and cargo install (Codex P1).

  • ✅ Keep openh264 opt-in; refuse to start without it and document cargo install moq-boy --features openh264. Defaulting it on in moq-boy would, through feature unification, compile OpenH264 into every default cargo build --workspace, undoing this PR.
  • Add openh264 to moq-boy's default. Fixes bare cargo install, at the cost above.

What a CMake source build of moq-c ships.

  • ✅ Enable openh264, like the C++ CMake build and the release archive.
  • Leave it off, and document the difference.

Breaking

moq-video and moq-transcode no longer enable openh264 by default. A downstream crate that needs the software fallback must name the feature. moq-cli's capture, transcode, and play, a bare cargo build of moq-ffi or moq-c, and cargo install moq-boy need --features openh264 for it too. Each of those packages has a MIGRATE.md entry. Published bindings, wheels, archives, and nix packages are unchanged.

No public API or wire change.

Expected effect on build time

Small. On a cold cargo check, openh264's build script is about 16 s of one core and sits off the critical path; mbx caches the C++ on warm builds. The main win is that hardware-only consumers and plain library builds stop compiling it.

Test plan

  • just check (Nix dev shell) on the merged head, including the Dart suite's software-encode test through the build hook
  • cargo clippy --workspace --all-targets -D warnings (without openh264)
  • just rs lint --workspace (fmt, doc, shear, sort)
  • just rs media-features --all (dependency-shape assertions)
  • just rs test for moq-video, moq-transcode, moq-ffi, moq-c, moq-boy, moq-cli: 723 passed (38 failed before the dev-dependencies)
  • just rs play, just rs capture-test
  • cargo check --workspace --all-targets --no-default-features
  • cargo tree -e normal: each package lacks openh264-sys2 by default and has it with --features openh264
  • Release workflows (FFI, Python wheel, nix moq-c / moq-boy, Windows moq-c) not run locally

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

Hardware codecs come first, so the vendored OpenH264 C++ is no longer a
default of moq-video or moq-transcode, and no workspace crate turns it on
unconditionally. moq-ffi, moq-c, moq-boy, and moq-cli each forward an
`openh264` feature instead, and every release path enables it:
rs/moq-ffi/build.sh (all language bindings), maturin, the C++ CMake build,
nix's moq-c and moq-boy, and moq-c's Windows build. The host builds behind
the Go, Kotlin, and Swift test suites and `just rs android` match.

Tests that encode keep running everywhere: moq-c, moq-ffi, and
moq-transcode turn the feature on through a dev-dependency (GPU-less CI has
no other encoder), and `just rs play` passes it for moq-cli. One moq-video
test that encodes in software was gated on `vaapi` alone; it now also
requires `openh264`.

BREAKING CHANGE: moq-video and moq-transcode no longer enable `openh264` by
default. A consumer that relies on the software fallback (a GPU-less host,
the Apple simulators, API-24 Android) must enable it explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T04:25:19.513254Z e649d23 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9a5e473c-0b26-4903-8f4c-d19cd9b59fe5
📥 Commits

Reviewing files that changed from the base of the PR and between e93d7ac and a0033bd.

📒 Files selected for processing: 42
  • Cargo.toml
  • cpp/moq/CMakeLists.txt
  • dart/moq_ffi/hook/build.dart
  • demo/boy/justfile
  • doc/bin/cli.md
  • doc/bin/obs.md
  • doc/concept/transport.md
  • doc/lib/c/index.md
  • doc/lib/rs/moq-video.md
  • nix/overlay.nix
  • py/justfile
  • py/moq-ffi/pyproject.toml
  • rs/justfile
  • rs/moq-boy/Cargo.toml
  • rs/moq-boy/MIGRATE.md
  • rs/moq-boy/README.md
  • rs/moq-boy/src/main.rs
  • rs/moq-c/Cargo.toml
  • rs/moq-c/MIGRATE.md
  • rs/moq-c/build.sh
  • rs/moq-c/cmake/cargo-build.cmake
  • rs/moq-cli/Cargo.toml
  • rs/moq-cli/MIGRATE.md
  • rs/moq-ffi/Cargo.toml
  • rs/moq-ffi/MIGRATE.md
  • rs/moq-ffi/build.sh
  • rs/moq-transcode/Cargo.toml
  • rs/moq-transcode/MIGRATE.md
  • rs/moq-transcode/README.md
  • rs/moq-transcode/src/lib.rs
  • rs/moq-video/Cargo.toml
  • rs/moq-video/MIGRATE.md
  • rs/moq-video/README.md
  • rs/moq-video/src/decode/consumer.rs
  • rs/moq-video/src/lib.rs
  • sh/dart/generate.sh
  • sh/go/stage.sh
  • sh/kt/generate.sh
  • sh/rs/c-tests.sh
  • sh/swift/check.sh
  • sh/swift/simulator.sh
  • test/portrait/run.sh

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e914bae-82cd-4066-a505-193559ca1460
📥 Commits

Reviewing files that changed from the base of the PR and between 6f95a54 and e93d7ac.

📒 Files selected for processing: 22
  • Cargo.toml
  • cpp/moq/CMakeLists.txt
  • doc/lib/rs/moq-video.md
  • nix/overlay.nix
  • py/moq-ffi/pyproject.toml
  • rs/justfile
  • rs/moq-boy/Cargo.toml
  • rs/moq-c/Cargo.toml
  • rs/moq-c/build.sh
  • rs/moq-cli/Cargo.toml
  • rs/moq-ffi/Cargo.toml
  • rs/moq-ffi/build.sh
  • rs/moq-transcode/Cargo.toml
  • rs/moq-transcode/README.md
  • rs/moq-video/Cargo.toml
  • rs/moq-video/src/decode/consumer.rs
  • sh/go/stage.sh
  • sh/kt/generate.sh
  • sh/rs/c-tests.sh
  • sh/swift/check.sh
  • sh/swift/simulator.sh
  • test/portrait/run.sh

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

Walkthrough

OpenH264 is no longer enabled by default in several Rust crates. Consumer crates expose or forward an opt-in feature, and selected build and packaging targets now enable it explicitly. Documentation describes the feature as opt-in. Test commands and a Linux decoder-tail test condition are updated to account for the feature.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to e93d7

OpenH264 is opt-in, and the FFI minimal-build option remains effective. No actionable merge-blocking risk is established; the PR is mergeable subject to normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 9 files. (13 skipped: 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the main change: OpenH264 becomes opt-in and remains enabled for release builds.
Description check Passed The description directly explains the feature changes, release paths, test strategy, breaking behavior, and validation results.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 9 files. (13 skipped: 13 unsupported.)

✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7b8255d7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-boy/Cargo.toml
# The software H.264 encoder. moq-boy needs it at runtime (a 160x144 frame is
# below every hardware encoder's minimum), but it is vendored C++, so it stays
# off for development builds; the nix package turns it on.
openh264 = ["moq-video/openh264"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enable OpenH264 for cargo-installed moq-boy

The documented cargo install moq-boy uses these default features and therefore never enables the new openh264 feature. VideoEncoder::spawn unconditionally forces encode::Kind::Software for its 160x144 frames, so without OpenH264 the software candidate list is empty and startup panics while probing the encoder on every platform. Ensure the normal Cargo installation enables this required feature, rather than only enabling it in the Nix package.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Kept openh264 opt-in rather than defaulting it on in moq-boy: a moq-boy default would, through feature unification, compile OpenH264 into every default cargo build --workspace and undo this PR. Instead moq-boy now refuses to start without it, naming cargo install moq-boy --features openh264, and the README, demo/boy, and MIGRATE.md say so. Fixed in eb1ef4e.

(Written by Claude Opus 5.5)

Comment thread rs/moq-video/Cargo.toml
# explicitly. Workspace consumers opt out at the root manifest
# (`default-features = false`) and pick per crate, so the relay and the language
# bindings never build device or rendering stacks.
default = ["mediacodec", "nvidia"]

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 Badge Update the crate docs after removing the default fallback

Downstream users are still told in rs/moq-video/README.md that OpenH264 is a default feature (both the backend tables and the default-feature paragraph), and the crate-level rustdoc in src/lib.rs makes the same claim. With this new default list, following that documentation on a GPU-less host produces a build with no H.264 encoder, so these user-facing references need to describe openh264 as opt-in.

AGENTS.md reference: AGENTS.md:L29-L29

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed: the README backend tables, default-feature paragraph, and cargo add examples, plus the src/lib.rs rustdoc, now call openh264 opt-in. MIGRATE.md has an entry.

(Written by Claude Opus 5.5)

kixelated and others added 2 commits October 16, 2026 16:48
Both encode H.264 in software on GPU-less runners, which now needs the
opt-in openh264 feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e93d7ac867

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-cli/Cargo.toml
Comment on lines +127 to +128
moq-transcode = { workspace = true, optional = true }
moq-video = { workspace = true, optional = true }

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 Badge Add OpenH264 to documented CLI builds

When users follow doc/bin/obs.md:43 (cargo install --locked moq-cli --features transcode) on GPU-less Linux, these optional dependencies no longer enable OpenH264, leaving only the default NVENC backend and causing encoder probing to fail at runtime. doc/bin/cli.md:186-222 also still promises an H.264 software fallback and support for software-only hosts, so update the CLI build examples and related claims to include openh264 wherever that fallback is expected.

AGENTS.md reference: AGENTS.md:L120-L120

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed: doc/bin/obs.md installs with --features transcode,openh264, and doc/bin/cli.md names openh264 for the software fallback under Play, Capture, and Transcode. moq-cli's MIGRATE.md has an entry.

(Written by Claude Opus 5.5)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69510a3a71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# moq-video's: release builds enable it. `vaapi` stays opt-in because its
# bindgen needs libclang; `v4l2` mirrors moq-video's opt-in too, though it costs
# the build nothing.
default = ["nvidia"]

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 Badge Update the transcoder rustdoc for opt-in OpenH264

With this default reduced to nvidia, the published crate-level documentation in rs/moq-transcode/src/lib.rs:20-22 still tells direct users that the default openh264 feature supplies the software fallback. A user relying on that rustdoc on a GPU-less host now builds a transcoder with no usable encoder, so update the rustdoc alongside the README to state that openh264 must be enabled explicitly.

AGENTS.md reference: AGENTS.md:L29-L29

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed: the crate rustdoc now calls openh264 opt-in and says a GPU-less host needs it. MIGRATE.md has an entry.

(Written by Claude Opus 5.5)

kixelated and others added 6 commits October 17, 2026 20:44
# Conflicts:
#	cpp/moq/CMakeLists.txt
#	rs/moq-c/Cargo.toml
#	rs/moq-ffi/Cargo.toml
…t opt-in

moq-boy refuses to start without OpenH264 and its README, demo, and
MIGRATE name the feature. The Dart hook and moq-c CMake source builds
enable it like the other binding builds. The moq-video and moq-transcode
docs, the CLI and OBS build instructions, and each affected MIGRATE.md
describe it as opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e649d23198

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-cli/Cargo.toml
moq-transcode = { workspace = true, optional = true, features = ["openh264"] }
moq-video = { workspace = true, optional = true, features = ["openh264"] }
moq-transcode = { workspace = true, optional = true }
moq-video = { workspace = true, optional = true }

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 Badge Add OpenH264 to the remaining CLI playback recipe

On a GPU-less Linux host, following doc/concept/transport.md:86 still builds moq-cli with only iroh,play. These changed dependency lines no longer activate OpenH264, while NVIDIA is the only default Linux decoder, so the documented moq ... play command cannot open an H.264 stream. A repo-wide invocation search found this remaining recipe after the other CLI docs were updated; include openh264 in its feature list. Local cargo build --help confirms that --features accepts a comma-separated list.

AGENTS.md reference: AGENTS.md:L122-L122

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed: doc/concept/transport.md now builds with iroh,play,openh264.

(Written by Claude Opus 5.5)

# moq-video's: release builds enable it. `vaapi` stays opt-in because its
# bindgen needs libclang; `v4l2` mirrors moq-video's opt-in too, though it costs
# the build nothing.
default = ["nvidia"]

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 Badge Enable OpenH264 in the transcoder example command

On a GPU-less host, the runnable example in rs/moq-transcode/README.md:81-82 now builds with the default nvidia feature only, so an H.264 source fails when the example tries to open its decoder or encoder. The updated prose immediately above correctly says such hosts require --features openh264, but both this command and the copy in examples/transcode.rs:6-7 omit it; update those examples to keep the documented workflow runnable.

AGENTS.md reference: AGENTS.md:L29-L29

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Declining: examples build with dev-dependencies, and moq-transcode's dev-dependency enables moq-video/openh264. cargo tree -p moq-transcode -e normal,dev -i openh264-sys2 reaches it, so cargo run -p moq-transcode --example transcode already has the software fallback on a GPU-less host.

(Written by Claude Opus 5.5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant