mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Set detect resolution based on stream properties if available, else apply default values
This commit is contained in:
parent
745a6d16ff
commit
76886ec2f7
@ -959,8 +959,14 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
):
|
):
|
||||||
for input in camera_config.ffmpeg.inputs:
|
for input in camera_config.ffmpeg.inputs:
|
||||||
if "detect" in input.roles:
|
if "detect" in input.roles:
|
||||||
|
stream_info = {"width": 0, "height": 0}
|
||||||
try:
|
try:
|
||||||
stream_info = get_video_properties(input.path)
|
stream_info = get_video_properties(input.path)
|
||||||
|
except Exception:
|
||||||
|
logger.warn(
|
||||||
|
f"Error detecting stream resolution automatically for {input.path} Applying default values."
|
||||||
|
)
|
||||||
|
|
||||||
camera_config.detect.width = (
|
camera_config.detect.width = (
|
||||||
stream_info["width"]
|
stream_info["width"]
|
||||||
if stream_info["width"] > 0
|
if stream_info["width"] > 0
|
||||||
@ -971,18 +977,6 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
if stream_info["height"] > 0
|
if stream_info["height"] > 0
|
||||||
else DEFAULT_DETECT_DIMENSIONS["height"]
|
else DEFAULT_DETECT_DIMENSIONS["height"]
|
||||||
)
|
)
|
||||||
break
|
|
||||||
except Exception:
|
|
||||||
camera_config.detect.width = DEFAULT_DETECT_DIMENSIONS[
|
|
||||||
"width"
|
|
||||||
]
|
|
||||||
camera_config.detect.height = DEFAULT_DETECT_DIMENSIONS[
|
|
||||||
"height"
|
|
||||||
]
|
|
||||||
logger.warn(
|
|
||||||
f"Error detecting stream resolution automatically for {input.path} Applying default values."
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Default max_disappeared configuration
|
# Default max_disappeared configuration
|
||||||
max_disappeared = camera_config.detect.fps * 5
|
max_disappeared = camera_config.detect.fps * 5
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user