switch default live resolution to 720

This commit is contained in:
Blake Blackshear 2021-07-21 07:47:11 -05:00
parent 19115fb828
commit e51021c573
3 changed files with 9 additions and 20 deletions

View File

@ -370,7 +370,7 @@ cameras:
# Optional: Live stream configuration for WebUI # Optional: Live stream configuration for WebUI
live: 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 # 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. # reduce bandwidth required for viewing the live stream. Width is computed to match known aspect ratio.
height: 720 height: 720

View File

@ -442,8 +442,7 @@ class CameraRtmpConfig(BaseModel):
class CameraLiveConfig(BaseModel): class CameraLiveConfig(BaseModel):
height: Optional[int] = Field(title="Live camera view height") height: int = Field(default=720, title="Live camera view height")
width: Optional[int] = Field(title="Live camera view width")
quality: int = Field(default=8, ge=1, le=31, title="Live camera view quality") 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) camera_config.detect = DetectConfig(max_disappeared=max_disappeared)
# Default live configuration # Default live configuration
if camera_config.live: if camera_config.live is None:
if ( camera_config.live = CameraLiveConfig()
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
)
config.cameras[name] = camera_config config.cameras[name] = camera_config

View File

@ -353,10 +353,14 @@ def output_frames(config: FrigateConfig, video_output_queue):
broadcasters = {} broadcasters = {}
for camera, cam_config in config.cameras.items(): 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( converters[camera] = FFMpegConverter(
cam_config.frame_shape[1], cam_config.frame_shape[1],
cam_config.frame_shape[0], cam_config.frame_shape[0],
cam_config.live.width, width,
cam_config.live.height, cam_config.live.height,
cam_config.live.quality, cam_config.live.quality,
) )