From 2e7ea69665722a3c9dc10420d9079c8ef9d65d3b Mon Sep 17 00:00:00 2001 From: Bakhtiyar Neyman Date: Thu, 19 Feb 2026 01:07:49 -0800 Subject: [PATCH] nixos/frigate: set LIBAVFORMAT_VERSION_MAJOR Frigate uses this to select appropriate ffmpeg flags for compatibility. Co-Authored-By: Claude Opus 4.6 --- nixos/modules/services/video/frigate.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nixos/modules/services/video/frigate.nix b/nixos/modules/services/video/frigate.nix index f8d8f64e55da..82795e50deef 100644 --- a/nixos/modules/services/video/frigate.nix +++ b/nixos/modules/services/video/frigate.nix @@ -699,6 +699,17 @@ in environment = { CONFIG_FILE = "/run/frigate/frigate.yml"; HOME = "/var/lib/frigate"; + # Extract libavformat version in the same way Docker scripts in frigate directory do. This + # environment variable changes the flags given to `ffmpeg` improving compatibility. + LIBAVFORMAT_VERSION_MAJOR = lib.strings.trim ( + builtins.readFile ( + pkgs.runCommandLocal "libavformat-major-version" { } '' + ${cfg.settings.ffmpeg.path}/bin/ffmpeg -version 2>&1 \ + | sed -n 's/.*libavformat[[:space:]]*\([0-9]*\).*/\1/p' \ + | head -1 > $out + '' + ) + ); PYTHONPATH = cfg.package.pythonPath; } // optionalAttrs (cfg.vaapiDriver != null) {