mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-29 16:57:06 +03:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
608fc8cf50 | ||
|
|
58600ad642 |
@@ -314,18 +314,6 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
if [ "$ok" -ne 1 ]; then echo "sentinel skip never logged"; docker logs frigate-puid; exit 1; fi
|
if [ "$ok" -ne 1 ]; then echo "sentinel skip never logged"; docker logs frigate-puid; exit 1; fi
|
||||||
# a replaced media volume re-sweeps despite the sentinel
|
|
||||||
docker stop frigate-puid
|
|
||||||
sudo rm -rf /tmp/frigate-media-puid
|
|
||||||
sudo mkdir /tmp/frigate-media-puid
|
|
||||||
docker start frigate-puid
|
|
||||||
up=0
|
|
||||||
for i in $(seq 1 60); do
|
|
||||||
docker exec frigate-puid curl -fs http://127.0.0.1:5000/api/version && up=1 && break
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
if [ "$up" -ne 1 ]; then echo "replaced media volume was not swept"; docker logs frigate-puid; exit 1; fi
|
|
||||||
docker exec frigate-puid stat -c %u:%g /media/frigate | grep -qx 1500:1500
|
|
||||||
docker rm -f frigate-puid
|
docker rm -f frigate-puid
|
||||||
- name: Assert read-only rootfs with --user works
|
- name: Assert read-only rootfs with --user works
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ Frigate NVR is a realtime object detection system for IP cameras that uses:
|
|||||||
- **Architecture**: Multiprocessing design with ZMQ and MQTT communication
|
- **Architecture**: Multiprocessing design with ZMQ and MQTT communication
|
||||||
- **Focus**: Minimal resource usage with maximum performance
|
- **Focus**: Minimal resource usage with maximum performance
|
||||||
|
|
||||||
|
## Before Starting Work
|
||||||
|
|
||||||
|
Before starting work on a large change or a new feature, let the user know that a [GitHub discussion](https://github.com/blakeblackshear/frigate/discussions/new) should be opened first to align with the maintainers on scope and approach. This applies even to features that are self-contained and don't touch existing code, since every feature adds long-term maintenance cost. PRs for large changes without a prior discussion are unlikely to be merged. See [CONTRIBUTING.md](CONTRIBUTING.md). This can be skipped if the user has said they are a Frigate maintainer.
|
||||||
|
|
||||||
## Code Review Guidelines
|
## Code Review Guidelines
|
||||||
|
|
||||||
When reviewing code, do NOT comment on:
|
When reviewing code, do NOT comment on:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ onvif-zeep-async == 4.3.*
|
|||||||
paho-mqtt == 2.2.*
|
paho-mqtt == 2.2.*
|
||||||
pandas == 3.0.*
|
pandas == 3.0.*
|
||||||
peewee == 4.5.*
|
peewee == 4.5.*
|
||||||
peewee_migrate == 2.3.*
|
peewee_migrate == 2.5.*
|
||||||
psutil == 7.2.*
|
psutil == 7.2.*
|
||||||
pydantic == 2.14.*
|
pydantic == 2.14.*
|
||||||
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
|
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
|
||||||
|
|||||||
@@ -70,6 +70,16 @@ if [[ -n "$mode" ]]; then
|
|||||||
sentinel_content="${sentinel_content}:${mode}"
|
sentinel_content="${sentinel_content}:${mode}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# safe-sentinel reports only a root-owned regular file, so a forged or
|
||||||
|
# symlinked sentinel in the runtime-user-owned /config can't suppress the sweep
|
||||||
|
if [[ "$dry_run" -eq 0 && -n "$sentinel" ]]; then
|
||||||
|
if existing=$(/usr/local/bin/safe-sentinel read "$sentinel" 2>/dev/null) && \
|
||||||
|
[[ "$existing" == "$sentinel_content" ]]; then
|
||||||
|
echo "[INFO] fix-ownership: ${target_uid}:${target_gid} (schema ${schema}) already applied, skipping"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# A sweep that could not chown everything must not be recorded as complete:
|
# A sweep that could not chown everything must not be recorded as complete:
|
||||||
# the sentinel would make every later boot skip it and the entries would stay
|
# the sentinel would make every later boot skip it and the entries would stay
|
||||||
# unreachable once services run unprivileged.
|
# unreachable once services run unprivileged.
|
||||||
@@ -92,24 +102,6 @@ mismatch_expr=(
|
|||||||
-a ! -path /config/.permissions_version
|
-a ! -path /config/.permissions_version
|
||||||
)
|
)
|
||||||
|
|
||||||
first_mismatched_root() {
|
|
||||||
find "$@" -maxdepth 0 "${mismatch_expr[@]}" -print -quit 2>/dev/null || true
|
|
||||||
}
|
|
||||||
|
|
||||||
# safe-sentinel reports only a root-owned regular file, so a forged or
|
|
||||||
# symlinked sentinel in the runtime-user-owned /config can't suppress the sweep.
|
|
||||||
# A mismatched volume root means the volume was replaced or wiped since the
|
|
||||||
# sweep (Docker recreates a missing bind source as root), so it sweeps again,
|
|
||||||
# unless the sentinel records a filesystem that ignores chown.
|
|
||||||
if [[ "$dry_run" -eq 0 && -n "$sentinel" ]]; then
|
|
||||||
if existing=$(/usr/local/bin/safe-sentinel read "$sentinel" 2>/dev/null) && \
|
|
||||||
{ [[ "$existing" == "${sentinel_content}:unmanaged" ]] || \
|
|
||||||
{ [[ "$existing" == "$sentinel_content" ]] && [[ -z "$(first_mismatched_root "$@")" ]]; }; }; then
|
|
||||||
echo "[INFO] fix-ownership: ${target_uid}:${target_gid} (schema ${schema}) already applied, skipping"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
|
|
||||||
for path in "$@"; do
|
for path in "$@"; do
|
||||||
@@ -207,13 +199,6 @@ if [[ "$dry_run" -eq 0 && -d /config ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$dry_run" -eq 0 && -n "$sentinel" && "$swept_clean" -eq 1 ]]; then
|
if [[ "$dry_run" -eq 0 && -n "$sentinel" && "$swept_clean" -eq 1 ]]; then
|
||||||
# CIFS without the setuids option accepts chown and changes nothing, so
|
|
||||||
# the root can never match. Without this every boot would sweep again.
|
|
||||||
unmanaged_root=$(first_mismatched_root "$@")
|
|
||||||
if [[ -n "$unmanaged_root" ]]; then
|
|
||||||
echo "[WARN] fix-ownership: ${unmanaged_root} kept its owner after chown; its filesystem ignores ownership changes, so set the owner through its mount options"
|
|
||||||
sentinel_content="${sentinel_content}:unmanaged"
|
|
||||||
fi
|
|
||||||
/usr/local/bin/safe-sentinel write "$sentinel" "$sentinel_content" || \
|
/usr/local/bin/safe-sentinel write "$sentinel" "$sentinel_content" || \
|
||||||
echo "[WARN] fix-ownership: could not write ${sentinel}; the sweep will run again on next boot"
|
echo "[WARN] fix-ownership: could not write ${sentinel}; the sweep will run again on next boot"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -83,12 +83,12 @@ A camera is enabled by default but can be disabled by using `enabled: False`. Ca
|
|||||||
|
|
||||||
Each role can only be assigned to one input per camera. The options for roles are as follows:
|
Each role can only be assigned to one input per camera. The options for roles are as follows:
|
||||||
|
|
||||||
| Role | Description |
|
| Role | Description |
|
||||||
| ------------ | --------------------------------------------------------------------------------------------------------------- |
|
| ------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||||
| `detect` | Main feed for object detection. [docs](object_detectors.md) |
|
| `detect` | Main feed for object detection. [docs](object_detectors.md) |
|
||||||
| `record` | Saves segments of the video feed based on configuration settings. [docs](record.md) |
|
| `record` | Saves segments of the video feed based on configuration settings. [docs](record.md) |
|
||||||
| `record_sub` | Saves segments of a second, lower quality stream with its own retention. [docs](record.md#sub-stream-recording) |
|
| `record_sub` | Saves segments of a second, lower quality stream with its own retention. [docs](record.md#sub-stream-recording) |
|
||||||
| `audio` | Feed for audio based detection. [docs](audio_detectors.md) |
|
| `audio` | Feed for audio based detection. [docs](audio_detectors.md) |
|
||||||
|
|
||||||
<ConfigTabs>
|
<ConfigTabs>
|
||||||
<TabItem value="ui">
|
<TabItem value="ui">
|
||||||
@@ -160,8 +160,6 @@ If you only define one stream in your `inputs` and do not assign a `detect` role
|
|||||||
|
|
||||||
If you plan to use Frigate for recording only, it is still recommended to define a `detect` role for a low resolution stream to minimize resource usage from the required stream decoding.
|
If you plan to use Frigate for recording only, it is still recommended to define a `detect` role for a low resolution stream to minimize resource usage from the required stream decoding.
|
||||||
|
|
||||||
Setting the `detect` `width` and `height` explicitly is recommended. When they are unset, Frigate probes the detect stream at every startup, which can add several seconds per camera. Cameras added with the [Add Camera Wizard](#adding-a-camera-with-the-add-camera-wizard) have them set automatically.
|
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
For camera model specific settings check the [camera specific](camera_specific.md) infos.
|
For camera model specific settings check the [camera specific](camera_specific.md) infos.
|
||||||
|
|||||||
@@ -86,16 +86,6 @@ Once the volumes are aligned, start Frigate normally. A file at `/config/.permis
|
|||||||
|
|
||||||
If something under your volumes can't be chowned, a read-only btrfs snapshot directory for example, the sweep warns and names the path and doesn't record the migration as finished. It retries on the next boot instead. Either move those paths outside `/media/frigate` or expect the scan to repeat.
|
If something under your volumes can't be chowned, a read-only btrfs snapshot directory for example, the sweep warns and names the path and doesn't record the migration as finished. It retries on the next boot instead. Either move those paths outside `/media/frigate` or expect the scan to repeat.
|
||||||
|
|
||||||
### Custom database location
|
|
||||||
|
|
||||||
The sweep only covers `/config` and `/media/frigate`. If `database.path` points somewhere else, such as a separate volume, align that directory yourself before upgrading, and again after running with `FRIGATE_RUN_AS_ROOT=true`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
chown -R 1000:1000 /path/to/your/database/dir
|
|
||||||
```
|
|
||||||
|
|
||||||
Use your `PUID` and `PGID` if you've changed them. Until the directory and its files are writable, Frigate stops at startup with an error naming the path it can't write.
|
|
||||||
|
|
||||||
### Network storage
|
### Network storage
|
||||||
|
|
||||||
Recordings on a NAS behave differently, so check what you have before migrating:
|
Recordings on a NAS behave differently, so check what you have before migrating:
|
||||||
@@ -104,7 +94,7 @@ Recordings on a NAS behave differently, so check what you have before migrating:
|
|||||||
findmnt -T /path/to/your/storage -o TARGET,FSTYPE,OPTIONS
|
findmnt -T /path/to/your/storage -o TARGET,FSTYPE,OPTIONS
|
||||||
```
|
```
|
||||||
|
|
||||||
**SMB and CIFS** don't store per-file ownership at all. It's synthesized from the mount options, so a per-file `chown` has no effect and isn't needed. Mount the share as the uid and gid Frigate runs as, and every file already looks correct to the sweep:
|
**SMB and CIFS** don't store per-file ownership at all. It's synthesized from the mount options, so a per-file `chown` fails and isn't needed. Mount the share as the uid and gid Frigate runs as, and every file already looks correct to the sweep:
|
||||||
|
|
||||||
```
|
```
|
||||||
//nas/frigate /media/frigate cifs credentials=/root/.smb,uid=1000,gid=1000,file_mode=0664,dir_mode=0775 0 0
|
//nas/frigate /media/frigate cifs credentials=/root/.smb,uid=1000,gid=1000,file_mode=0664,dir_mode=0775 0 0
|
||||||
|
|||||||
@@ -336,8 +336,6 @@ def config(request: Request):
|
|||||||
for cmd in camera_dict["ffmpeg_cmds"]:
|
for cmd in camera_dict["ffmpeg_cmds"]:
|
||||||
cmd["cmd"] = clean_camera_user_pass(" ".join(cmd["cmd"]))
|
cmd["cmd"] = clean_camera_user_pass(" ".join(cmd["cmd"]))
|
||||||
|
|
||||||
camera_dict["detect_resolution_source"] = camera.detect_resolution_source
|
|
||||||
|
|
||||||
# masking misses vendor-specific credentials in paths and args, and the
|
# masking misses vendor-specific credentials in paths and args, and the
|
||||||
# non-admin UI never reads them
|
# non-admin UI never reads them
|
||||||
if not is_admin:
|
if not is_admin:
|
||||||
|
|||||||
+12
-30
@@ -4,7 +4,6 @@ import multiprocessing as mp
|
|||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from multiprocessing import Queue
|
from multiprocessing import Queue
|
||||||
from multiprocessing.managers import DictProxy, SyncManager
|
from multiprocessing.managers import DictProxy, SyncManager
|
||||||
@@ -92,7 +91,7 @@ from frigate.timeline import TimelineProcessor
|
|||||||
from frigate.track.object_processing import TrackedObjectProcessor
|
from frigate.track.object_processing import TrackedObjectProcessor
|
||||||
from frigate.util.builtin import empty_and_close_queue
|
from frigate.util.builtin import empty_and_close_queue
|
||||||
from frigate.util.image import UntrackedSharedMemory
|
from frigate.util.image import UntrackedSharedMemory
|
||||||
from frigate.util.ownership import chown_to_runtime, find_unwritable_database_path
|
from frigate.util.ownership import chown_to_runtime
|
||||||
from frigate.util.process import FrigateProcess
|
from frigate.util.process import FrigateProcess
|
||||||
from frigate.util.runtime_deps import RuntimeDependencyError
|
from frigate.util.runtime_deps import RuntimeDependencyError
|
||||||
from frigate.util.services import set_file_limit
|
from frigate.util.services import set_file_limit
|
||||||
@@ -198,32 +197,8 @@ class FrigateApp:
|
|||||||
except PermissionError:
|
except PermissionError:
|
||||||
logger.error("Unable to write to /config to save DB state")
|
logger.error("Unable to write to /config to save DB state")
|
||||||
|
|
||||||
def exit_if_unwritable(paths: tuple[str, ...]) -> None:
|
|
||||||
unwritable = find_unwritable_database_path(paths)
|
|
||||||
|
|
||||||
if unwritable is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
logger.error(
|
|
||||||
"Frigate is running as uid %s, gid %s and can't write to %s. Make "
|
|
||||||
"sure it exists and is owned by that user, see "
|
|
||||||
"https://docs.frigate.video/configuration/non_root#custom-database-location",
|
|
||||||
os.getuid(),
|
|
||||||
os.getgid(),
|
|
||||||
unwritable,
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
db_path = self.config.database.path
|
|
||||||
backup_path = db_path.replace("frigate.db", "backup.db")
|
|
||||||
db_files = (db_path, f"{db_path}-wal", f"{db_path}-shm", backup_path)
|
|
||||||
|
|
||||||
# the ownership sweep covers /config and /media/frigate only, so a
|
|
||||||
# database kept elsewhere can still be owned by root after upgrading
|
|
||||||
exit_if_unwritable(db_files[:3])
|
|
||||||
|
|
||||||
# Migrate DB schema
|
# Migrate DB schema
|
||||||
migrate_db = SqliteDatabase(db_path)
|
migrate_db = SqliteDatabase(self.config.database.path)
|
||||||
|
|
||||||
# Run migrations
|
# Run migrations
|
||||||
del logging.getLogger("peewee_migrate").handlers[:]
|
del logging.getLogger("peewee_migrate").handlers[:]
|
||||||
@@ -231,8 +206,10 @@ class FrigateApp:
|
|||||||
|
|
||||||
if len(router.diff) > 0:
|
if len(router.diff) > 0:
|
||||||
logger.info("Making backup of DB before migrations...")
|
logger.info("Making backup of DB before migrations...")
|
||||||
exit_if_unwritable((backup_path,))
|
shutil.copyfile(
|
||||||
shutil.copyfile(db_path, backup_path)
|
self.config.database.path,
|
||||||
|
self.config.database.path.replace("frigate.db", "backup.db"),
|
||||||
|
)
|
||||||
|
|
||||||
router.run()
|
router.run()
|
||||||
|
|
||||||
@@ -258,7 +235,12 @@ class FrigateApp:
|
|||||||
|
|
||||||
# a root frigate service creates these as root; wal and shm recreated
|
# a root frigate service creates these as root; wal and shm recreated
|
||||||
# later in the run are realigned by the per-boot /config sweep
|
# later in the run are realigned by the per-boot /config sweep
|
||||||
for db_file in db_files:
|
for db_file in (
|
||||||
|
self.config.database.path,
|
||||||
|
f"{self.config.database.path}-wal",
|
||||||
|
f"{self.config.database.path}-shm",
|
||||||
|
self.config.database.path.replace("frigate.db", "backup.db"),
|
||||||
|
):
|
||||||
if os.path.exists(db_file):
|
if os.path.exists(db_file):
|
||||||
chown_to_runtime(db_file)
|
chown_to_runtime(db_file)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Literal
|
|
||||||
|
|
||||||
from pydantic import Field, PrivateAttr, model_validator
|
from pydantic import Field, PrivateAttr, model_validator
|
||||||
|
|
||||||
@@ -209,12 +208,6 @@ class CameraConfig(FrigateBaseModel):
|
|||||||
|
|
||||||
_ffmpeg_cmds: list[dict[str, list[str]]] = PrivateAttr()
|
_ffmpeg_cmds: list[dict[str, list[str]]] = PrivateAttr()
|
||||||
|
|
||||||
# "config" when set by the user, "probed" from the stream at startup, or
|
|
||||||
# "default" when the probe failed and the fallback size is in use
|
|
||||||
_detect_resolution_source: Literal["config", "probed", "default"] = PrivateAttr(
|
|
||||||
default="config"
|
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, **config):
|
def __init__(self, **config):
|
||||||
# Set zone colors
|
# Set zone colors
|
||||||
if "zones" in config:
|
if "zones" in config:
|
||||||
@@ -256,10 +249,6 @@ class CameraConfig(FrigateBaseModel):
|
|||||||
def ffmpeg_cmds(self) -> list[dict[str, list[str]]]:
|
def ffmpeg_cmds(self) -> list[dict[str, list[str]]]:
|
||||||
return self._ffmpeg_cmds
|
return self._ffmpeg_cmds
|
||||||
|
|
||||||
@property
|
|
||||||
def detect_resolution_source(self) -> Literal["config", "probed", "default"]:
|
|
||||||
return self._detect_resolution_source
|
|
||||||
|
|
||||||
def get_formatted_name(self) -> str:
|
def get_formatted_name(self) -> str:
|
||||||
"""Return the friendly name if set, otherwise return a formatted version of the camera name."""
|
"""Return the friendly name if set, otherwise return a formatted version of the camera name."""
|
||||||
if self.friendly_name:
|
if self.friendly_name:
|
||||||
|
|||||||
@@ -1213,11 +1213,6 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
if stream_info.get("height")
|
if stream_info.get("height")
|
||||||
else DEFAULT_DETECT_DIMENSIONS["height"]
|
else DEFAULT_DETECT_DIMENSIONS["height"]
|
||||||
)
|
)
|
||||||
camera_config._detect_resolution_source = (
|
|
||||||
"probed"
|
|
||||||
if stream_info.get("width") and stream_info.get("height")
|
|
||||||
else "default"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Warn if detect fps > 10
|
# Warn if detect fps > 10
|
||||||
if camera_config.detect.fps > 10 and camera_config.type != "lpr":
|
if camera_config.detect.fps > 10 and camera_config.type != "lpr":
|
||||||
|
|||||||
+18
-17
@@ -351,13 +351,12 @@ class OnvifController:
|
|||||||
autotracking_config.enabled_in_config and autotracking_config.enabled
|
autotracking_config.enabled_in_config and autotracking_config.enabled
|
||||||
)
|
)
|
||||||
|
|
||||||
fov_supported = (
|
# setup relative move request when FOV relative movement is supported
|
||||||
|
if (
|
||||||
fov_space_id is not None
|
fov_space_id is not None
|
||||||
and configs.DefaultRelativePanTiltTranslationSpace is not None
|
and configs.DefaultRelativePanTiltTranslationSpace is not None
|
||||||
)
|
):
|
||||||
|
# one-off GetStatus to seed Translation field
|
||||||
# relative moves are seeded from the current position
|
|
||||||
if fov_supported:
|
|
||||||
status = None
|
status = None
|
||||||
try:
|
try:
|
||||||
status = await ptz.GetStatus({"ProfileToken": profile.token})
|
status = await ptz.GetStatus({"ProfileToken": profile.token})
|
||||||
@@ -365,15 +364,6 @@ class OnvifController:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Unable to get status from camera {camera_name}: {e}")
|
logger.warning(f"Unable to get status from camera {camera_name}: {e}")
|
||||||
|
|
||||||
if status is None or status.Position is None:
|
|
||||||
logger.warning(
|
|
||||||
"Disabling relative movement for %s: camera does not report its PTZ position",
|
|
||||||
camera_name,
|
|
||||||
)
|
|
||||||
fov_supported = False
|
|
||||||
|
|
||||||
# setup relative move request when FOV relative movement is supported
|
|
||||||
if fov_supported:
|
|
||||||
rel_move_request = ptz.create_type("RelativeMove")
|
rel_move_request = ptz.create_type("RelativeMove")
|
||||||
rel_move_request.ProfileToken = profile.token
|
rel_move_request.ProfileToken = profile.token
|
||||||
logger.debug(f"{camera_name}: Relative move request: {rel_move_request}")
|
logger.debug(f"{camera_name}: Relative move request: {rel_move_request}")
|
||||||
@@ -383,8 +373,15 @@ class OnvifController:
|
|||||||
]["URI"]
|
]["URI"]
|
||||||
|
|
||||||
if rel_move_request.Translation is None:
|
if rel_move_request.Translation is None:
|
||||||
rel_move_request.Translation = status.Position
|
if status is not None:
|
||||||
rel_move_request.Translation.PanTilt.space = fov_uri
|
# seed from current position
|
||||||
|
rel_move_request.Translation = status.Position
|
||||||
|
rel_move_request.Translation.PanTilt.space = fov_uri
|
||||||
|
else:
|
||||||
|
# fallback: construct Translation explicitly
|
||||||
|
rel_move_request.Translation = {
|
||||||
|
"PanTilt": {"x": 0, "y": 0, "space": fov_uri}
|
||||||
|
}
|
||||||
|
|
||||||
# configure zoom on relative move request
|
# configure zoom on relative move request
|
||||||
if (
|
if (
|
||||||
@@ -500,7 +497,11 @@ class OnvifController:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Focus not supported for {camera_name}: {e}")
|
logger.debug(f"Focus not supported for {camera_name}: {e}")
|
||||||
|
|
||||||
if fov_supported:
|
# detect FOV relative movement support
|
||||||
|
if (
|
||||||
|
fov_space_id is not None
|
||||||
|
and configs.DefaultRelativePanTiltTranslationSpace is not None
|
||||||
|
):
|
||||||
supported_features.append("pt-r-fov")
|
supported_features.append("pt-r-fov")
|
||||||
cam["relative_fov_range"] = (
|
cam["relative_fov_range"] = (
|
||||||
ptz_config.Spaces.RelativePanTiltTranslationSpace[fov_space_id]
|
ptz_config.Spaces.RelativePanTiltTranslationSpace[fov_space_id]
|
||||||
|
|||||||
@@ -280,7 +280,6 @@ class TestHttpApp(BaseTestHttp):
|
|||||||
assert camera["ffmpeg"]["inputs"][0]["input_args"] == auth_header
|
assert camera["ffmpeg"]["inputs"][0]["input_args"] == auth_header
|
||||||
assert camera["ffmpeg"]["input_args"] == auth_header
|
assert camera["ffmpeg"]["input_args"] == auth_header
|
||||||
assert camera["ffmpeg_cmds"]
|
assert camera["ffmpeg_cmds"]
|
||||||
assert camera["detect_resolution_source"] == "config"
|
|
||||||
assert config["go2rtc"]["streams"]["front_door"][0] == secret_path
|
assert config["go2rtc"]["streams"]["front_door"][0] == secret_path
|
||||||
assert "webtorrent" in config["go2rtc"]
|
assert "webtorrent" in config["go2rtc"]
|
||||||
|
|
||||||
|
|||||||
@@ -2483,45 +2483,5 @@ class TestFfmpegPath(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestDetectResolutionSource(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.config = {
|
|
||||||
"mqtt": {"host": "mqtt"},
|
|
||||||
"cameras": {
|
|
||||||
"back": {
|
|
||||||
"ffmpeg": {
|
|
||||||
"inputs": [
|
|
||||||
{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def test_set_in_config(self):
|
|
||||||
self.config["cameras"]["back"]["detect"] = {"width": 1920, "height": 1080}
|
|
||||||
camera = FrigateConfig(**self.config).cameras["back"]
|
|
||||||
assert camera.detect_resolution_source == "config"
|
|
||||||
|
|
||||||
def test_set_globally(self):
|
|
||||||
self.config["detect"] = {"width": 1920, "height": 1080}
|
|
||||||
camera = FrigateConfig(**self.config).cameras["back"]
|
|
||||||
assert camera.detect_resolution_source == "config"
|
|
||||||
|
|
||||||
@patch(
|
|
||||||
"frigate.config.config.stream_info_retriever.get_stream_info",
|
|
||||||
return_value={"width": 2560, "height": 1440, "fourcc": "h264"},
|
|
||||||
)
|
|
||||||
def test_probed_from_stream(self, _):
|
|
||||||
camera = FrigateConfig(**self.config).cameras["back"]
|
|
||||||
assert camera.detect_resolution_source == "probed"
|
|
||||||
assert (camera.detect.width, camera.detect.height) == (2560, 1440)
|
|
||||||
|
|
||||||
def test_probe_failed_uses_default(self):
|
|
||||||
camera = FrigateConfig(**self.config).cameras["back"]
|
|
||||||
assert camera.detect_resolution_source == "default"
|
|
||||||
assert (camera.detect.width, camera.detect.height) == (1280, 720)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main(verbosity=2)
|
unittest.main(verbosity=2)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
"""Tests for runtime ownership helpers."""
|
"""Tests for runtime ownership helpers."""
|
||||||
|
|
||||||
import os
|
|
||||||
import tempfile
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
@@ -75,53 +73,5 @@ class TestChownToRuntime(unittest.TestCase):
|
|||||||
ownership.chown_to_runtime("/config/test") # must not raise
|
ownership.chown_to_runtime("/config/test") # must not raise
|
||||||
|
|
||||||
|
|
||||||
class TestFindUnwritableDatabasePath(unittest.TestCase):
|
|
||||||
def setUp(self) -> None:
|
|
||||||
tmp = tempfile.TemporaryDirectory()
|
|
||||||
self.addCleanup(tmp.cleanup)
|
|
||||||
self.db_dir = os.path.join(tmp.name, "db")
|
|
||||||
os.mkdir(self.db_dir)
|
|
||||||
# restore access so cleanup can remove the tree
|
|
||||||
self.addCleanup(os.chmod, self.db_dir, 0o755)
|
|
||||||
self.db_path = os.path.join(self.db_dir, "frigate.db")
|
|
||||||
self.db_files = (
|
|
||||||
self.db_path,
|
|
||||||
f"{self.db_path}-wal",
|
|
||||||
f"{self.db_path}-shm",
|
|
||||||
os.path.join(self.db_dir, "backup.db"),
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_writable_directory_without_database(self):
|
|
||||||
assert ownership.find_unwritable_database_path(self.db_files) is None
|
|
||||||
|
|
||||||
def test_writable_directory_and_database(self):
|
|
||||||
open(self.db_path, "w").close()
|
|
||||||
assert ownership.find_unwritable_database_path(self.db_files) is None
|
|
||||||
|
|
||||||
def test_missing_directory(self):
|
|
||||||
missing_dir = os.path.join(self.db_dir, "missing")
|
|
||||||
db_files = (os.path.join(missing_dir, "frigate.db"),)
|
|
||||||
assert ownership.find_unwritable_database_path(db_files) == missing_dir
|
|
||||||
|
|
||||||
@unittest.skipIf(os.geteuid() == 0, "root bypasses permission checks")
|
|
||||||
def test_unwritable_directory(self):
|
|
||||||
os.chmod(self.db_dir, 0o555)
|
|
||||||
assert ownership.find_unwritable_database_path(self.db_files) == self.db_dir
|
|
||||||
|
|
||||||
@unittest.skipIf(os.geteuid() == 0, "root bypasses permission checks")
|
|
||||||
def test_unwritable_database(self):
|
|
||||||
open(self.db_path, "w").close()
|
|
||||||
os.chmod(self.db_path, 0o444)
|
|
||||||
assert ownership.find_unwritable_database_path(self.db_files) == self.db_path
|
|
||||||
|
|
||||||
@unittest.skipIf(os.geteuid() == 0, "root bypasses permission checks")
|
|
||||||
def test_unwritable_backup(self):
|
|
||||||
backup = self.db_files[3]
|
|
||||||
open(self.db_path, "w").close()
|
|
||||||
open(backup, "w").close()
|
|
||||||
os.chmod(backup, 0o444)
|
|
||||||
assert ownership.find_unwritable_database_path(self.db_files) == backup
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -165,25 +165,6 @@ class TestOnvifInitRequests(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.assertTrue(await controller._init_onvif(CAMERA))
|
self.assertTrue(await controller._init_onvif(CAMERA))
|
||||||
self.assertIsNone(controller.cams[CAMERA]["video_source_token"])
|
self.assertIsNone(controller.cams[CAMERA]["video_source_token"])
|
||||||
|
|
||||||
async def test_fov_movement_requires_reported_position(self) -> None:
|
|
||||||
# cameras with StatusPosition="false" omit Position from GetStatus
|
|
||||||
for position in (MagicMock(), None):
|
|
||||||
with self.subTest(position=position):
|
|
||||||
controller = _make_controller(autotracking_enabled=False)
|
|
||||||
ptz = controller.cams[CAMERA]["onvif"].create_ptz_service.return_value
|
|
||||||
ptz_config = MagicMock()
|
|
||||||
ptz_config.Spaces.RelativePanTiltTranslationSpace = [
|
|
||||||
{"URI": "http://www.onvif.org/TranslationSpaceFov"}
|
|
||||||
]
|
|
||||||
ptz.GetConfigurationOptions = AsyncMock(return_value=ptz_config)
|
|
||||||
ptz.GetStatus = AsyncMock(return_value=MagicMock(Position=position))
|
|
||||||
|
|
||||||
self.assertTrue(await controller._init_onvif(CAMERA))
|
|
||||||
self.assertEqual(
|
|
||||||
"pt-r-fov" in controller.cams[CAMERA]["features"],
|
|
||||||
position is not None,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestManualRelativeMoveMetrics(unittest.IsolatedAsyncioTestCase):
|
class TestManualRelativeMoveMetrics(unittest.IsolatedAsyncioTestCase):
|
||||||
"""A manual move from the UI (click to move, drag to zoom) sends move_relative
|
"""A manual move from the UI (click to move, drag to zoom) sends move_relative
|
||||||
|
|||||||
@@ -45,21 +45,3 @@ def chown_to_runtime(path: str) -> None:
|
|||||||
os.chown(path, *ids)
|
os.chown(path, *ids)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
logger.warning(f"Unable to set ownership of {path}: {err}")
|
logger.warning(f"Unable to set ownership of {path}: {err}")
|
||||||
|
|
||||||
|
|
||||||
def find_unwritable_database_path(db_files: tuple[str, ...]) -> str | None:
|
|
||||||
"""Return the database directory or file the current user can't write, if any.
|
|
||||||
|
|
||||||
db_files starts with the database itself. SQLite creates its -wal and -shm
|
|
||||||
files next to it, so the directory has to be writable too.
|
|
||||||
"""
|
|
||||||
db_dir = os.path.dirname(os.path.abspath(db_files[0]))
|
|
||||||
|
|
||||||
if not os.access(db_dir, os.W_OK | os.X_OK):
|
|
||||||
return db_dir
|
|
||||||
|
|
||||||
for path in db_files:
|
|
||||||
if os.path.exists(path) and not os.access(path, os.R_OK | os.W_OK):
|
|
||||||
return path
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|||||||
@@ -52,25 +52,22 @@ export function deepMerge<T extends Record<string, unknown>>(
|
|||||||
export const BASE_CONFIG = {
|
export const BASE_CONFIG = {
|
||||||
...configSnapshot,
|
...configSnapshot,
|
||||||
version: "0.15.0-test",
|
version: "0.15.0-test",
|
||||||
// injected by the /config endpoint rather than the Pydantic model, so they
|
// injected by the /config endpoint rather than the Pydantic model, so it
|
||||||
// are absent from the snapshot, as is each camera's detect_resolution_source
|
// is absent from the snapshot
|
||||||
plus: { enabled: false },
|
plus: { enabled: false },
|
||||||
cameras: {
|
cameras: {
|
||||||
...configSnapshot.cameras,
|
...configSnapshot.cameras,
|
||||||
front_door: {
|
front_door: {
|
||||||
...configSnapshot.cameras.front_door,
|
...configSnapshot.cameras.front_door,
|
||||||
friendly_name: "Front Door",
|
friendly_name: "Front Door",
|
||||||
detect_resolution_source: "config",
|
|
||||||
},
|
},
|
||||||
backyard: {
|
backyard: {
|
||||||
...configSnapshot.cameras.backyard,
|
...configSnapshot.cameras.backyard,
|
||||||
friendly_name: "Backyard",
|
friendly_name: "Backyard",
|
||||||
detect_resolution_source: "config",
|
|
||||||
},
|
},
|
||||||
garage: {
|
garage: {
|
||||||
...configSnapshot.cameras.garage,
|
...configSnapshot.cameras.garage,
|
||||||
friendly_name: "Garage",
|
friendly_name: "Garage",
|
||||||
detect_resolution_source: "config",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,14 +57,6 @@ const EVENT_NOTICE = {
|
|||||||
muted_at: null,
|
muted_at: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// a repeated device gets a '#2' suffix, which a raw URL would cut off as a fragment
|
|
||||||
const SUFFIXED_NOTICE = {
|
|
||||||
...EVENT_NOTICE,
|
|
||||||
id: "detector_stuck:openvino:GPU#2",
|
|
||||||
scope: "openvino:GPU#2",
|
|
||||||
params: { detector: "openvino:GPU#2" },
|
|
||||||
};
|
|
||||||
|
|
||||||
test.describe("System — Health tab @medium", () => {
|
test.describe("System — Health tab @medium", () => {
|
||||||
test("Health is the default tab and lists notices by severity", async ({
|
test("Health is the default tab and lists notices by severity", async ({
|
||||||
frigateApp,
|
frigateApp,
|
||||||
@@ -103,20 +95,19 @@ test.describe("System — Health tab @medium", () => {
|
|||||||
|
|
||||||
for (const action of ["acknowledge", "mute"] as const) {
|
for (const action of ["acknowledge", "mute"] as const) {
|
||||||
test(`${action} posts and removes the row`, async ({ frigateApp }) => {
|
test(`${action} posts and removes the row`, async ({ frigateApp }) => {
|
||||||
const path = `/api/notices/${encodeURIComponent(SUFFIXED_NOTICE.id)}/${action}`;
|
|
||||||
await frigateApp.installDefaults({
|
await frigateApp.installDefaults({
|
||||||
config: RESTREAMED,
|
config: RESTREAMED,
|
||||||
stats: QUIET_STATS,
|
stats: QUIET_STATS,
|
||||||
notices: [SUFFIXED_NOTICE],
|
notices: [EVENT_NOTICE],
|
||||||
});
|
});
|
||||||
|
|
||||||
// the list shrinks after the POST so the refetch shows the row gone
|
// the list shrinks after the POST so the refetch shows the row gone
|
||||||
let hidden = false;
|
let hidden = false;
|
||||||
await frigateApp.page.route("**/api/notices", (route) =>
|
await frigateApp.page.route("**/api/notices", (route) =>
|
||||||
route.fulfill({ json: hidden ? [] : [SUFFIXED_NOTICE] }),
|
route.fulfill({ json: hidden ? [] : [EVENT_NOTICE] }),
|
||||||
);
|
);
|
||||||
await frigateApp.page.route(
|
await frigateApp.page.route(
|
||||||
(url) => url.pathname.endsWith(path),
|
`**/api/notices/detector_stuck/${action}`,
|
||||||
(route) => {
|
(route) => {
|
||||||
hidden = true;
|
hidden = true;
|
||||||
return route.fulfill({ json: { success: true } });
|
return route.fulfill({ json: { success: true } });
|
||||||
@@ -126,10 +117,11 @@ test.describe("System — Health tab @medium", () => {
|
|||||||
await frigateApp.goto("/system#health");
|
await frigateApp.goto("/system#health");
|
||||||
const request = frigateApp.page.waitForRequest(
|
const request = frigateApp.page.waitForRequest(
|
||||||
(req) =>
|
(req) =>
|
||||||
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
|
req.url().includes(`/api/notices/detector_stuck/${action}`) &&
|
||||||
|
req.method() === "POST",
|
||||||
);
|
);
|
||||||
await frigateApp.page
|
await frigateApp.page
|
||||||
.getByTestId(`health-problem-notice:${SUFFIXED_NOTICE.id}`)
|
.getByTestId("health-problem-notice:detector_stuck")
|
||||||
.getByRole("button", {
|
.getByRole("button", {
|
||||||
name: action === "mute" ? "Mute" : "Acknowledge",
|
name: action === "mute" ? "Mute" : "Acknowledge",
|
||||||
exact: true,
|
exact: true,
|
||||||
@@ -272,9 +264,8 @@ test.describe("System — Health tab @medium", () => {
|
|||||||
url.searchParams.get("include_hidden") === "true",
|
url.searchParams.get("include_hidden") === "true",
|
||||||
(route) => route.fulfill({ json: [MUTED_NOTICE] }),
|
(route) => route.fulfill({ json: [MUTED_NOTICE] }),
|
||||||
);
|
);
|
||||||
const path = `/api/notices/${encodeURIComponent(MUTED_NOTICE.id)}/hidden`;
|
|
||||||
await frigateApp.page.route(
|
await frigateApp.page.route(
|
||||||
(url) => url.pathname.endsWith(path),
|
"**/api/notices/model_download_failed:yolo/model.onnx/hidden",
|
||||||
(route) => route.fulfill({ json: { success: true } }),
|
(route) => route.fulfill({ json: { success: true } }),
|
||||||
);
|
);
|
||||||
await frigateApp.goto("/system#health");
|
await frigateApp.goto("/system#health");
|
||||||
@@ -285,7 +276,11 @@ test.describe("System — Health tab @medium", () => {
|
|||||||
|
|
||||||
const request = frigateApp.page.waitForRequest(
|
const request = frigateApp.page.waitForRequest(
|
||||||
(req) =>
|
(req) =>
|
||||||
new URL(req.url()).pathname.endsWith(path) && req.method() === "DELETE",
|
req
|
||||||
|
.url()
|
||||||
|
.endsWith(
|
||||||
|
"/api/notices/model_download_failed:yolo/model.onnx/hidden",
|
||||||
|
) && req.method() === "DELETE",
|
||||||
);
|
);
|
||||||
await frigateApp.page
|
await frigateApp.page
|
||||||
.getByTestId(
|
.getByTestId(
|
||||||
@@ -1072,76 +1067,6 @@ test.describe("System — Health notices sources @medium", () => {
|
|||||||
).toHaveCount(0);
|
).toHaveCount(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("a camera on the fallback detect resolution is flagged", async ({
|
|
||||||
frigateApp,
|
|
||||||
}) => {
|
|
||||||
await frigateApp.installDefaults({
|
|
||||||
config: { cameras: { garage: { detect_resolution_source: "default" } } },
|
|
||||||
stats: QUIET_STATS,
|
|
||||||
});
|
|
||||||
await frigateApp.goto("/system#health");
|
|
||||||
|
|
||||||
const row = frigateApp.page.getByTestId(
|
|
||||||
"health-problem-config:detect:detect-resolution-not-probed:camera.garage",
|
|
||||||
);
|
|
||||||
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
||||||
await expect(row).toHaveAttribute("data-severity", "warning");
|
|
||||||
await expect(
|
|
||||||
frigateApp.page.getByTestId(
|
|
||||||
"health-problem-config:detect:detect-resolution-not-probed:camera.front_door",
|
|
||||||
),
|
|
||||||
).toHaveCount(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("an unprobeable resolution is only flagged when Frigate must probe it", async ({
|
|
||||||
frigateApp,
|
|
||||||
}) => {
|
|
||||||
const noSize = [
|
|
||||||
{
|
|
||||||
return_code: 0,
|
|
||||||
stderr: "",
|
|
||||||
stdout: {
|
|
||||||
streams: [
|
|
||||||
{ codec_type: "video", codec_name: "h264" },
|
|
||||||
{ codec_type: "audio", codec_name: "aac" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
await frigateApp.installDefaults({
|
|
||||||
config: {
|
|
||||||
cameras: {
|
|
||||||
backyard: { detect_resolution_source: "probed" },
|
|
||||||
front_door: { detect_resolution_source: "default" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ffprobe: { backyard: noSize, front_door: noSize, garage: noSize },
|
|
||||||
stats: QUIET_STATS,
|
|
||||||
});
|
|
||||||
await frigateApp.goto("/system#health");
|
|
||||||
|
|
||||||
await frigateApp.page
|
|
||||||
.getByRole("button", { name: "Run stream checks" })
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
frigateApp.page.getByTestId(
|
|
||||||
"health-problem-stream:backyard:0:resolution-unknown",
|
|
||||||
),
|
|
||||||
).toBeVisible({ timeout: 15_000 });
|
|
||||||
await expect(
|
|
||||||
frigateApp.page.getByTestId(
|
|
||||||
"health-problem-stream:garage:0:resolution-unknown",
|
|
||||||
),
|
|
||||||
).toHaveCount(0);
|
|
||||||
// the startup probe's own row already covers this camera
|
|
||||||
await expect(
|
|
||||||
frigateApp.page.getByTestId(
|
|
||||||
"health-problem-stream:front_door:0:resolution-unknown",
|
|
||||||
),
|
|
||||||
).toHaveCount(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("wizard-only Reolink advice stays off the tab", async ({
|
test("wizard-only Reolink advice stays off the tab", async ({
|
||||||
frigateApp,
|
frigateApp,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -1356,14 +1281,10 @@ test.describe("System — Health notices sources @medium", () => {
|
|||||||
|
|
||||||
// the list gains the mute after the POST so the refetch hides the row
|
// the list gains the mute after the POST so the refetch hides the row
|
||||||
let muted = false;
|
let muted = false;
|
||||||
const path = `/api/notices/${encodeURIComponent(id)}/mute`;
|
await frigateApp.page.route(`**/api/notices/${id}/mute`, (route) => {
|
||||||
await frigateApp.page.route(
|
muted = true;
|
||||||
(url) => url.pathname.endsWith(path),
|
return route.fulfill({ json: { success: true } });
|
||||||
(route) => {
|
});
|
||||||
muted = true;
|
|
||||||
return route.fulfill({ json: { success: true } });
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await frigateApp.page.route("**/api/notices/muted_checks", (route) =>
|
await frigateApp.page.route("**/api/notices/muted_checks", (route) =>
|
||||||
route.fulfill({ json: muted ? [{ id, muted_at: NOW }] : [] }),
|
route.fulfill({ json: muted ? [{ id, muted_at: NOW }] : [] }),
|
||||||
);
|
);
|
||||||
@@ -1376,7 +1297,8 @@ test.describe("System — Health notices sources @medium", () => {
|
|||||||
);
|
);
|
||||||
const request = frigateApp.page.waitForRequest(
|
const request = frigateApp.page.waitForRequest(
|
||||||
(req) =>
|
(req) =>
|
||||||
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
|
req.url().includes(`/api/notices/${id}/mute`) &&
|
||||||
|
req.method() === "POST",
|
||||||
);
|
);
|
||||||
await row.getByRole("button", { name: "Mute", exact: true }).click();
|
await row.getByRole("button", { name: "Mute", exact: true }).click();
|
||||||
await request;
|
await request;
|
||||||
|
|||||||
@@ -2028,7 +2028,6 @@
|
|||||||
},
|
},
|
||||||
"detect": {
|
"detect": {
|
||||||
"fpsGreaterThanFive": "Setting the detect FPS higher than 5 is not recommended. Higher values may cause performance issues and will not provide any benefit.",
|
"fpsGreaterThanFive": "Setting the detect FPS higher than 5 is not recommended. Higher values may cause performance issues and will not provide any benefit.",
|
||||||
"resolutionNotProbed": "Frigate could not probe the resolution of this camera's detect stream, so it is using a default of 1280x720, which may not match the camera. Set the detect width and height to match the stream.",
|
|
||||||
"disabled": "Object detection is disabled. Snapshots, review items, and enrichments such as face recognition, license plate recognition, and Generative AI will not function.",
|
"disabled": "Object detection is disabled. Snapshots, review items, and enrichments such as face recognition, license plate recognition, and Generative AI will not function.",
|
||||||
"runtimeDisabled": "Object detection is enabled in your config, but it is currently turned off for this camera. Snapshots, review items, and enrichments such as face recognition, license plate recognition, and Generative AI will not function until it is turned back on from the camera's live view, or until the active profile stops disabling it.",
|
"runtimeDisabled": "Object detection is enabled in your config, but it is currently turned off for this camera. Snapshots, review items, and enrichments such as face recognition, license plate recognition, and Generative AI will not function until it is turned back on from the camera's live view, or until the active profile stops disabling it.",
|
||||||
"sceneWithoutModel": "No detection model is configured for this scene, so this camera falls back to the Default model. Add a model for this scene to give the camera its own.",
|
"sceneWithoutModel": "No detection model is configured for this scene, so this camera falls back to the Default model. Add a model for this scene to give the camera its own.",
|
||||||
|
|||||||
@@ -18,17 +18,6 @@ const detect: SectionConfigOverrides = {
|
|||||||
condition: (ctx) =>
|
condition: (ctx) =>
|
||||||
ctx.level === "camera" && ctx.formData?.enabled === false,
|
ctx.level === "camera" && ctx.formData?.enabled === false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: "detect-resolution-not-probed",
|
|
||||||
health: true,
|
|
||||||
messageKey: "configMessages.detect.resolutionNotProbed",
|
|
||||||
severity: "warning",
|
|
||||||
// profiles hide width and height
|
|
||||||
condition: (ctx) =>
|
|
||||||
ctx.level === "camera" &&
|
|
||||||
!ctx.profileName &&
|
|
||||||
ctx.fullCameraConfig?.detect_resolution_source === "default",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
fieldMessages: [
|
fieldMessages: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export function useHealthProblems(
|
|||||||
|
|
||||||
const muteCheck = useCallback(
|
const muteCheck = useCallback(
|
||||||
async (id: string) => {
|
async (id: string) => {
|
||||||
await axios.post(`notices/${encodeURIComponent(id)}/mute`);
|
await axios.post(`notices/${id}/mute`);
|
||||||
mutateMutedChecks();
|
mutateMutedChecks();
|
||||||
},
|
},
|
||||||
[mutateMutedChecks],
|
[mutateMutedChecks],
|
||||||
@@ -66,7 +66,7 @@ export function useHealthProblems(
|
|||||||
|
|
||||||
const unmuteCheck = useCallback(
|
const unmuteCheck = useCallback(
|
||||||
async (id: string) => {
|
async (id: string) => {
|
||||||
await axios.delete(`notices/${encodeURIComponent(id)}/hidden`);
|
await axios.delete(`notices/${id}/hidden`);
|
||||||
mutateMutedChecks();
|
mutateMutedChecks();
|
||||||
},
|
},
|
||||||
[mutateMutedChecks],
|
[mutateMutedChecks],
|
||||||
|
|||||||
@@ -60,17 +60,15 @@ export function useNotices(showHidden: boolean) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const acknowledge = useCallback(
|
const acknowledge = useCallback(
|
||||||
(id: string) =>
|
(id: string) => act(axios.post(`notices/${id}/acknowledge`)),
|
||||||
act(axios.post(`notices/${encodeURIComponent(id)}/acknowledge`)),
|
|
||||||
[act],
|
[act],
|
||||||
);
|
);
|
||||||
const mute = useCallback(
|
const mute = useCallback(
|
||||||
(id: string) => act(axios.post(`notices/${encodeURIComponent(id)}/mute`)),
|
(id: string) => act(axios.post(`notices/${id}/mute`)),
|
||||||
[act],
|
[act],
|
||||||
);
|
);
|
||||||
const unhide = useCallback(
|
const unhide = useCallback(
|
||||||
(id: string) =>
|
(id: string) => act(axios.delete(`notices/${id}/hidden`)),
|
||||||
act(axios.delete(`notices/${encodeURIComponent(id)}/hidden`)),
|
|
||||||
[act],
|
[act],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ export interface FaceRecognitionConfig {
|
|||||||
export type SearchModel = "jinav1" | "jinav2" | (string & NonNullable<unknown>);
|
export type SearchModel = "jinav1" | "jinav2" | (string & NonNullable<unknown>);
|
||||||
export type SearchModelSize = "small" | "large";
|
export type SearchModelSize = "small" | "large";
|
||||||
|
|
||||||
export type DetectResolutionSource = "config" | "probed" | "default";
|
|
||||||
|
|
||||||
export type LiveTranscodeQuality = {
|
export type LiveTranscodeQuality = {
|
||||||
height: number;
|
height: number;
|
||||||
bitrate: number;
|
bitrate: number;
|
||||||
@@ -118,7 +116,6 @@ export interface CameraConfig {
|
|||||||
cmd: string;
|
cmd: string;
|
||||||
roles: string[];
|
roles: string[];
|
||||||
}[];
|
}[];
|
||||||
detect_resolution_source?: DetectResolutionSource;
|
|
||||||
live: {
|
live: {
|
||||||
height: number;
|
height: number;
|
||||||
quality: number;
|
quality: number;
|
||||||
|
|||||||
@@ -58,10 +58,6 @@ export function streamHealth(
|
|||||||
checked += 1;
|
checked += 1;
|
||||||
const link = `/settings?page=cameraFfmpeg&camera=${encodeURIComponent(name)}`;
|
const link = `/settings?page=cameraFfmpeg&camera=${encodeURIComponent(name)}`;
|
||||||
const copiesAudio = recordCopiesAudio(camera);
|
const copiesAudio = recordCopiesAudio(camera);
|
||||||
// a set resolution needs no probe, and a failed startup probe has its own row
|
|
||||||
const resolutionCovered =
|
|
||||||
camera.detect_resolution_source === "config" ||
|
|
||||||
camera.detect_resolution_source === "default";
|
|
||||||
let flagged = false;
|
let flagged = false;
|
||||||
|
|
||||||
if (check.error) {
|
if (check.error) {
|
||||||
@@ -129,8 +125,7 @@ export function streamHealth(
|
|||||||
(issue): issue is StreamIssue & { type: "warning" | "error" } =>
|
(issue): issue is StreamIssue & { type: "warning" | "error" } =>
|
||||||
issue.type !== "good" &&
|
issue.type !== "good" &&
|
||||||
!WIZARD_ONLY_RULES.has(issue.rule) &&
|
!WIZARD_ONLY_RULES.has(issue.rule) &&
|
||||||
(issue.rule !== "audio-codec-record" || copiesAudio) &&
|
(issue.rule !== "audio-codec-record" || copiesAudio),
|
||||||
(issue.rule !== "resolution-unknown" || !resolutionCovered),
|
|
||||||
)
|
)
|
||||||
.forEach((issue) => {
|
.forEach((issue) => {
|
||||||
flagged = true;
|
flagged = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user