frigate: pin joserfc at 1.1.0; ffmpeg flavor selection (#438285)

This commit is contained in:
Martin Weinelt
2025-08-30 01:52:40 +02:00
committed by GitHub
3 changed files with 52 additions and 24 deletions
+11
View File
@@ -231,6 +231,17 @@ in
};
};
ffmpeg = {
path = mkOption {
type = coercedTo package toString str;
default = pkgs.ffmpeg-headless;
example = literalExpression "pkgs.ffmpeg-full";
description = ''
Package providing the ffmpeg and ffprobe executables below the bin/ directory.
'';
};
};
mqtt = {
enabled = mkEnableOption "MQTT support";
+21 -13
View File
@@ -1,30 +1,39 @@
diff --git a/frigate/config/camera/ffmpeg.py b/frigate/config/camera/ffmpeg.py
index 04bbfac7..4390a571 100644
index 04bbfac7..396bcc4b 100644
--- a/frigate/config/camera/ffmpeg.py
+++ b/frigate/config/camera/ffmpeg.py
@@ -70,18 +70,14 @@ class FfmpegConfig(FrigateBaseModel):
@@ -1,4 +1,5 @@
from enum import Enum
+from os.path import join
from typing import Union
from pydantic import Field, field_validator
@@ -69,21 +70,11 @@ class FfmpegConfig(FrigateBaseModel):
@property
def ffmpeg_path(self) -> str:
if self.path == "default":
- if self.path == "default":
- return f"/usr/lib/ffmpeg/{DEFAULT_FFMPEG_VERSION}/bin/ffmpeg"
- elif self.path in INCLUDED_FFMPEG_VERSIONS:
- return f"/usr/lib/ffmpeg/{self.path}/bin/ffmpeg"
+ return "@ffmpeg@"
else:
return f"{self.path}/bin/ffmpeg"
- else:
- return f"{self.path}/bin/ffmpeg"
+ return join(self.path, "bin/ffmpeg")
@property
def ffprobe_path(self) -> str:
if self.path == "default":
- if self.path == "default":
- return f"/usr/lib/ffmpeg/{DEFAULT_FFMPEG_VERSION}/bin/ffprobe"
- elif self.path in INCLUDED_FFMPEG_VERSIONS:
- return f"/usr/lib/ffmpeg/{self.path}/bin/ffprobe"
+ return "@ffprobe@"
else:
return f"{self.path}/bin/ffprobe"
- else:
- return f"{self.path}/bin/ffprobe"
+ return join(self.path, "bin/ffprobe")
class CameraRoleEnum(str, Enum):
diff --git a/frigate/record/export.py b/frigate/record/export.py
index 0d3f96da..09cadbcd 100644
index 0d3f96da..463bcff4 100644
--- a/frigate/record/export.py
+++ b/frigate/record/export.py
@@ -126,7 +126,7 @@ class RecordingExporter(threading.Thread):
@@ -32,8 +41,7 @@ index 0d3f96da..09cadbcd 100644
seconds = int(diff % 60)
ffmpeg_cmd = [
- "/usr/lib/ffmpeg/7.0/bin/ffmpeg", # hardcode path for exports thumbnail due to missing libwebp support
+ "@ffmpeg@", # hardcode path for exports thumbnail due to missing libwebp support
+ FfmpegConfig.ffmpeg_path, # hardcode path for exports thumbnail due to missing libwebp support
"-hide_banner",
"-loglevel",
"warning",
~
+20 -11
View File
@@ -2,7 +2,6 @@
lib,
stdenv,
callPackage,
replaceVars,
python312Packages,
fetchFromGitHub,
fetchurl,
@@ -27,7 +26,20 @@ let
inherit version src;
};
python = python312Packages.python;
python = python312Packages.python.override {
packageOverrides = self: super: {
joserfc = super.joserfc.overridePythonAttrs (oldAttrs: {
version = "1.1.0";
src = fetchFromGitHub {
owner = "authlib";
repo = "joserfc";
tag = version;
hash = "sha256-95xtUzzIxxvDtpHX/5uCHnTQTB8Fc08DZGUOR/SdKLs=";
};
});
};
};
python3Packages = python.pkgs;
# Tensorflow audio model
# https://github.com/blakeblackshear/frigate/blob/v0.15.0/docker/main/Dockerfile#L125
@@ -56,7 +68,7 @@ let
hash = "sha256-5Cj2vEiWR8Z9d2xBmVoLZuNRv4UOuxHSGZQWTJorXUQ=";
};
in
python312Packages.buildPythonApplication rec {
python3Packages.buildPythonApplication rec {
pname = "frigate";
inherit version;
format = "other";
@@ -65,11 +77,7 @@ python312Packages.buildPythonApplication rec {
patches = [
./constants.patch
(replaceVars ./ffmpeg.patch {
ffmpeg = lib.getExe ffmpeg-headless;
ffprobe = lib.getExe' ffmpeg-headless "ffprobe";
})
./ffmpeg.patch
];
postPatch = ''
@@ -109,7 +117,7 @@ python312Packages.buildPythonApplication rec {
dontBuild = true;
dependencies = with python312Packages; [
dependencies = with python3Packages; [
# docker/main/requirements.txt
scikit-build
# docker/main/requirements-wheel.txt
@@ -191,7 +199,8 @@ python312Packages.buildPythonApplication rec {
runHook postInstall
'';
nativeCheckInputs = with python312Packages; [
nativeCheckInputs = with python3Packages; [
ffmpeg-headless
pytestCheckHook
];
@@ -213,7 +222,7 @@ python312Packages.buildPythonApplication rec {
passthru = {
web = frigate-web;
inherit python;
pythonPath = (python312Packages.makePythonPath dependencies) + ":${frigate}/${python.sitePackages}";
pythonPath = (python3Packages.makePythonPath dependencies) + ":${frigate}/${python.sitePackages}";
tests = {
inherit (nixosTests) frigate;
};