From 2682aa9989a6baf6b46539d621e5fcc7e1d4d481 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Mon, 26 Jun 2023 04:17:46 +0300 Subject: [PATCH] Update FrigateConfig to set default values for stream_info if resolution detection fails --- frigate/config.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index 3a6ce6b9c..94c7d1f36 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -966,17 +966,18 @@ class FrigateConfig(FrigateBaseModel): logger.warn( f"Error detecting stream resolution automatically for {input.path} Applying default values." ) + stream_info = {"width": 0, "height": 0} - camera_config.detect.width = ( - stream_info["width"] - if stream_info["width"] > 0 - else DEFAULT_DETECT_DIMENSIONS["width"] - ) - camera_config.detect.height = ( - stream_info["height"] - if stream_info["height"] > 0 - else DEFAULT_DETECT_DIMENSIONS["height"] - ) + camera_config.detect.width = ( + stream_info["width"] + if stream_info["width"] > 0 + else DEFAULT_DETECT_DIMENSIONS["width"] + ) + camera_config.detect.height = ( + stream_info["height"] + if stream_info["height"] > 0 + else DEFAULT_DETECT_DIMENSIONS["height"] + ) # Default max_disappeared configuration max_disappeared = camera_config.detect.fps * 5