Skip to content

Commit

Permalink
make watchdog timeout configurable per camera (fixes #95)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Feb 22, 2020
1 parent 169603d commit 1198c29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
################
Expand Down
3 changes: 2 additions & 1 deletion frigate/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def run(self):
# 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)
Expand Down Expand Up @@ -151,6 +151,7 @@ def __init__(self, name, ffmpeg_config, global_objects_config, config, prepped_f
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]
Expand Down

0 comments on commit 1198c29

Please sign in to comment.