Skip to content

GPU capture: ddagrab backend and hardware encoders (NVENC/QSV/AMF) with auto-detect and x264 fallback #199

Closed

Description

@TMHSDigital

Why it matters

Capture uses gdigrab, or WGC since #113, encoded with libx264 on the CPU (src/utils/targets.ts:26-27: ultrafast/veryfast). At 1440p/4K or 60 fps this costs a lot of CPU, which competes with the app under test and drops frames. A recording that slows the app it is recording makes for poor evidence. Most Windows machines have a hardware encoder (NVENC, Quick Sync or AMF) and support Desktop Duplication.

Who it's for:

  • Anyone recording high-resolution or high-fps content.
  • Game developers making trailers.
  • Long recordings on laptops.

Rationale

  • FFmpeg's ddagrab (Desktop Duplication API) captures on the GPU at 60+ fps with far lower CPU than gdigrab.
  • It pairs with h264_nvenc, h264_qsv and h264_amf without leaving GPU memory (hwdownload only when needed).
  • ffmpeg -encoders and a one-frame trial encode can detect what works at startup.

Suggested approach

  • Add encoder: "auto" | "x264" | "nvenc" | "qsv" | "amf".
    • auto probes once per process and caches the result.
    • It falls back to x264 when a trial encode fails.
  • Add backend: "ddagrab" for monitor and full targets (keep gdigrab as the default until it is proven), with cursor drawing on.
  • Map the quality presets (draft, standard, high) to equivalent CQ/QP settings per encoder.
  • Report the chosen backend and encoder in the start_recording result, and in the doctor output from the setup-friction issue.

Done when

  • A 4K/60 monitor recording on a machine with NVENC uses under 10% CPU, with no dropped frames reported by ffmpeg.
  • auto never fails on machines without a GPU encoder.

Activity

  1. added
    performance
    feature
    effort: medium
    impact: high
    on Oct 25, 2026
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

    effort: mediumfeatureimpact: highperformancepriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions