diff --git a/nixos/modules/services/video/frigate.nix b/nixos/modules/services/video/frigate.nix index de418521c3c9..06faa0cd7f89 100644 --- a/nixos/modules/services/video/frigate.nix +++ b/nixos/modules/services/video/frigate.nix @@ -699,6 +699,15 @@ 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 | grep -Po "libavformat\W+\K\d+" > $out + '' + ) + ); PYTHONPATH = cfg.package.pythonPath; } // optionalAttrs (cfg.vaapiDriver != null) {