From b29b311e92efa10c4ceb897dbf9ff05b7909ef9c Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Mon, 8 Nov 2021 18:20:47 -0600 Subject: [PATCH] fix ffmpeg config for env vars --- frigate/app.py | 3 +++ frigate/config.py | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frigate/app.py b/frigate/app.py index c9812e05f..5833d5fe9 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -71,6 +71,9 @@ class FrigateApp: self.config = user_config.runtime_config for camera_name in self.config.cameras.keys(): + # generage the ffmpeg commands + self.config.cameras[camera_name].create_ffmpeg_cmds() + # create camera_metrics self.camera_metrics[camera_name] = { "camera_fps": mp.Value("d", 0.0), diff --git a/frigate/config.py b/frigate/config.py index 8126ecfcc..aee716a84 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -12,7 +12,7 @@ import yaml from pydantic import BaseModel, Extra, Field, validator from pydantic.fields import PrivateAttr -from frigate.const import BASE_DIR, CACHE_DIR, RECORD_DIR +from frigate.const import BASE_DIR, CACHE_DIR from frigate.edgetpu import load_labels from frigate.util import create_mask, deep_merge @@ -506,8 +506,6 @@ class CameraConfig(FrigateBaseModel): super().__init__(**config) - self._ffmpeg_cmds = self._create_ffmpeg_cmds() - @property def frame_shape(self) -> Tuple[int, int]: return self.detect.height, self.detect.width @@ -520,7 +518,7 @@ class CameraConfig(FrigateBaseModel): def ffmpeg_cmds(self) -> List[Dict[str, List[str]]]: return self._ffmpeg_cmds - def _create_ffmpeg_cmds(self) -> List[Dict[str, List[str]]]: + def create_ffmpeg_cmds(self) -> List[Dict[str, List[str]]]: ffmpeg_cmds = [] for ffmpeg_input in self.ffmpeg.inputs: ffmpeg_cmd = self._get_ffmpeg_cmd(ffmpeg_input) @@ -528,7 +526,7 @@ class CameraConfig(FrigateBaseModel): continue ffmpeg_cmds.append({"roles": ffmpeg_input.roles, "cmd": ffmpeg_cmd}) - return ffmpeg_cmds + self._ffmpeg_cmds = ffmpeg_cmds def _get_ffmpeg_cmd(self, ffmpeg_input: CameraInput): ffmpeg_output_args = []