Skip to content

Commit

Permalink
Set default detect dimensions to 1280x720 and update DetectConfig to …
Browse files Browse the repository at this point in the history
…use the defaults
  • Loading branch information
skrashevich committed Jun 15, 2023
1 parent 5ca3035 commit 4954b26
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions frigate/config.py
Expand Up @@ -44,6 +44,7 @@

DEFAULT_TRACKED_OBJECTS = ["person"]
DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
DEFAULT_DETECT_DIMENSIONS = {"width": 1280, "height": 720}


class FrigateBaseModel(BaseModel):
Expand Down Expand Up @@ -268,8 +269,14 @@ class StationaryConfig(FrigateBaseModel):

class DetectConfig(FrigateBaseModel):
autoconf: bool = Field(default=True, title="Auto detect height, width and fps.")
height: int = Field(default=720, title="Height of the stream for the detect role.")
width: int = Field(default=1280, title="Width of the stream for the detect role.")
height: int = Field(
default=DEFAULT_DETECT_DIMENSIONS["height"],
title="Height of the stream for the detect role.",
)
width: int = Field(
default=DEFAULT_DETECT_DIMENSIONS["width"],
title="Width of the stream for the detect role.",
)
fps: int = Field(
default=5, title="Number of frames per second to process through detection."
)
Expand Down Expand Up @@ -672,8 +679,20 @@ def __init__(self, **config):
config["ffmpeg"]["inputs"][0]["roles"].append("rtmp")

for input in config["ffmpeg"]["inputs"]:
if config["detect"].get("autoconf") and (
"detect" in input.get("roles", [])
if (
"detect" in config and
config["detect"].get("autoconf")
and ("detect" in input.get("roles", []))
and (
config["detect"].get("height") is None
or config["detect"].get("width") is None
or (
config["detect"].get("height")
== DEFAULT_DETECT_DIMENSIONS["height"]
and config["detect"].get("width")
== DEFAULT_DETECT_DIMENSIONS["width"]
)
)
):
try:
streamInfo = get_video_properties(input.get("path"))
Expand Down

0 comments on commit 4954b26

Please sign in to comment.