Explorar o código

switch default live resolution to 720

Blake Blackshear %!s(int64=3) %!d(string=hai) anos
pai
achega
e51021c573
Modificáronse 3 ficheiros con 9 adicións e 20 borrados
  1. 1 1
      docs/docs/configuration/cameras.md
  2. 3 18
      frigate/config.py
  3. 5 1
      frigate/output.py

+ 1 - 1
docs/docs/configuration/cameras.md

@@ -370,7 +370,7 @@ cameras:
 
     # Optional: Live stream configuration for WebUI
     live:
-      # Optional: Set the height of the live stream. (default: detect stream height)
+      # Optional: Set the height of the live stream. (default: 720)
       # This must be less than or equal to the height of the detect stream. Lower resolutions
       # reduce bandwidth required for viewing the live stream. Width is computed to match known aspect ratio.
       height: 720

+ 3 - 18
frigate/config.py

@@ -442,8 +442,7 @@ class CameraRtmpConfig(BaseModel):
 
 
 class CameraLiveConfig(BaseModel):
-    height: Optional[int] = Field(title="Live camera view height")
-    width: Optional[int] = Field(title="Live camera view width")
+    height: int = Field(default=720, title="Live camera view height")
     quality: int = Field(default=8, ge=1, le=31, title="Live camera view quality")
 
 
@@ -772,22 +771,8 @@ class FrigateConfig(BaseModel):
                 camera_config.detect = DetectConfig(max_disappeared=max_disappeared)
 
             # Default live configuration
-            if camera_config.live:
-                if (
-                    camera_config.live.height
-                    and camera_config.live.height <= camera_config.height
-                ):
-                    camera_config.live.width = int(
-                        camera_config.live.height
-                        * (camera_config.width / camera_config.height)
-                    )
-                else:
-                    camera_config.live.height = camera_config.height
-                    camera_config.live.width = camera_config.width
-            else:
-                camera_config.live = CameraLiveConfig(
-                    height=camera_config.height, width=camera_config.width
-                )
+            if camera_config.live is None:
+                camera_config.live = CameraLiveConfig()
 
             config.cameras[name] = camera_config
 

+ 5 - 1
frigate/output.py

@@ -353,10 +353,14 @@ def output_frames(config: FrigateConfig, video_output_queue):
     broadcasters = {}
 
     for camera, cam_config in config.cameras.items():
+        width = int(
+            cam_config.live.height
+            * (cam_config.frame_shape[1] / cam_config.frame_shape[0])
+        )
         converters[camera] = FFMpegConverter(
             cam_config.frame_shape[1],
             cam_config.frame_shape[0],
-            cam_config.live.width,
+            width,
             cam_config.live.height,
             cam_config.live.quality,
         )