forked from Github/frigate
sync master
This commit is contained in:
@@ -194,7 +194,13 @@ class Dispatcher:
|
||||
record_settings = self.config.cameras[camera_name].record
|
||||
|
||||
if payload == "ON":
|
||||
if not self.record_metrics[camera_name]["record_enabled"].value:
|
||||
if not self.config.cameras[camera_name].record.enabled_in_config:
|
||||
logger.error(
|
||||
f"Recordings must be enabled in the config to be turned on via MQTT."
|
||||
)
|
||||
return
|
||||
|
||||
if not record_settings.enabled:
|
||||
logger.info(f"Turning on recordings for {camera_name}")
|
||||
record_settings.enabled = True
|
||||
self.record_metrics[camera_name]["record_enabled"].value = True
|
||||
|
||||
@@ -179,6 +179,9 @@ class RecordConfig(FrigateBaseModel):
|
||||
events: EventsConfig = Field(
|
||||
default_factory=EventsConfig, title="Event specific settings."
|
||||
)
|
||||
enabled_in_config: Optional[bool] = Field(
|
||||
title="Keep track of original state of recording."
|
||||
)
|
||||
|
||||
|
||||
class MotionConfig(FrigateBaseModel):
|
||||
@@ -961,6 +964,8 @@ class FrigateConfig(FrigateBaseModel):
|
||||
camera_config.onvif.password = camera_config.onvif.password.format(
|
||||
**FRIGATE_ENV_VARS
|
||||
)
|
||||
# set config recording value
|
||||
camera_config.record.enabled_in_config = camera_config.record.enabled
|
||||
|
||||
# Add default filters
|
||||
object_keys = camera_config.objects.track
|
||||
|
||||
@@ -53,8 +53,8 @@ _user_agent_args = [
|
||||
]
|
||||
|
||||
PRESETS_HW_ACCEL_DECODE = {
|
||||
"preset-rpi-32-h264": ["-c:v", "h264_v4l2m2m"],
|
||||
"preset-rpi-64-h264": ["-c:v", "h264_v4l2m2m"],
|
||||
"preset-rpi-32-h264": ["-c:v:1", "h264_v4l2m2m"],
|
||||
"preset-rpi-64-h264": ["-c:v:1", "h264_v4l2m2m"],
|
||||
"preset-vaapi": [
|
||||
"-hwaccel_flags",
|
||||
"allow_profile_mismatch",
|
||||
@@ -320,7 +320,7 @@ def parse_preset_input(arg: Any, detect_fps: int) -> list[str]:
|
||||
|
||||
if arg == "preset-http-jpeg-generic":
|
||||
input = PRESETS_INPUT[arg].copy()
|
||||
input[1] = str(detect_fps)
|
||||
input[len(_user_agent_args) + 1] = str(detect_fps)
|
||||
return input
|
||||
|
||||
return PRESETS_INPUT.get(arg, None)
|
||||
|
||||
@@ -951,6 +951,7 @@ def config_save():
|
||||
# Validate the config schema
|
||||
try:
|
||||
new_yaml = FrigateConfig.parse_raw(new_config)
|
||||
check_runtime = new_yaml.runtime_config
|
||||
except Exception as e:
|
||||
return make_response(
|
||||
jsonify(
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestFfmpegPresets(unittest.TestCase):
|
||||
assert "preset-rpi-64-h264" not in (
|
||||
" ".join(frigate_config.cameras["back"].ffmpeg_cmds[0]["cmd"])
|
||||
)
|
||||
assert "-c:v h264_v4l2m2m" in (
|
||||
assert "-c:v:1 h264_v4l2m2m" in (
|
||||
" ".join(frigate_config.cameras["back"].ffmpeg_cmds[0]["cmd"])
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user