mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
add config for camera live stream
This commit is contained in:
parent
f009897eca
commit
762afb8f43
@ -357,9 +357,19 @@ cameras:
|
||||
|
||||
# Optional: RTMP re-stream configuration
|
||||
rtmp:
|
||||
# Required: Enable the live stream (default: True)
|
||||
# Required: Enable the RTMP stream (default: True)
|
||||
enabled: True
|
||||
|
||||
# Optional: Live stream configuration for WebUI
|
||||
live:
|
||||
# Optional: Set the height of the live stream. (default: detect stream height)
|
||||
# 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
|
||||
# Optional: Set the encode quality of the live stream (default: shown below)
|
||||
# 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
|
||||
quality: 8
|
||||
|
||||
# Optional: Configuration for the jpg snapshots written to the clips directory for each event
|
||||
snapshots:
|
||||
# Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
|
||||
|
@ -167,14 +167,14 @@ A dynamic combined camera view of all tracked cameras. This is optimized for min
|
||||
|
||||
```yaml
|
||||
birdseye:
|
||||
# Optional: Enable birdseye view
|
||||
# Optional: Enable birdseye view (default: shown below)
|
||||
enabled: True
|
||||
# Optional: Width of the output resolution
|
||||
# Optional: Width of the output resolution (default: shown below)
|
||||
width: 1280
|
||||
# Optional: Height of the output resolution
|
||||
# Optional: Height of the output resolution (default: shown below)
|
||||
height: 720
|
||||
# Optional: Encoding quality of the mpeg1 feed. 1 is the highest quality, and 31 is the lowest.
|
||||
# Lower quality feeds utilize less CPU resources.
|
||||
# Optional: Encoding quality of the mpeg1 feed (default: shown below)
|
||||
# 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
|
||||
quality: 8
|
||||
# Optional: Mode of the view. Available options are: objects, motion, and continuous
|
||||
# objects - cameras are included if they have had a tracked object within the last 30 seconds
|
||||
|
@ -649,6 +649,10 @@ CAMERAS_SCHEMA = vol.Schema(
|
||||
vol.Optional("rtmp", default={}): {
|
||||
vol.Required("enabled", default=True): bool,
|
||||
},
|
||||
vol.Optional("live", default={}): {
|
||||
"height": int,
|
||||
vol.Optional("quality", default=8): vol.Range(min=1, max=31),
|
||||
},
|
||||
vol.Optional("snapshots", default={}): {
|
||||
vol.Optional("enabled", default=False): bool,
|
||||
vol.Optional("clean_copy", default=True): bool,
|
||||
@ -827,6 +831,27 @@ class CameraRtmpConfig:
|
||||
return dataclasses.asdict(self)
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class CameraLiveConfig:
|
||||
height: int
|
||||
width: int
|
||||
quality: int
|
||||
|
||||
@classmethod
|
||||
def build(cls, config, camera_height, camera_width) -> CameraRtmpConfig:
|
||||
if "height" in config and config["height"] <= camera_height:
|
||||
height = config["height"]
|
||||
width = int(height * (camera_width / camera_height))
|
||||
else:
|
||||
height = camera_height
|
||||
width = camera_width
|
||||
|
||||
return CameraLiveConfig(height, width, config["quality"])
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
return dataclasses.asdict(self)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class CameraConfig:
|
||||
name: str
|
||||
@ -839,6 +864,7 @@ class CameraConfig:
|
||||
clips: CameraClipsConfig
|
||||
record: RecordConfig
|
||||
rtmp: CameraRtmpConfig
|
||||
live: CameraLiveConfig
|
||||
snapshots: CameraSnapshotsConfig
|
||||
mqtt: CameraMqttConfig
|
||||
objects: ObjectConfig
|
||||
@ -886,6 +912,9 @@ class CameraConfig:
|
||||
clips=CameraClipsConfig.build(config["clips"], global_config),
|
||||
record=RecordConfig.build(config["record"], global_config["record"]),
|
||||
rtmp=CameraRtmpConfig.build(config["rtmp"]),
|
||||
live=CameraLiveConfig.build(
|
||||
config["live"], config["height"], config["width"]
|
||||
),
|
||||
snapshots=CameraSnapshotsConfig.build(config["snapshots"], global_config),
|
||||
mqtt=CameraMqttConfig.build(config["mqtt"]),
|
||||
objects=ObjectConfig.build(
|
||||
|
@ -346,9 +346,9 @@ def output_frames(config: FrigateConfig, video_output_queue):
|
||||
converters[camera] = FFMpegConverter(
|
||||
cam_config.frame_shape[1],
|
||||
cam_config.frame_shape[0],
|
||||
cam_config.frame_shape[1],
|
||||
cam_config.frame_shape[0],
|
||||
8,
|
||||
cam_config.live.width,
|
||||
cam_config.live.height,
|
||||
cam_config.live.quality,
|
||||
)
|
||||
broadcasters[camera] = BroadcastThread(
|
||||
camera, converters[camera], websocket_server
|
||||
|
Loading…
Reference in New Issue
Block a user