Skip to content

obs-ffmpeg: VAAPI encoder probe takes 2.7 s of startup on NVIDIA machines #1168

Closed

Description

@zackees

Problem

On a machine with two NVIDIA GPUs (RTX 3060 + RTX 2080 Ti, driver 595.99, KDE Wayland), obs_init_module(obs-ffmpeg.so) takes 2.6–2.7 s of a ~4.0 s startup (OBS profiler, AppImage from master).

Cause, measured with timing logs around the libva calls:

  • h264_vaapi_supported(), av1_vaapi_supported() and hevc_vaapi_supported() each walk every /dev/dri/renderD* node and open it again with vaInitialize → 3 codecs × 2 nodes = 6 opens.
  • For the nvidia kernel driver libva loads nvidia-vaapi-driver, whose vaInitialize initialises CUDA: 0.45–0.8 s per open. That driver cannot encode at all (README: "Hardware decoding only, encoding is not supported"), so every open ends in "not supported".
  • Each open also leaves CUDA contexts in the process (~27 MiB RSS).

Fix

  1. Probe each render node once, for all three codecs, and keep the answer (the encoders' property pages ask again later).
  2. Open the render nodes in parallel.
  3. Do not open a node whose kernel driver is nvidia unless LIBVA_DRIVER_NAME picks another VA driver.

The decisions go into plugins/obs-ffmpeg/vaapi-probe-policy.c, tested by test/cmocka/test_vaapi_probe_policy.c (RED, then GREEN).

Measured on that machine (median of interleaved runs, launch → main window mapped): 3.98 s → 1.39 s, RSS 320 → 293 MiB.

Activity

  1. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Claiming: branch fix/vaapi-startup-probe.

  2. added
    claimed
    on Oct 17, 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

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions