feat(ffmpeg): dynamic build discovery + capabilities, wire ffmpeg_gpu, drop 4.0 hardcoding

Discover the bundled FFmpeg builds from bin/ffmpeg_bin/<version>/ instead of a
hardcoded version list, and expose what each build can do.

- FfmpegBinaries (new): scans real version folders (skips *.backup.*), probes each
  binary's hardware encoders (nvenc/qsv/vaapi/…), flags GPU capability, caches the
  result to tmp/ffmpeg_capabilities.json keyed by a folder-mtime fingerprint. UI-only.
- FfmpegPaths::resolve() rewritten: builds paths dynamically from the version string
  (is_file check, no shell — stays on the bootstrap hot path) and takes a separate GPU
  version; the switch and the per-version constants are gone. Unknown CPU version falls
  back to the legacy 4.0 build; an empty/invalid GPU version falls back to the CPU build.
- Wire the previously-dead ffmpeg_gpu column: LegacyInitializer passes it to resolve();
  settings.php lists versions from the scanner and adds an ffmpeg_gpu <select> limited to
  GPU-capable builds ("Same as CPU" = empty). No migration — the column already exists.
- Info tab: a per-build FFmpeg table (version, build banner, GPU badge, hw encoders).
- De-hardcode: drop the unused FFMPEG_BIN_71/80 + FFPROBE_BIN_71/80 constants; keep only
  the 4.0 anchor (DTS override in StreamProcess + FfmpegPaths fallback). Llod/Loopback/
  Record now use FfmpegPaths::cpu()/probe() (config-selected version) with the 4.0
  constant as fallback, matching Scanner/Created/Thumbnail.
This commit is contained in:
Divarion_D
2026-08-30 14:05:34 +03:00
parent 47200c1322
commit 0e2d64cdfd
8 changed files with 307 additions and 39 deletions
+7 -8
View File
@@ -24,12 +24,11 @@ define('GEOLITE2_BIN', BIN_PATH . 'maxmind/GeoLite2-Country.mmdb');
define('GEOLITE2C_BIN', BIN_PATH . 'maxmind/GeoLite2-City.mmdb');
define('GEOISP_BIN', BIN_PATH . 'maxmind/GeoIP2-ISP.mmdb');
// ── FFmpeg (по версиям) ───────────────────────────────────────
define('FFMPEG_BIN_40', BIN_PATH . 'ffmpeg_bin/4.0/ffmpeg');
define('FFMPEG_BIN_71', BIN_PATH . 'ffmpeg_bin/7.1/ffmpeg');
define('FFMPEG_BIN_80', BIN_PATH . 'ffmpeg_bin/8.0/ffmpeg');
// ── FFprobe (по версиям) ──────────────────────────────────────
// ── FFmpeg/FFprobe — legacy 4.0 "DTS" build anchor ────────────
// Only the 4.0 build is pinned as a constant: it is the legacy/DTS-safe binary
// (StreamProcess `-nofix_dts`, RecordCommand, and the FfmpegPaths fallback). Every
// other version is resolved dynamically from bin/ffmpeg_bin/<version>/ by
// FfmpegPaths (paths) and FfmpegBinaries (discovery + capabilities) — no more
// per-version constants to keep in sync with what actually ships in the folder.
define('FFMPEG_BIN_40', BIN_PATH . 'ffmpeg_bin/4.0/ffmpeg');
define('FFPROBE_BIN_40', BIN_PATH . 'ffmpeg_bin/4.0/ffprobe');
define('FFPROBE_BIN_71', BIN_PATH . 'ffmpeg_bin/7.1/ffprobe');
define('FFPROBE_BIN_80', BIN_PATH . 'ffmpeg_bin/8.0/ffprobe');