packaging: build ffmpeg with VAAPI and declare libva runtime deps

The Linux release ffmpeg is built statically from source, and ffmpeg only
autodetects --enable-vaapi when libva headers are present at configure time.
Neither build path installed them, so every release shipped a static ffmpeg
with no h264_vaapi encoder -- the zero-copy export silently fell back to
software 100% of the time.

- Containerfile + build.yml: install libva-dev + libdrm-dev so the from-source
  ffmpeg gets VAAPI.
- build.yml: assert the release binary links libva, so a missing dep can't
  silently regress to a software-only build again.
- deb/rpm: libva (libva2/libva-drm2/libdrm2, libva/libdrm) is a hard runtime
  dep -- the vaapi-enabled ffmpeg DT_NEEDEDs it, so the app won't launch
  without it. The VA driver is a soft recommends (absent it, export falls back
  to software): va-driver-all (deb), intel-media-driver/mesa-va-drivers (rpm).

build.rs needs no change: releases link ffmpeg statically (its bundling path
is skipped) and the AppImage is thin, taking libva from the host like libvulkan.
This commit is contained in:
Skyler Lehmkuhl 2026-06-25 18:28:36 -04:00
parent ecfa192245
commit 911d896610
3 changed files with 34 additions and 1 deletions

View File

@ -71,6 +71,7 @@ jobs:
libx11-dev libxkbcommon-dev libxcb-shape0-dev libxcb-xfixes0-dev \ libx11-dev libxkbcommon-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libxdo-dev libglib2.0-dev libgtk-3-dev libvulkan-dev \ libxdo-dev libglib2.0-dev libgtk-3-dev libvulkan-dev \
yasm libx264-dev libx265-dev libvpx-dev libmp3lame-dev libopus-dev \ yasm libx264-dev libx265-dev libvpx-dev libmp3lame-dev libopus-dev \
libva-dev libdrm-dev \
libpulse-dev squashfs-tools dpkg rpm libpulse-dev squashfs-tools dpkg rpm
- name: Install cargo packaging tools (Linux) - name: Install cargo packaging tools (Linux)
@ -202,6 +203,20 @@ jobs:
mkdir -p lightningbeam-ui/target/release mkdir -p lightningbeam-ui/target/release
cp lightningbeam-ui/target/${{ matrix.target }}/release/lightningbeam-editor lightningbeam-ui/target/release/ cp lightningbeam-ui/target/${{ matrix.target }}/release/lightningbeam-editor lightningbeam-ui/target/release/
# Guard: the zero-copy export needs the static ffmpeg to have h264_vaapi, which only
# happens if libva headers were present at ffmpeg configure time. ffmpeg autodetects it,
# so a missing libva-dev silently ships a software-only build. A vaapi-enabled binary
# links libva — assert that, so the dep can never regress unnoticed.
- name: Verify VAAPI is compiled in (Linux)
if: matrix.platform == 'ubuntu-24.04'
shell: bash
run: |
if ! ldd lightningbeam-ui/target/release/lightningbeam-editor | grep -q 'libva\.so'; then
echo "::error::Release binary does not link libva — ffmpeg was built without VAAPI (is libva-dev installed?)."
exit 1
fi
echo "VAAPI OK: binary links libva."
# ── Stage presets next to binary for packaging ── # ── Stage presets next to binary for packaging ──
- name: Stage presets in target dir - name: Stage presets in target dir
shell: bash shell: bash

View File

@ -79,7 +79,11 @@ extended-description = "GPU-accelerated multimedia editor for audio, video and 2
license-file = ["../../LICENSE", "0"] license-file = ["../../LICENSE", "0"]
section = "video" section = "video"
priority = "optional" priority = "optional"
depends = "libasound2, libwayland-client0, libx11-6, libvulkan1" # libva2/libva-drm2 are hard deps: the vaapi-enabled static ffmpeg links them (DT_NEEDED), so the
# app won't launch without them. The VA *driver* is a soft dep — absent, the export falls back to
# software — so it's a recommends (va-driver-all pulls intel-media + i965 + mesa drivers).
depends = "libasound2, libwayland-client0, libx11-6, libvulkan1, libva2, libva-drm2, libdrm2"
recommends = "va-driver-all"
assets = [ assets = [
["target/release/lightningbeam-editor", "usr/bin/", "755"], ["target/release/lightningbeam-editor", "usr/bin/", "755"],
["assets/com.lightningbeam.editor.desktop", "usr/share/applications/", "644"], ["assets/com.lightningbeam.editor.desktop", "usr/share/applications/", "644"],
@ -101,6 +105,15 @@ alsa-lib = "*"
wayland = "*" wayland = "*"
libX11 = "*" libX11 = "*"
vulkan-loader = "*" vulkan-loader = "*"
# Hard dep: the vaapi-enabled static ffmpeg links libva (libva.so.2 + libva-drm.so.2 + libdrm).
libva = "*"
libdrm = "*"
# Soft deps: the VA driver is only needed to actually use hardware encode; absent it, the editor
# falls back to software. (Requires a cargo-generate-rpm new enough to support weak-dep tables.)
[package.metadata.generate-rpm.recommends]
intel-media-driver = "*"
mesa-va-drivers = "*"
[[package.metadata.generate-rpm.assets]] [[package.metadata.generate-rpm.assets]]
source = "target/release/lightningbeam-editor" source = "target/release/lightningbeam-editor"

View File

@ -39,6 +39,11 @@ RUN apt-get update && apt-get install -y \
libvpx-dev \ libvpx-dev \
libmp3lame-dev \ libmp3lame-dev \
libopus-dev \ libopus-dev \
# VAAPI hardware H.264 encode (zero-copy export). FFmpeg autodetects --enable-vaapi
# only when these headers are present at configure time; without them the static
# ffmpeg has no h264_vaapi encoder and the editor silently uses the software path.
libva-dev \
libdrm-dev \
# PulseAudio (cpal optional backend) # PulseAudio (cpal optional backend)
libpulse-dev \ libpulse-dev \
# Packaging tools # Packaging tools