Blake Blackshear 3 лет назад
Родитель
Сommit
2a41a9d3ff
2 измененных файлов с 27 добавлено и 2 удалено
  1. 1 1
      frigate/config.py
  2. 26 1
      frigate/test/test_config.py

+ 1 - 1
frigate/config.py

@@ -99,7 +99,7 @@ class RuntimeMotionConfig(MotionConfig):
         frame_shape = config.get("frame_shape", (1, 1))
 
         if "frame_height" not in config:
-            config["frame_height"] = frame_shape[0] // 6
+            config["frame_height"] = max(frame_shape[0] // 6, 180)
 
         mask = config.get("mask", "")
         config["raw_mask"] = mask

+ 26 - 1
frigate/test/test_config.py

@@ -449,9 +449,34 @@ class TestConfig(unittest.TestCase):
         assert config == frigate_config.dict(exclude_unset=True)
 
         runtime_config = frigate_config.runtime_config
-        ffmpeg_cmds = runtime_config.cameras["back"].ffmpeg_cmds
         assert runtime_config.cameras["back"].detect.max_disappeared == 5 * 5
 
+    def test_motion_frame_height_wont_go_below_180(self):
+
+        config = {
+            "mqtt": {"host": "mqtt"},
+            "cameras": {
+                "back": {
+                    "ffmpeg": {
+                        "inputs": [
+                            {
+                                "path": "rtsp://10.0.0.1:554/video",
+                                "roles": ["detect"],
+                            },
+                        ]
+                    },
+                    "height": 480,
+                    "width": 640,
+                }
+            },
+        }
+
+        frigate_config = FrigateConfig(**config)
+        assert config == frigate_config.dict(exclude_unset=True)
+
+        runtime_config = frigate_config.runtime_config
+        assert runtime_config.cameras["back"].motion.frame_height >= 180
+
 
 if __name__ == "__main__":
     unittest.main(verbosity=2)