mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Set default detect dimensions to 1280x720 and update DetectConfig to use the defaults
This commit is contained in:
		
							parent
							
								
									5ca3035cbf
								
							
						
					
					
						commit
						a1aed0414d
					
				@ -44,6 +44,7 @@ FRIGATE_ENV_VARS = {k: v for k, v in os.environ.items() if k.startswith("FRIGATE
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
DEFAULT_TRACKED_OBJECTS = ["person"]
 | 
					DEFAULT_TRACKED_OBJECTS = ["person"]
 | 
				
			||||||
DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
 | 
					DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
 | 
				
			||||||
 | 
					DEFAULT_DETECT_DIMENSIONS = {"width": 1280, "height": 720}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FrigateBaseModel(BaseModel):
 | 
					class FrigateBaseModel(BaseModel):
 | 
				
			||||||
@ -268,8 +269,14 @@ class StationaryConfig(FrigateBaseModel):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class DetectConfig(FrigateBaseModel):
 | 
					class DetectConfig(FrigateBaseModel):
 | 
				
			||||||
    autoconf: bool = Field(default=True, title="Auto detect height, width and fps.")
 | 
					    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.")
 | 
					    height: int = Field(
 | 
				
			||||||
    width: int = Field(default=1280, title="Width of the stream for the detect role.")
 | 
					        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(
 | 
					    fps: int = Field(
 | 
				
			||||||
        default=5, title="Number of frames per second to process through detection."
 | 
					        default=5, title="Number of frames per second to process through detection."
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
@ -672,8 +679,20 @@ class CameraConfig(FrigateBaseModel):
 | 
				
			|||||||
                config["ffmpeg"]["inputs"][0]["roles"].append("rtmp")
 | 
					                config["ffmpeg"]["inputs"][0]["roles"].append("rtmp")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for input in config["ffmpeg"]["inputs"]:
 | 
					        for input in config["ffmpeg"]["inputs"]:
 | 
				
			||||||
            if config["detect"].get("autoconf") and (
 | 
					            if (
 | 
				
			||||||
                "detect" in input.get("roles", [])
 | 
					                "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:
 | 
					                try:
 | 
				
			||||||
                    streamInfo = get_video_properties(input.get("path"))
 | 
					                    streamInfo = get_video_properties(input.get("path"))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user