diff --git a/docs/docs/configuration/cameras.md b/docs/docs/configuration/cameras.md index 273be9b7e..5ee6d67c4 100644 --- a/docs/docs/configuration/cameras.md +++ b/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 diff --git a/frigate/config.py b/frigate/config.py index a39cdf134..695ab1059 100644 --- a/frigate/config.py +++ b/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 diff --git a/frigate/output.py b/frigate/output.py index 650aab226..3ae840b59 100644 --- a/frigate/output.py +++ b/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, )