Skip to content

feat(export): pick the video encoder from the host's hardware, with a libx264 fallback#161

Draft
EtienneLescot wants to merge 2 commits into
release/1.8.0from
feat/native-encoder-vendor-selection
Draft

feat(export): pick the video encoder from the host's hardware, with a libx264 fallback#161
EtienneLescot wants to merge 2 commits into
release/1.8.0from
feat/native-encoder-vendor-selection

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Scoping PR — no implementation yet. The branch carries a single empty commit so the PR can exist; drop it when the real work starts.

The problem

poc-d3d/src/pipeline.rs hard-codes the AMD encoder in three places — :250, :637 and :755 — and refuses to continue without it:

let enc_name = CString::new("h264_amf")?;
...
bail!("h264_amf introuvable");

AMF is AMD-only. On an NVIDIA or Intel host, or on any machine without a hardware H.264 encoder, this path cannot open an encoder at all — native export fails outright rather than degrading.

Development happens on an AMD GPU, which is exactly why this has stayed invisible.

What already exists

electron/media/ffmpegCapabilities.ts already probes the ffmpeg binary for its real encoder list, and its tests cover h264_qsv, h264_amf, h264_nvenc, h264_videotoolbox and libx264. The discovery is there — the Rust pipeline simply never consults it.

Scope

  • Resolve the encoder at runtime from an ordered preference list (NVENC / AMF / QSV / VideoToolbox per the host GPU, then libx264 last).
  • Try each candidate in order and keep the first that actually opens, rather than trusting the capability list alone — fix(export): prove the encoder works instead of inferring it from -encoders established that lesson on the Electron side.
  • Log the encoder actually selected, so a support report says which one ran.
  • No user-facing selector. Selection is automatic, derived from the host's hardware.

Out of scope

  • The preferSoftwareEncoder override — separate PR.
  • WARP fallback for D3D device creation — separate PR.

Acceptance

  • Native export succeeds on a host with no AMF encoder available.
  • The chosen encoder is observable in the logs.
  • Unit coverage for the ordering and for the fallback to libx264.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 585dfdcb-810a-4f9c-ae9d-1e25ca9c6786

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/native-encoder-vendor-selection

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.

@EtienneLescot
EtienneLescot force-pushed the feat/native-encoder-vendor-selection branch from 7ea22fd to f01df9e Compare July 26, 2026 15:36
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