apple / swift (pull_request) Successful in 1m53s
apple / screenshots (pull_request) Skipped
windows / build (aarch64-pc-windows-msvc) (pull_request) Successful in 2m34s
ci / web (pull_request) Successful in 2m32s
ci / docs-site (pull_request) Successful in 1m25s
ci / bun-nix (pull_request) Successful in 26s
windows / build (x86_64-pc-windows-msvc) (pull_request) Successful in 3m23s
android / android (pull_request) Successful in 6m47s
ci / rust-arm64 (pull_request) Successful in 8m49s
nix / flake (pull_request) Failing after 16m7s
ci / rust (pull_request) Successful in 23m39s
ffmpeg-next 8.1.0 could not accept FFmpeg 9 at all: ffmpeg-sys-next's version probe
covered avcodec majors 56..62 (the range is exclusive of its end), so libavcodec 63 fell
outside what it knew how to bind. 9.0.0 widens that to 56..63, which is what actually
unblocks Arch. Bump both pins — the unconditional Linux dep and the optional Windows
amf-qsv one — and the lock with them.
No API drift to fix. The crate major is a CEILING, not a target: one source tree still
spans FFmpeg 7.x/libavcodec 61, 8.x/62 and 9.x/63 via per-version cfgs, and every wrapper
symbol the NVENC-libav, VAAPI and amf-qsv backends name survives 8.1.0 -> 9.0.0
unchanged. The three hand-written #[repr(C)] hwcontext mirrors are the parts no compiler
checks, so they were re-read against the real headers rather than trusted:
AVCUDADeviceContext and AVD3D11VAFramesContext are byte-identical across 7.1/8/9, and
AVD3D11VADeviceContext gained two trailing UINTs in 8 that 7.1 lacks — which is why that
mirror deliberately stops at the common prefix, and why its assertions now say what they
do and do not buy you. They pin our layout, not libav's; a green build is not evidence.
The CI image is the step that makes this reach users. arch.yml deliberately runs no -Syu
("the image's snapshot IS the build environment"), so the builder stayed frozen on ffmpeg
8 no matter what Arch shipped, and a canary built from that snapshot could not satisfy the
soname dep the PKGBUILD now derives. Re-keying ci/ rebuilds it against ffmpeg 9.
Ubuntu and Windows deliberately stay put: the noble .deb bundles its own FFmpeg 8 behind
an rpath and strips the libav sonames from its Depends, and Windows bundles BtbN DLLs into
the signed installer — neither is exposed to the break, BtbN publishes no FFmpeg 9 build,
and moving either would re-qualify an encode stack to buy nothing.
Verified end to end on 192.168.1.21 (CachyOS, system ffmpeg 2:9.0-5, RTX 5070 Ti): host
builds clean and links libavcodec.so.63/libavutil.so.61/libavfilter.so.12/libswscale.so.10
with no unresolved sonames; the ffmpeg-8 compat shim is gone and the service runs with
NRestarts=0 and answers 401 on :47990; pf-encode's 67 tests pass; and a live synthetic
encode drives real NVENC hardware through FFmpeg 9's libavcodec to a decodable 1080p HEVC
stream (180/180 frames, FEC loopback 0 mismatches) with libavcodec.so.63 and
libnvidia-encode both mapped into the encoding process.
102 lines
5.2 KiB
TOML
102 lines
5.2 KiB
TOML
# Hardware/software video encode (plan §7 / §W6): the per-vendor backends (NVENC, VAAPI, AMF, QSV,
|
|
# Vulkan-Video, PyroWave, openh264) behind one `Encoder` trait + `open_video` selector, extracted
|
|
# from the host so it depends on the shared frame vocabulary (pf-frame) rather than living inside
|
|
# the orchestrator. Speaks pf-frame (CapturedFrame/PixelFormat/dxgi identity) and pf-zerocopy
|
|
# (CUDA), never pf-capture — the capture→encode edge is one-way (plan §2.4).
|
|
[package]
|
|
name = "pf-encode"
|
|
version.workspace = true
|
|
edition = "2021"
|
|
rust-version.workspace = true
|
|
license = "MIT OR Apache-2.0"
|
|
description = "punktfunk host video encode: NVENC/VAAPI/AMF/QSV/Vulkan-Video/PyroWave/openh264 backends behind one Encoder trait."
|
|
publish = false
|
|
|
|
[dependencies]
|
|
punktfunk-core = { path = "../punktfunk-core", features = ["quic"] }
|
|
pf-frame = { path = "../pf-frame" }
|
|
pf-gpu = { path = "../pf-gpu" }
|
|
pf-host-config = { path = "../pf-host-config" }
|
|
pf-zerocopy = { path = "../pf-zerocopy" }
|
|
anyhow = "1"
|
|
tracing = "0.1"
|
|
|
|
[dev-dependencies]
|
|
# A test writer for the NVENC backend's unit tests (`with_test_writer().try_init()`).
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|
|
|
[target.'cfg(target_os = "windows")'.dev-dependencies]
|
|
# The QSV live e2e drives the REAL HdrP010Converter output (an RTV-written, ring-profile P010
|
|
# texture) into the encoder — the one seam the CPU-upload tests can't reach.
|
|
pf-capture = { path = "../pf-capture" }
|
|
|
|
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
|
|
# Software H.264 (openh264, BSD-2) — the GPU-less encode path on both platforms.
|
|
openh264 = "0.9"
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
# libavcodec (NVENC libav + VAAPI backends). `ffmpeg-sys-next` auto-detects the FFmpeg version, so
|
|
# this pin tracks the crate's own major (which shadows FFmpeg's): 9 = FFmpeg 9 (libavcodec 63,
|
|
# libavutil 61). Arch shipped FFmpeg 9 on 2026-08-08 and every soname moved with it; the packaged
|
|
# host must be BUILT against the FFmpeg it will run on, and packaging/arch/PKGBUILD now derives a
|
|
# soname dep from that link so pacman can no longer walk an install across the break.
|
|
ffmpeg-next = "9"
|
|
libc = "0.2"
|
|
# Vulkan bindings for the raw Vulkan-Video encode + PyroWave compute backends (feature-gated below;
|
|
# the dep stays unconditional to mirror the host's Linux target — unused-but-declared is harmless).
|
|
ash = "0.38"
|
|
# `libnvidia-encode.so.1` is dlopen'd at runtime for the direct-SDK NVENC/CUDA backend.
|
|
libloading = "0.8"
|
|
# Direct-SDK NVENC (raw `sys::nvEncodeAPI` types; entry points resolved at runtime). `ci-check` =
|
|
# vendored bindings, no CUDA toolkit at build.
|
|
nvidia-video-codec-sdk = { version = "0.4", features = ["ci-check"], optional = true }
|
|
# PyroWave (opt-in wired-LAN wavelet codec) — vendored codec + bindgen'd C API, only under `pyrowave`.
|
|
pyrowave-sys = { path = "../pyrowave-sys", optional = true }
|
|
|
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
# NVENC (direct SDK, D3D11 input) + the shared D3D11/DXGI vocabulary via pf-frame.
|
|
nvidia-video-codec-sdk = { version = "0.4", features = ["ci-check"], optional = true }
|
|
# AMD (AMF) + Intel (QSV) hardware encode via libavcodec (behind `amf-qsv`; link-imports FFmpeg).
|
|
ffmpeg-next = { version = "9", optional = true }
|
|
# `libnvidia-encode`/`nvEncodeAPI64.dll` resolved at runtime; the NVENC status→cause table dlopen.
|
|
libloading = "0.8"
|
|
# Native Intel QSV (VPL): vendored static MIT dispatcher + bindgen'd C API, only under `qsv`.
|
|
libvpl-sys = { path = "../libvpl-sys", optional = true }
|
|
# PyroWave (opt-in wired-LAN wavelet codec) — vendored codec + bindgen'd C API, only under
|
|
# `pyrowave`. The Windows backend is the NV12 zero-copy D3D11→Vulkan encoder; same crate as Linux.
|
|
pyrowave-sys = { path = "../pyrowave-sys", optional = true }
|
|
windows = { version = "0.62", features = [
|
|
"Win32_Foundation",
|
|
"Win32_Graphics_Direct3D",
|
|
"Win32_Graphics_Direct3D11",
|
|
"Win32_Graphics_Dxgi",
|
|
"Win32_Graphics_Dxgi_Common",
|
|
# SECURITY_ATTRIBUTES — the PyroWave backend's IDXGIResource1::CreateSharedHandle signature.
|
|
"Win32_Security",
|
|
"Win32_Storage_FileSystem",
|
|
"Win32_System_LibraryLoader",
|
|
"Win32_System_Threading",
|
|
# D3DKMTSetProcessSchedulingPriorityClass — raise the host's WDDM GPU scheduling priority
|
|
# above a running game so PyroWave's compute-shader encode isn't starved (enc/windows/pyrowave.rs).
|
|
"Wdk_Graphics_Direct3D",
|
|
] }
|
|
|
|
[features]
|
|
default = []
|
|
# NVENC hardware encode (Linux CUDA + Windows D3D11); entry points resolved at runtime.
|
|
nvenc = ["dep:nvidia-video-codec-sdk"]
|
|
# AMD (AMF) + Intel (QSV) hardware encode on Windows via libavcodec.
|
|
amf-qsv = ["dep:ffmpeg-next"]
|
|
# Raw Vulkan-Video HEVC/AV1 encode on Linux (reuses the `ash` bindings; no new dep).
|
|
vulkan-encode = []
|
|
# PyroWave — the opt-in wired-LAN intra-only wavelet codec (Linux encode backend).
|
|
pyrowave = ["dep:pyrowave-sys"]
|
|
# Native Intel QSV via the statically linked VPL dispatcher (Windows; runtime GPU
|
|
# libs come from the Intel driver store). Supersedes the ffmpeg `amf-qsv` QSV path
|
|
# (design/native-qsv-encoder.md). ⚠ Like `nvenc`: hand builds need this feature or
|
|
# Intel boxes fall through to the ffmpeg path / software.
|
|
qsv = ["dep:libvpl-sys"]
|
|
|
|
[lints]
|
|
workspace = true
|