From d3b0585bf404ec65fa1aa48586653e75d2d8a6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= <motiejus@jakstys.lt> Date: Thu, 13 Mar 2025 19:54:18 +0000 Subject: [PATCH] add object masks --- modules/services/frigate/default.nix | 92 +++++++++++++++------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/modules/services/frigate/default.nix b/modules/services/frigate/default.nix index 3d0c33c..b0b8ffc 100644 --- a/modules/services/frigate/default.nix +++ b/modules/services/frigate/default.nix @@ -167,53 +167,61 @@ in }; cameras = { - vno4-dome-panorama = { - enabled = true; - motion.mask = [ - "0.308,0.235,0.305,1,0,1,0,0,0.587,0.005" - "0.766,1,0.867,0,1,0,1,1" - ]; - ffmpeg = { - output_args = { - record = "preset-record-generic"; - }; - inputs = [ - { - path = "rtsp://localhost:8554/vno4-dome-panorama-high"; - roles = [ "record" ]; - } - { - path = "rtsp://localhost:8554/vno4-dome-panorama-low"; - roles = [ "detect" ]; - } + vno4-dome-panorama = + let + masks = [ + "0.308,0.235,0.305,1,0,1,0,0,0.587,0.005" + "0.766,1,0.867,0,1,0,1,1" ]; + in + { + enabled = true; + motion.mask = masks; + objects.mask = masks; + ffmpeg = { + output_args = { + record = "preset-record-generic"; + }; + inputs = [ + { + path = "rtsp://localhost:8554/vno4-dome-panorama-high"; + roles = [ "record" ]; + } + { + path = "rtsp://localhost:8554/vno4-dome-panorama-low"; + roles = [ "detect" ]; + } + ]; + }; }; - }; - vno4-dome-ptz = { - enabled = true; - motion.mask = [ - "0,0.115,1,0.115,1,0,0,0" - ]; - ffmpeg = { - output_args = { - record = "preset-record-generic-audio-copy"; + vno4-dome-ptz = + let + masks = [ "0,0.115,1,0.115,1,0,0,0" ]; + in + { + enabled = true; + motion.mask = masks; + objects.mask = masks; + ffmpeg = { + output_args = { + record = "preset-record-generic-audio-copy"; + }; + inputs = [ + { + path = "rtsp://localhost:8554/vno4-dome-ptz-high"; + roles = [ + "record" + "audio" + ]; + } + { + path = "rtsp://localhost:8554/vno4-dome-ptz-low"; + roles = [ "detect" ]; + } + ]; }; - inputs = [ - { - path = "rtsp://localhost:8554/vno4-dome-ptz-high"; - roles = [ - "record" - "audio" - ]; - } - { - path = "rtsp://localhost:8554/vno4-dome-ptz-low"; - roles = [ "detect" ]; - } - ]; }; - }; }; };