Skip to content

[Feature]: Software H.264 fallback when GPU encoder MFT is unavailable #18

Description

@EtienneLescot

Summary

Follow-up to #15. When the system has no hardware H.264 Media Foundation Transform (MFT) registered (e.g. broken AMD AMF registration, missing GPU drivers, headless / no-GPU environments), OpenScreen currently fails outright. We should fall back to the Windows software H.264 encoder (mfh264enc.dll) so recording still works — slower, but functional.

Context

See #15 for the root cause analysis. Items 1 and 2 (pre-flight MFT check + better error message) are landing separately. This issue is specifically about the fallback path.

Proposed approach

  1. After pre-flight enumeration (per [Bug]: Failed to initialize Media Foundation encoder - MP4 recording fails on Windows 10 with AMD GPU (hr=0x80070003) #15), if no hardware H.264 encoder MFT is found, attempt to activate the software H.264 MFT explicitly.
  2. The software encoder is registered under the same category (MFT_CATEGORY_VIDEO_ENCODER) with a different CLSID and no MF_TRANSFORM_FLAG_HARDWARE attribute. MFTEnumEx returns both.
  3. Add a config flag (preferSoftwareEncoder: boolean) so users can opt in permanently (e.g. on VMs or broken-driver machines) and so the smoke tests are deterministic.
  4. If hardware is found but MFCreateSinkWriterFromURL still fails (the [Bug]: Failed to initialize Media Foundation encoder - MP4 recording fails on Windows 10 with AMD GPU (hr=0x80070003) #15 path), retry with the software encoder MFT explicitly selected.
  5. If software also fails, surface the final clear error from [Bug]: Failed to initialize Media Foundation encoder - MP4 recording fails on Windows 10 with AMD GPU (hr=0x80070003) #15.

Acceptance criteria

  • On a system with no working GPU encoder, recording to MP4 still succeeds using the software encoder.
  • A new config knob lets users force software encoding.
  • A wgc-helper smoke test (
    pm run test:wgc-helper:win) covers the software path.
  • No regression for systems that have a working hardware encoder.

Out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions