handle case then get_video_properties returns 0x0 dimension

This commit is contained in:
Sergey Krashevich 2023-06-23 02:11:10 +03:00
parent 990b6ddad0
commit 745a6d16ff
No known key found for this signature in database
GPG Key ID: 625171324E7D3856

View File

@ -961,8 +961,16 @@ class FrigateConfig(FrigateBaseModel):
if "detect" in input.roles: if "detect" in input.roles:
try: try:
stream_info = get_video_properties(input.path) stream_info = get_video_properties(input.path)
camera_config.detect.width = stream_info["width"] camera_config.detect.width = (
camera_config.detect.height = stream_info["height"] 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"]
)
break break
except Exception: except Exception:
camera_config.detect.width = DEFAULT_DETECT_DIMENSIONS[ camera_config.detect.width = DEFAULT_DETECT_DIMENSIONS[