From 1198c29dac585ee301e7e180c969c13ee510ec8b Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 18 Jan 2020 08:34:44 -0600 Subject: [PATCH] make watchdog timeout configurable per camera (fixes #95) --- config/config.example.yml | 6 ++++++ frigate/video.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/config.example.yml b/config/config.example.yml index 2760793c1..07bcdc24a 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -99,6 +99,12 @@ cameras: ################ take_frame: 1 + ################ + # The number of seconds frigate will allow a camera to go without sending a frame before + # assuming the ffmpeg process has a problem and restarting. + ################ + # watchdog_timeout: 300 + ################ # Camera level object config. This config is merged with the global config above. ################ diff --git a/frigate/video.py b/frigate/video.py index f6b2c4703..25ec223e5 100644 --- a/frigate/video.py +++ b/frigate/video.py @@ -65,7 +65,7 @@ class CameraWatchdog(threading.Thread): # wait a bit before checking time.sleep(10) - if self.camera.frame_time.value != 0.0 and (datetime.datetime.now().timestamp() - self.camera.frame_time.value) > 300: + if self.camera.frame_time.value != 0.0 and (datetime.datetime.now().timestamp() - self.camera.frame_time.value) > self.camera.watchdog_timeout: print(self.camera.name + ": last frame is more than 5 minutes old, restarting camera capture...") self.camera.start_or_restart_capture() time.sleep(5) @@ -151,6 +151,7 @@ class Camera: camera_objects_config = config.get('objects', {}) self.take_frame = self.config.get('take_frame', 1) + self.watchdog_timeout = self.config.get('watchdog_timeout', 300) self.regions = self.config['regions'] self.frame_shape = get_frame_shape(self.ffmpeg_input) self.frame_size = self.frame_shape[0] * self.frame_shape[1] * self.frame_shape[2]