Skip to content

Hardware video decoding (VA-API / NVDEC / VideoToolbox / Media Foundation) via filmcraft-platform #804

Open

Description

@vangel76

Gap: #15 in docs/gaps.md / the "Hardware video decode" row of docs/hardware-parity.md: After Effects decodes H.264 / HEVC in hardware; EffectCraft decodes everything in software (FilmCraft's pure-Rust decoders), on every platform.

What FilmCraft already provides. FilmCraft's crates/platform (filmcraft-platform, layer L5, the one FilmCraft crate allowed unsafe, for OS FFI only; FilmCraft docs/adr/0001-platform-ffi.md) registers a hardware decoder factory in front of FilmCraft's own decoders via filmcraft_codecs::register_video_decoder:

  • macOS: VideoToolbox (H.264 / HEVC, 8/10-bit, 4:2:0 / 4:2:2)
  • Windows: Media Foundation / DXVA
  • Linux: NVDEC (NVIDIA driver) and VA-API (libva loaded at run time with libloading, so no build-time headers)

Streams the hardware does not take, and every stream while filmcraft_codecs::hw::set_hardware_decoding(false), keep the software decoders; a hardware decoder that fails mid-stream switches to software transparently (HybridDecoder). FilmCraft exposes this as Settings ▸ Playback ▸ Hardware decoding.

Plan

  1. Bump the FilmCraft pin (root Cargo.toml, currently 2c5ba7a, 2026-10-03, before filmcraft-platform existed) to one current FilmCraft main commit and fix the API breaks with minimal changes; full workspace test run, differences recorded.
  2. Add filmcraft-platform as an optional, desktop-only dependency of the app binary (apps/effectcraft) only. EffectCraft's own code stays free of unsafe (forbid unchanged); all FFI lives in FilmCraft's crate. L0–L4 and the wasm build are untouched.
  3. Register it at startup; Preferences ▸ Media "Hardware decoding" toggle (command id, automation id, i18n) mirroring FilmCraft's, calling set_hardware_decoding; the active backend shown in the GPU / system information report. Software fallback stays automatic.
  4. Measure headlessly (H.264 / HEVC, 1080p and 4K, long GOP): ms/frame, scrub latency, CPU, software vs NVDEC vs VA-API, PSNR against software decode; decide whether final renders should force software decoding for determinism.

The pin bump and the new dependency with OS FFI (cf. the note on #498 about native SDK FFI) are the maintainers' call, so the PR stays a draft until you agree.

I'm working on this and will open a (draft) PR.

Activity

  1. vangel76 commented on Oct 15, 2026

    @vangel76
    ContributorAuthor

    Part of #804: the FilmCraft pin bump is split out as its own PR so it can be reviewed apart from the hardware path (#819).

  2. vangel76 commented on Nov 5, 2026

    @vangel76
    ContributorAuthor

    Status: hardware video decoding is on hold. The maintainers don't want OS/driver FFI in the shipped binary for now, so #819 (filmcraft-platform) is closed. The measurements and the working branch stay available: branch feat-hw-decode on vangel76/effectcraft, numbers in #819 (5-31x less CPU per frame, bit-exact with software, 1.6-4x faster random jumps on long-GOP files). To be picked up when the FFI question is revisited.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions