Skip to content

System FFmpeg should be preferred over bundled ffmpeg-static on Linux for GPU hardware acceleration #757

Description

@devcxl

Problem Description

On Linux (specifically Arch Linux installed via AUR recordly-bin), Recordly always uses the bundled ffmpeg-static for video encoding/rendering, ignoring the system-installed FFmpeg. This means GPU hardware encoders (VAAPI, NVENC, CUDA) are never utilized even when available on the system.

Impact: Video export is significantly slower than it should be. On my Arch Linux system with an NVIDIA GPU, exports only use software encoding (libx264), taking 3-4x longer than expected. The GPU sits idle while the CPU is pegged at 100%.


Root Cause

In electron/ipc/ffmpeg/binary.ts, getFfmpegBinaryPath() has this priority:

  1. Bundled ffmpeg-static (first priority)
  2. System FFmpeg from $PATH (fallback only)

The bundled ffmpeg-static is compiled without GPU codec support (no --enable-vaapi, --enable-nvenc, --enable-cuda-llvm, etc.). This is expected for a portable static build — but on Linux desktops with GPUs, the system FFmpeg package (e.g., extra/ffmpeg on Arch) is typically compiled with full hardware acceleration support.

Additional Concern

The resolveSystemFfmpegBinaryPath() fallback also has a hardcoded Linux search order that may miss custom installs:

const commonPaths = [
    "/opt/homebrew/bin/ffmpeg",  // macOS path
    "/usr/local/bin/ffmpeg",
    "/usr/bin/ffmpeg",
];

Suggested Fixes

Option A — Platform-aware priority (recommended):
On Linux, if a system FFmpeg is found on $PATH, prefer it over the bundled one. Windows/macOS can keep the current behavior (bundled first), since their system FFmpeg is less commonly GPU-enabled.

Option B — Encoder capability detection:
Before falling back to libx264, query the bundled FFmpeg's available encoders. If it lacks hardware encoders (h264_vaapi, h264_nvenc, hevc_vaapi, hevc_nvenc, etc.) and the system FFmpeg has them, transparently switch to system FFmpeg.

Option C — Configuration setting:
Add a user-facing setting (e.g., environment variable RECORDLY_FFMPEG_PATH or a preference toggle Prefer system FFmpeg) to allow users to force using system FFmpeg.


Environment

  • Distro: Arch Linux (via AUR: recordly-bin)
  • GPU: NVIDIA GeForce (driver 570.133.08)
  • System FFmpeg: ffmpeg 7.1 (from extra/ffmpeg, compiled with --enable-cuda-llvm, --enable-nvenc, --enable-vaapi)
  • Recordly version: latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions