Compare commits

..
136 Commits
Author SHA1 Message Date
Josh Hawkins 6965c2592b avoid opencv path leak on recurring image writes
OpenCV 4.11's Python bindings keep a reference to every path string passed to cv2.imwrite or cv2.imread (opencv/opencv#28047, fixed in 4.13, which needs numpy 2). Callers that write on every frame or event leaked one string per call for the life of the process, about 8 MB a day from preview frames on two cameras. New write_image and read_image helpers encode and decode in memory and do the file I/O through numpy, so OpenCV never sees the path. Preview frames, review and event thumbnails, face and classification training attempts, and the offline preview frame read now use them.
2026-11-29 11:41:42 -06:00
Josh Hawkins 467b906c2f free tracker state when an object is deregistered
deregister() removed the object from tracked_objects, disappeared and track_id_map but left its entries in positions, stationary_box_history and the stationary classifier's four per-object dicts, including a 96x96 anchor crop for every object that went stationary. Every object tracked since the camera process started stayed in memory. deregister() now pops those entries and calls a new StationaryMotionClassifier.forget() to clear the classifier's state.
2026-11-29 11:41:16 -06:00
Josh Hawkins 140680215b don't strip the fallback detect size when cloning 2026-11-28 18:30:43 -06:00
Josh Hawkins 63807d753c track where each camera's detect resolution came from
The health tab's stream check told users to set the detect resolution whenever a probe returned no size, even when they had already set it, and a camera running on the 1280x720 fallback after a failed startup probe was never flagged unless the stream check was run by hand. The config now records whether the resolution came from the config, a startup probe, or the fallback, and /api/config exposes it per camera. The stream check skips the probe warning when the resolution is set, a camera on the fallback gets a detect settings warning that also shows on the health tab, and cloning detect from a fallback camera no longer copies the fallback size.
2026-11-28 18:20:38 -06:00
Josh Hawkins bd90051a15 add note about explicit detect resolution 2026-11-28 15:54:44 -06:00
Josh Hawkins fc3ace56c6 stop at startup when the database location isn't writable
The ownership sweep only covers /config and /media/frigate, so a database.path on another volume stayed root-owned after upgrading and Frigate boot-looped on a SQLite error. Frigate now checks the database directory and files before opening them and exits with an error naming the path, the runtime uid/gid, and the new docs section. backup.db is checked only when a migration is about to write it.
2026-11-28 13:24:02 -06:00
Josh Hawkins 48d15f44cd disable relative movement when the camera doesn't report its position 2026-11-28 07:00:20 -06:00
Josh Hawkins c05f76c859 don't seed relative move translation from a status without position 2026-11-28 06:53:29 -06:00
Josh Hawkins 19a212dfb1 re-sweep a replaced media volume despite the ownership sentinel
The boot sweep skipped whenever the sentinel in /config matched, so wiping or swapping /media/frigate while keeping the config volume left the new root-owned folder unswept and Frigate failed to create /media/frigate/recordings. The sentinel is now honored only when each volume root is still owned by the runtime user. Filesystems that accept chown without applying it (CIFS without setuids) get an unmanaged sentinel after a clean sweep so they don't re-sweep on every boot.
2026-11-27 07:09:53 -06:00
Josh Hawkins 8c773c2e2e encode notice ids in notice action urls
Notice ids went into the URL raw, so a detector on a repeated device like openvino:GPU#2 had everything after the # dropped as a fragment. The acknowledge, mute, and unhide requests 404'd and the buttons did nothing. The hooks now encode the id.
2026-11-26 06:56:17 -06:00
Josh HawkinsandGitHub 8eaae4b514 calculate dropped frames notice like skipped detections (#25093)
CI / ARM Build (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
The object_processing_behind notice fired after 5 dropped frames in 30 seconds per camera, which doesn't scale with detect fps, tripped on a single short stall, and never resolved. Camera processes now track a dropped frame rate, exposed as dropped_fps and dropped_pct in /api/stats, and the stats emitter raises one system notice when drops stay at or above 5% for over a minute, the same rule as skipped detections. The queue hand-off uses put_nowait so a camera that loses the race for the last slot counts a drop instead of blocking and showing up as skipped frames. Also adds a troubleshooting section to the cpu docs explaining the notice.
2026-11-25 08:16:51 -07:00
Josh HawkinsandGitHub 717f623b74 pin third-party actions and scope workflow tokens (#25094)
easimon/maximize-build-space ran from a branch, and the lowercase and manifest actions ran from mutable tags, inside jobs that push images and mint build attestations. The release workflow also ran skopeo from its latest tag with the push credential mounted. The actions are now pinned to commit SHAs with version comments so Dependabot still bumps them, the lowercase action is replaced with ${GITHUB_REPOSITORY,,}, and skopeo is pinned by digest. ci.yml, release.yml, pull_request.yml and stale.yml now declare explicit token permissions instead of relying on the repository default.
2026-11-25 08:16:02 -07:00
Josh HawkinsandGitHub b213d1e73c Nginx listen and cache header fixes (#25092)
* only add the ipv6 listener for wildcard listen addresses

With IPv6 enabled, nginx also listened on [::] for both ports regardless of the configured listen address, so an internal port bound to 127.0.0.1 or [::1] was still reachable on every IPv6 address, and a [::]:port value rendered a duplicate listen that kept nginx from starting. The [::] listener is now added only for a bare port, *:port or 0.0.0.0:port, and a specific address binds only that address.

* mark authorized media responses private in nginx
2026-11-25 07:40:26 -07:00
Josh HawkinsandGitHub fd35f4a48f Skip deleted users in push subscription cleanup (#25084)
* skip deleted users when cleaning up expired push subscriptions

Cleaning up expired push subscriptions raised DoesNotExist when the user had been deleted, so the expired list never reset, other users' dead endpoints were never pruned, and every later alert logged a traceback until restart. Cleanup now skips missing users and malformed stored tokens, and swaps the expired list out under a lock shared with the sender thread so the two no longer race.

* serialize push subscription cleanup and test malformed tokens
2026-11-25 05:08:14 -07:00
Josh HawkinsandGitHub ba5b52ec47 Tighten media and review access (#25083)
* deny admin-only media to viewer

The media auth check allowed any role without a camera list before it looked at admin-only paths, so viewer could list and download the face library, classification train and dataset images, and GenAI request frames from /clips/ even though the matching API routes and UI pages are admin-only. Admin-only paths are now denied to every non-admin role before that check.

* admin-only frigate+ frame upload

the UI already hides this so this is just to fix the endpoint

* scope review lookup by event id to allowed cameras

The review lookup by event id matched the id with GLOB, so wildcard characters in the id matched other ids, and the camera check ran on whichever row matched first, returning a 403 that named a camera the user can't access. The id now matches literally and the query only searches the user's allowed cameras, so a review item on another camera returns the same 404 as a missing one.

* fix test
2026-11-25 05:07:34 -07:00
Josh HawkinsandGitHub 08dcb63a9b Boot ownership and device grant fixes (#25085)
* fix boot sentinel and usb device grant edge cases

- Exclude /config/.permissions_version from every fix-ownership sweep. The granular root per-boot /config sweep ran without --sentinel and chowned the root-owned sentinel to PUID, so safe-sentinel rejected it on the next boot and /config and /media/frigate were fully re-swept on every boot
- Only grant real directories and char devices under /dev/bus/usb, and pass -P when setting the default ACLs, so a symlink in a host-backed usb tree is never followed by root
- Open the sentinel with O_NONBLOCK on read so a FIFO at that path fails the regular-file check instead of hanging the boot
- Assert in CI that the sentinel stays root-owned across a granular restart and that a symlink under /dev/bus/usb is not followed

* tweak ci
2026-11-25 05:06:48 -07:00
Josh HawkinsandGitHub 304dd6dda8 Resolve placeholders against saved environment_vars (#25086)
* resolve config placeholders against the saved environment_vars

Validating a saved config resolved {FRIGATE_*} placeholders against the environment_vars block from startup instead of the block being saved, so a newly added variable was reported as undefined and a removed one passed validation and then failed at the next start. The go2rtc stream check had the same problem and also skipped any source whose text was unchanged, even when its placeholder value changed. Config parses that don't install the block now resolve against the candidate's own environment_vars, and the go2rtc stream check does the same and only skips an unchanged source when it still resolves to the same value.

* fix

* match masked camera paths with the running config's environment_vars

Matching a masked path under both the startup and saved environment_vars could pick the wrong input when a saved but unapplied change made two hosts collide, so a role swap saved one input's path for both. Saved paths now resolve only with the block the running config was built from, which is what /config showed.
2026-11-25 05:05:19 -07:00
Josh HawkinsandGitHub e71f1d38aa Remove event retain (#25061)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* remove event retain and retain_indefinitely

Retaining an event only protected its footage during low-disk cleanup, and cleanup undid that a cycle later: it marked every event in the deleted time window as having no clip, including retained events it had kept, so the next pass deleted their footage. The UI hasn't set the flag in many versions and exports are the supported way to keep footage, so this removes the /events/{event_id}/retain endpoints, the favorites filter and the retain_indefinitely column. Storage cleanup is now a single oldest-first pass. Migration 007 now adds the column with raw SQL because add_fields put the field back on the Event model in the process that ran migrations, which broke inserts after 041 dropped it on fresh installs.

* remove leftover retain_indefinitely from event cleanup test
2026-11-24 08:22:35 -06:00
Josh HawkinsandGitHub ea06c1c407 Miscellaneous fixes (#25080)
* fix media auth for trigger thumbnails and sub-stream recordings, fix trigger notification image

- Restricted roles got a 403 on their own cameras' trigger thumbnails and sub-stream recordings because /clips/triggers/{camera} had no classifier branch and {camera}@sub folders resolved to a camera name no allow-list contains. Trigger thumbnails now resolve like thumbs and previews, and the @sub suffix is stripped from the recording camera.
- Trigger push notifications pointed at a trigger thumbnail named after the triggering event, but those files are named after the trigger's reference event, so the image never loaded. The notification now uses the triggering event's thumbnail through the event thumbnail API.
- Media sync only scanned .jpg export thumbnails, so orphaned .webp thumbnails from current exports were never reclaimed. It now scans both.

* restore model bindings in media sync test, add test module docstrings
2026-11-24 07:13:00 -07:00
Blake BlackshearGitHubfrigate-agents[bot] <356735177+frigate-agents[bot]@users.noreply.github.com>Claude Opus 5.5
2b4b1fdb8e Plus rate limit handling (#25075)
* Raise a rate limit error when Frigate+ returns 429

The shared session's urllib3 Retry honored Retry-After by default, so a
429 on a GET or PUT blocked the calling thread for up to ten times the
requested wait (and fell back to exponential backoff for Retry-After: 0)
before failing with a generic error.

Stop honoring Retry-After in urllib3 and raise PlusRateLimitError with
the parsed wait instead. Retry-After is parsed as either delay-seconds or
an HTTP date per RFC 9110. While the wait is in effect, further requests
are refused locally rather than sent to Frigate+ again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Don't save a failed Frigate+ model download as the model

The model download never checked the response status, so an error body
(a 429 from the download host, for example) was written to the model
cache. Only the file's existence is checked on later starts, so the
error page was loaded as the model from then on.

Raise a config error instead of writing the file, and explain a Frigate+
rate limit at startup with how long to wait when it is known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Report a rate limited Frigate+ key validation

A 429 while validating the API key was reported as "unreachable". Add a
rate_limited status that records the Retry-After wait, skip asking the
server again while that wait is in effect, and include the remaining
seconds in the /plus/validate response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Return 429 from the API when Frigate+ is rate limiting

Submitting an event, frame, or false positive reported a rate limit as a
generic 400 upload error, and listing models failed with a 500. Return a
429 with the wait in retry_after and the Retry-After header so the UI can
tell the user how long to wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Show Frigate+ rate limits in the UI

Tell the user Frigate+ is rate limiting requests, and how long to wait
when the server said, instead of a generic failure:

- submitting a tracked object or false positive (explore and the review
  dialog), a frame from the player, or a frame from tracking details
- validating the API key in Frigate+ settings
- the Frigate+ model list in detection model settings and the setup
  wizard

The frame upload from the player also showed failures with a success
toast, and since axios rejects on error statuses it never reached that
branch at all, so failed uploads showed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Let a failed Frigate+ annotation be retried

send_to_plus saved plus_id as soon as the image uploaded, so when the
annotation then failed (a rate limit, for example) every retry was
refused with "Already submitted to plus" and the image stayed without
its annotation.

Keep the uploaded image id in the event's data until the annotation
succeeds, and only then set plus_id. A retry reuses that image instead
of uploading it again, and since plus_id is still unset the UI already
offers the retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the longest Frigate+ wait when replies overlap

Requests to Frigate+ run on several threads. When two were refused at
once, a reply with a shorter Retry-After that was handled last replaced
the longer wait, so requests were sent again before Frigate+ allowed it.

Only move the deadline later, under a lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Include days in Frigate+ rate limit waits

formatSecondsToDuration only formats hours, minutes and seconds, so a
wait of a day or more lost its days: 90000 seconds read as "1 hour".
Format the wait from whole days down instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the Frigate+ rate limit lock out of the client

The config holds the Frigate+ client and is pickled to start worker
processes from the forkserver. The lock added to PlusApi can't be
pickled, so worker startup failed with "cannot pickle '_thread.lock'
object", with or without a Frigate+ key.

Use a module level lock instead. Rate limit state is per process, so one
lock per process is all that's needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: frigate-agents[bot] <356735177+frigate-agents[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 07:12:34 -07:00
Josh HawkinsandGitHub f45fae1ef5 Limit data sent to non-admin users (#25063)
* limit config, stream, stats, and metrics data for non-admin users

Non-admin users received data they never use in the UI: credentials embedded in camera paths, ffmpeg args, and go2rtc settings that the masking regex missed, process command lines over the websocket stats topic, every camera's metrics, and custom classification names for objects their cameras don't track.

- /config drops input paths, ffmpeg args, ffmpeg_cmds, webui_url, genai base_url and provider_options, and go2rtc sections other than stream names and webrtc for non-admins, and redacts profile notification emails
- /go2rtc/streams returns only producer medias to non-admins
- websocket and REST stats share one helper that strips cmdline and bandwidth_usages for non-admins
- /metrics requires admin
- custom classification categories only attach to labels the allowed cameras track

* trim go2rtc stream metadata types to producer medias
2026-11-24 06:35:56 -07:00
Josh HawkinsandGitHub 50b976889b Harden chat tool approvals (#25062)
* use server-generated tool call ids and drop remote images from chat messages

Chat write-tool approvals were keyed by the provider's tool call id, but Gemini uses the function name as the id and Ollama falls back to call_0, call_1, so a later or repeated write call in the same request reused an earlier approval and ran without a prompt. Each tool call the model returns now gets a unique server-generated id, and the Gemini plugin resolves a tool result's function name from the assistant's tool calls instead of from the id. Client message content now keeps only text parts and data:image/ image parts, so OpenAI-compatible servers and llama-server are never handed a remote URL to fetch.

* remove client image filter from chat messages
2026-11-24 06:35:19 -07:00
Josh HawkinsandGitHub 212ebca746 Tighten proxy role resolution (#25064)
* deny proxy users whose role can't be resolved instead of falling back to viewer

Proxy role resolution fell back to viewer, which grants every camera, in several accidental cases. A default_role that was misspelled, null, or named a deleted role became viewer. A role_map group whose mapped role had been deleted (for example, emptied by a camera delete) got the default role. Direct role headers were lowercased but compared to case-sensitive role names, so a custom role like Garage never matched, and a custom role named Admin resolved to the built-in admin.

- match header values, default_role and role_map roles against configured roles regardless of case
- deny when default_role or a matched role_map role doesn't exist, and warn at config load for an unknown default_role
- reserve admin and viewer in every casing and reject role names that differ only by case, in config validation and the Create Role dialog
- show a null default_role as none in the settings widget

* normalize a null proxy default_role to none

/config drops null fields, so the settings form filled in viewer for a null default_role while /auth denied those users. The config now stores a null default_role as none, which the API returns and the widget shows, and the unreachable null branch in the widget is removed.
2026-11-24 06:34:46 -07:00
Josh HawkinsandGitHub 4554b93cbe normalize whitespace in custom export ffmpeg args (#25065)
The custom export validator tokenized args on any whitespace, but the export command was built by splitting on single spaces, so repeated spaces, tabs, or newlines produced a different argv than the one that was validated. The exporter now rejoins custom args with single spaces so ffmpeg receives exactly the tokens the validator checked.
2026-11-24 06:34:10 -07:00
Josh HawkinsandGitHub 952ff4a076 Match preview frames to exact camera (#25067)
* match preview frames to the exact camera

Current-hour preview frames were selected with a "preview_{camera}-" prefix match, so a camera whose name extends another with "-" (front and front-door, cam and cam-2) had its frames included in the other camera's frame listing, preview GIF and MP4, and preview export. The frames listing, the GIF and MP4 routes, and the preview export now filter with is_camera_preview_frame.

* start preview frame tests ahead of now
2026-11-24 06:22:34 -07:00
Josh HawkinsandGitHub 764ab2c4f0 remove a deleted camera's recordings from disk (#25071)
Camera delete removed RECORD_DIR/<camera> and CLIPS_DIR/<camera>, but recordings live under RECORD_DIR/<date>/<hour>/<camera>, so the camera's segments stayed on disk after their rows were deleted and nothing reclaimed them. Neither path holds per-camera data, so they only matched when a camera name collided with something else, like a classification model's dataset, the thumbs or faces folders, or a date-named recordings folder. Delete now removes the <camera> and <camera>@sub folders under each recordings hour, plus the camera's thumbs, previews, lpr, and triggers folders.
2026-11-24 06:20:33 -07:00
Josh HawkinsandGitHub 18bc2c6570 Event cleanup fixes (#25072)
* keep event cleanup running and fix storage usage keys

- Event cleanup ran with no exception handling inside its loop, so one error (a camera added or removed while it iterated the shared cameras dict, a DB error, a thumbnail unlink failure) ended event and snapshot retention until restart. Each cycle is now guarded, camera iterations use a snapshot, and thumbnail unlink errors are caught
- Camera keys were captured once at startup, so a camera added at runtime also matched the removed-camera branch and its events could expire early under the global retention. The keys are refreshed each cycle and the removed-camera label cache resets when they change
- Clip expiry had no has_clip filter and redid every past expiration each cycle. The queries now skip events already expired, and the dead clip unlink block is removed
- Storage usage was keyed by friendly name, so cameras sharing one merged into a single row. It is keyed by camera id and the storage graph resolves the display name

* docstring
2026-11-24 06:19:52 -07:00
Josh HawkinsandGitHub 12da604820 fix birdseye runtime toggles, debug replay teardown, and stale export config (#25073)
- Keep the Birdseye restream flag from startup so enabling restream at runtime no longer writes a buffer that was never created and crashes the output loop
- Clear a runtime-disabled camera's Birdseye state once instead of re-arming it and forcing a render on every frame
- Advance the Birdseye output time after an idle heartbeat so it sends at the configured rate
- Keep the published replay camera in each config swapped in by a settings save, and send its remove on stop, so a save during a replay no longer leaves the replay camera running after stop
- Read the live config in the debug replay auto-stop watchdog
- Skip publishing the replay camera when the session was stopped during startup
- Rename a camera named with the reserved _replay_ prefix in the camera wizard and clone dialog, since debug replay deletes that camera's data
- Update the export job manager's config on every call so exports follow config saves
2026-11-24 06:19:07 -07:00
Josh HawkinsandGitHub 8b8cede583 fix genai and classification error paths (#25077)
- Catch all httpx errors in the Ollama plugin so a dropped connection no longer ends the embeddings thread
- Strip only a trailing /v1 from the llama.cpp base_url
- Cap the timestamp top-up loop in state example generation, which looped forever on zero-length review items
- Run state example generation in a thread under the example collection lock
- Stage example frames in a system temp dir so a leftover dataset/temp folder can't become a training class
- Report face training success only after the image is written, and return 404 when the event has no face attributes or snapshot
- Move VLM watch setup inside the runner's try block, build the runner before claiming the watch slot, bound max_duration_minutes, and reject non-string labels and zones from the chat tool
2026-11-24 06:18:02 -07:00
Josh HawkinsandGitHub 08d693964b catch onvif errors in preset and zoom moves and default the video source token (#25078)
GotoPreset, ContinuousMove and AbsoluteMove had no error handling, so a fault left the camera marked active and the exception ended the autotracker's maintenance thread or that camera's move queue. They now log and clear the active flag like the other movers. Init also raised a KeyError when GetVideoSources returned an empty list, because the token was only set on a non-empty result or an exception. It now defaults to None.
2026-11-24 06:15:35 -07:00
Josh HawkinsandGitHub 7c33f86daf release model download waiters when a download or its lock fails (#25079)
A download that raised or a lock that timed out ended the downloader thread before download_complete was set, so every wait_for_download() caller blocked forever and the file stayed marked as downloading. The thread now always sets download_complete and stops its requestor, and a lock failure reports the download failure notice and error state like a failed download.
2026-11-24 06:13:36 -07:00
Josh HawkinsandGitHub 6c4311988b TLS renewal and healthcheck fixes (#25081)
* hand renewed tls keys to the runtime user and time out the go2rtc healthcheck

- Renewed certbot keys were owned by root with mode 0600, so the non-root nginx couldn't read them and every certsync reload failed until the cert expired. certsync now chowns a mounted key to the runtime user before each reload, under the same conditions as the nginx startup handover
- The go2rtc healthcheck curl had no total timeout, so a go2rtc that accepted connections but never answered blocked the check forever. It now gives up after 15 s
- The TLS and non-root docs now tell read-only mount users to set the key's group and group read, which certbot keeps on renewal

* stop chowning mounted tls keys and check they're readable instead

The root chown of a mounted key followed symlinks, so a runtime user that could write the cert folder could have any root file handed to it, and the chown never covered keys renewed after startup. Frigate no longer changes ownership of mounted certs. nginx startup logs an error naming the gid when the runtime user can't read the key, and the TLS docs have users grant group read once on the host, which certbot keeps on renewal. This also drops the certsync handover added earlier on this branch.

* skip the tls key check when tls is disabled and tighten its wording

* check fullchain.pem and folder access in the tls startup check
2026-11-24 06:12:41 -07:00
Josh HawkinsandGitHub d20d6dcf72 Bound per-request work in a few endpoints (#25068)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* bound per-request work in recordings, image, password and motion search endpoints

- /recordings/unavailable walked the requested span one scale bucket at a time on the event loop, so a huge or non-finite range hung the whole API, including /auth. It now walks the gaps between recordings and rejects non-finite bounds.
- latest, mjpeg, event snapshot and recording snapshot heights are capped at the source frame height, and recording frame grabs time out after 30 s.
- Password verify and hash run in a worker thread, so a password change no longer freezes the API while PBKDF2 runs.
- Motion search collected every decoded frame of a run before detecting, up to about 190 MB per run. Frames now stream through detection, and keyframe mode stops reading at the probed keyframe count before falling back to cadence.

* keep password hashing on the event loop

* run recording deletion off the event loop
2026-11-23 14:16:43 -07:00
Josh HawkinsandGitHub 3bca9b8676 Miscellaneous fixes (#25048)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* add default filters for labels tracked at runtime

Adding a tracked label through Debug Replay or a profile left it without an object filter, so the first detection raised a KeyError in the false positive check and killed detected_frames_processor, stopping detection on every camera. Runtime objects updates now create a default filter for each tracked label that lacks one, the same as startup.

* fix nginx header inheritance and ws proxy path

Locations that include auth_request.conf declare their own add_header lines, so nginx dropped the server-level nosniff and Referrer-Policy headers on /recordings/, /exports/, /ws, /live/*, and several /api/ routes. auth_request.conf now includes security_headers.conf itself, and the duplicate includes in /vod/, /stream/, /clips/, and /api/ are removed. The /ws proxy_pass no longer carries a trailing slash, so nginx forwards the original path instead of rewriting /ws to /, which closes the path normalization gap gixy flagged.

* don't end push notification titles with "detected in" when there are no zones

* include audio labels in push notification titles

* use a plain anchor for the camera webui_url link

react-router 7.18.6 throws during render when a Link target looks like a scheme URL but isn't scheme://, so a malformed webui_url such as http:/192.168.1.5 (which the camera form accepts) crashed the object debug view into the route error boundary. A plain anchor renders any value, and a URL with a leading space no longer becomes a relative link.

* catch all OSErrors when moving the preview restart cache
2026-11-23 07:02:15 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
8c88754664 Bump the web-minor-patch group in /web with 18 updates (#25054)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
Bumps the web-minor-patch group in /web with 18 updates:

| Package | From | To |
| --- | --- | --- |
| [@hookform/resolvers](https://github.com/react-hook-form/resolvers) | `7.0.6` | `7.0.7` |
| [apexcharts](https://github.com/apexcharts/apexcharts.js) | `8.8.1` | `8.9.1` |
| [framer-motion](https://github.com/motiondivision/motion) | `14.12.0` | `14.14.0` |
| [i18next](https://github.com/i18next/i18next) | `27.1.1` | `27.2.2` |
| [i18next-http-backend](https://github.com/i18next/i18next-http-backend) | `4.0.10` | `4.1.0` |
| [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) | `1.72.0` | `1.76.0` |
| [react-apexcharts](https://github.com/apexcharts/react-apexcharts) | `2.2.0` | `2.2.1` |
| [react-dropzone](https://github.com/react-dropzone/react-dropzone) | `20.2.0` | `20.2.1` |
| [react-i18next](https://github.com/i18next/react-i18next) | `18.0.1` | `18.0.3` |
| [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) | `7.18.5` | `7.18.6` |
| [scroll-into-view-if-needed](https://github.com/scroll-into-view/scroll-into-view-if-needed) | `3.2.0` | `3.2.1` |
| [tailwind-merge](https://github.com/dcastil/tailwind-merge/tree/HEAD/packages/tailwind-merge) | `2.6.1` | `2.6.2` |
| [virtua](https://github.com/inokawa/virtua) | `0.54.2` | `0.55.0` |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.65.0` | `1.65.1` |
| [eslint](https://github.com/eslint/eslint) | `10.14.0` | `10.15.0` |
| [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) | `0.5.7` | `0.5.8` |
| [postcss](https://github.com/postcss/postcss) | `8.5.32` | `8.5.33` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.72.2` | `8.73.0` |


Updates `@hookform/resolvers` from 7.0.6 to 7.0.7
- [Release notes](https://github.com/react-hook-form/resolvers/releases)
- [Commits](https://github.com/react-hook-form/resolvers/compare/v7.0.6...v7.0.7)

Updates `apexcharts` from 8.8.1 to 8.9.1
- [Release notes](https://github.com/apexcharts/apexcharts.js/releases)
- [Commits](https://github.com/apexcharts/apexcharts.js/compare/v8.8.1...v8.9.1)

Updates `framer-motion` from 14.12.0 to 14.14.0
- [Changelog](https://github.com/motiondivision/motion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/motiondivision/motion/compare/v14.12.0...v14.14.0)

Updates `i18next` from 27.1.1 to 27.2.2
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v27.1.1...v27.2.2)

Updates `i18next-http-backend` from 4.0.10 to 4.1.0
- [Changelog](https://github.com/i18next/i18next-http-backend/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-http-backend/compare/v4.0.10...v4.1.0)

Updates `lucide-react` from 1.72.0 to 1.76.0
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.76.0/packages/lucide-react)

Updates `react-apexcharts` from 2.2.0 to 2.2.1
- [Release notes](https://github.com/apexcharts/react-apexcharts/releases)
- [Commits](https://github.com/apexcharts/react-apexcharts/commits)

Updates `react-dropzone` from 20.2.0 to 20.2.1
- [Release notes](https://github.com/react-dropzone/react-dropzone/releases)
- [Commits](https://github.com/react-dropzone/react-dropzone/compare/v20.2.0...v20.2.1)

Updates `react-i18next` from 18.0.1 to 18.0.3
- [Changelog](https://github.com/i18next/react-i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/react-i18next/compare/v18.0.1...v18.0.3)

Updates `react-router-dom` from 7.18.5 to 7.18.6
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/react-router-dom@7.18.6/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@7.18.6/packages/react-router-dom)

Updates `scroll-into-view-if-needed` from 3.2.0 to 3.2.1
- [Release notes](https://github.com/scroll-into-view/scroll-into-view-if-needed/releases)
- [Changelog](https://github.com/scroll-into-view/scroll-into-view-if-needed/blob/main/CHANGELOG.md)
- [Commits](https://github.com/scroll-into-view/scroll-into-view-if-needed/compare/v3.2.0...v3.2.1)

Updates `tailwind-merge` from 2.6.1 to 2.6.2
- [Release notes](https://github.com/dcastil/tailwind-merge/releases)
- [Commits](https://github.com/dcastil/tailwind-merge/commits/v2.6.2/packages/tailwind-merge)

Updates `virtua` from 0.54.2 to 0.55.0
- [Release notes](https://github.com/inokawa/virtua/releases)
- [Commits](https://github.com/inokawa/virtua/compare/0.54.2...0.55.0)

Updates `@playwright/test` from 1.65.0 to 1.65.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.65.0...v1.65.1)

Updates `eslint` from 10.14.0 to 10.15.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v10.14.0...v10.15.0)

Updates `eslint-plugin-react-refresh` from 0.5.7 to 0.5.8
- [Release notes](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/releases)
- [Changelog](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/compare/v0.5.7...v0.5.8)

Updates `postcss` from 8.5.32 to 8.5.33
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.5.32...8.5.33)

Updates `typescript-eslint` from 8.72.2 to 8.73.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.73.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: "@hookform/resolvers"
  dependency-version: 7.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: apexcharts
  dependency-version: 8.9.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: framer-motion
  dependency-version: 14.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: i18next
  dependency-version: 27.2.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: i18next-http-backend
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: lucide-react
  dependency-version: 1.76.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: react-apexcharts
  dependency-version: 2.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: react-dropzone
  dependency-version: 20.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: react-i18next
  dependency-version: 18.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: react-router-dom
  dependency-version: 7.18.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: scroll-into-view-if-needed
  dependency-version: 3.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: tailwind-merge
  dependency-version: 2.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: virtua
  dependency-version: 0.55.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: "@playwright/test"
  dependency-version: 1.65.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: eslint
  dependency-version: 10.15.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: eslint-plugin-react-refresh
  dependency-version: 0.5.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: postcss
  dependency-version: 8.5.33
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: typescript-eslint
  dependency-version: 8.73.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-22 08:02:35 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
890bb6cf9c Update openai requirement from ==3.49.* to ==3.55.* in /docker/main (#25051)
Updates the requirements on [openai](https://github.com/openai/openai-python) to permit the latest version.
- [Release notes](https://github.com/openai/openai-python/releases)
- [Changelog](https://github.com/openai/openai-python/blob/main/CHANGELOG.md)
- [Commits](https://github.com/openai/openai-python/compare/v3.49.0...v3.55.1)

---
updated-dependencies:
- dependency-name: openai
  dependency-version: 3.55.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-22 08:02:30 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
65e34317eb Update google-genai requirement (#25049)
Updates the requirements on [google-genai](https://github.com/googleapis/python-genai) to permit the latest version.

Updates `google-genai` to 3.6.1
- [Release notes](https://github.com/googleapis/python-genai/releases)
- [Changelog](https://github.com/googleapis/python-genai/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/python-genai/compare/v3.2.0...v3.6.1)

---
updated-dependencies:
- dependency-name: google-genai
  dependency-version: 3.6.1
  dependency-type: direct:production
  dependency-group: pydantic-genai
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-22 08:02:25 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e17005c6b4 Update fastapi requirement from ==0.162.* to ==0.165.* in /docker/main (#25053)
Updates the requirements on [fastapi](https://github.com/fastapi/fastapi) to permit the latest version.
- [Release notes](https://github.com/fastapi/fastapi/releases)
- [Commits](https://github.com/fastapi/fastapi/compare/0.162.0...0.165.0)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-version: 0.165.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-22 08:02:19 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
fabb8b0119 Update onnxruntime requirement from ==1.31.* to ==1.32.* in /docker/main (#25052)
Updates the requirements on [onnxruntime](https://github.com/microsoft/onnxruntime) to permit the latest version.
- [Commits](https://github.com/microsoft/onnxruntime/commits)

---
updated-dependencies:
- dependency-name: onnxruntime
  dependency-version: 1.32.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-22 08:02:14 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
8c3a2610bb Bump the pip-main-minor-patch group in /docker/main with 2 updates (#25050)
Bumps the pip-main-minor-patch group in /docker/main with 2 updates: [python-multipart](https://github.com/Kludex/python-multipart) and [ruff](https://github.com/astral-sh/ruff).


Updates `python-multipart` from 0.0.33 to 0.0.34
- [Release notes](https://github.com/Kludex/python-multipart/releases)
- [Changelog](https://github.com/Kludex/python-multipart/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kludex/python-multipart/compare/0.0.33...0.0.34)

Updates `ruff` from 0.17.4 to 0.17.5
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.17.4...0.17.5)

---
updated-dependencies:
- dependency-name: python-multipart
  dependency-version: 0.0.34
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pip-main-minor-patch
- dependency-name: ruff
  dependency-version: 0.17.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: pip-main-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-22 08:02:09 -06:00
Nicolas MowenandGitHub 39d1053d0c Implement shared function to ensure consistency of object severity (#25041)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* Implement shared function to ensure consistency of object severity

* Catch
2026-11-21 15:42:37 -06:00
Josh HawkinsandGitHub ce5b26dc11 Add summary timeline to Motion Review and History (#25034)
CI / AMD64 Build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* add motion summary timeline to motion review and history

The summary strip draws motion as a canvas layer, with each pixel row's opacity set by the mean motion value over its time, so the full day is visible next to the 30s timeline. Dragging now converts strip pixels to timeline pixels directly instead of going through the drag box height, which no longer matches the box once it has borders. The strip is wider on mobile, and the drag box style is shared with the alerts and detections strips.

* hide summary timeline when motion only switch is on

* drag summary timeline from anywhere and keep a minimum box size

The drag box shrank to a few pixels when the timeline was zoomed in, and tapping the summary timeline on mobile read touches[0] on touchend, where the list is always empty. The box now has a minimum height centered on the visible range, and input goes through pointer events: a tap outside the box jumps there, and a press outside the box that moves snaps the box under the pointer and drags it.
2026-11-20 09:56:01 -06:00
d85527ffd2 Miscellaneous Fixes (#25027)
* Fix GenAI structured response not handling optional fields correctly

* allow export thumbnails for camera-restricted roles

Export thumbnails under /clips/export/ weren't classified by media auth, so roles with a camera allow-list got a 403 on every thumbnail. The thumbnail now resolves to its export's camera through a thumb_path lookup, and the camera access check applies as usual.

* load i18n locales from the base url

The locale load path was relative, so any URL with a trailing slash or more than one segment (like /admin/) fetched locales from under that path, got index.html back from the nginx fallback, and broke every UI string. Locales now load from the same base url as the API, which also covers HA ingress and FRIGATE_BASE_PATH.

* make storage retained-segment test able to fail

The old test put the retained segments after 59 older unretained ones, so cleanup freed its hourly target and stopped before it ever reached them. It passed even with the retention check removed. Retained segments now come first, and cleanup needs every unretained segment after them, so it has to skip the retained ones to finish.

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2026-11-20 07:59:53 -06:00
Nicolas MowenandGitHub 4b1ae76baa Support HEIC images for Face Recognition (#25024)
CI / AMD64 Build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
2026-11-19 08:09:59 -07:00
Nicolas MowenandGitHub dfd1fa91b5 Implement banner for stopping debug replay (#25022)
* Implement banner for stopping debug replay

* Tweaks for review issue

* Fix failures
2026-11-19 07:05:39 -07:00
05a6233b5a Miscellaneous Fixes (#25007)
* don't crash review maintainer when a manual event ends with no active segment

The review maintainer read the label of every manual event message before checking its state, so an end message, which carries no label, raised a KeyError and killed the review process when the camera had no active segment. This happened when a recordings or enabled toggle, a completed manual event, or audio closed the segment of a still-open indefinite event, and on every plate expiry on dedicated LPR cameras with detections disabled. With the process dead, no review items were created and alert/detection-only retention deleted all new recordings until restart. End messages with no active segment now drop the event from the indefinite events and are otherwise ignored.

* Update the default timeout for detection subscriber to avoid blocking indefinitely

* run embeddings requests off the api event loop

set_description, regenerate_review_description, and the chat semantic search tools called the embeddings requestor directly from async handlers, so the API event loop waited on the embeddings process with no timeout. In normal operation the wait is short (about 80 to 140 ms of text embedding with Jina V1 on CPU, and only queue time for review regeneration), so this is mostly defensive. The cases it guards against are a request sent while the embeddings process is still downloading or loading models, which froze the whole UI until it finished, and the embeddings process dying with a request in flight, which left the API unresponsive until Frigate restarted. The requestor calls now run in asyncio.to_thread, matching the other blocking calls in the API.

* Handle other fields for context size from api providers

* fix stream checks missing non-aac audio

The ffprobe API never asked ffprobe for codec_type, so the stream checks could only spot audio and video by codec name. G.711, Opus, and other non-AAC audio showed as no audio, and H.265 detect streams showed an unknown resolution. ffprobe_stream now requests codec_type, and the stream check matches tracks on it alone.

* fix timezone-dependent http tests

The devcontainer mounts the host's /etc/localtime over zoneinfo/Etc/UTC, so the API's ZoneInfo("UTC") used the host's local zone and the recordings summary and event time_range tests failed at any hour. The review summary tests also built their expected day key from the local date, so they failed whenever the local day differed from the UTC day. BaseTestHttp now writes a minimal UTC zone file to a temp dir and puts it first on the zoneinfo search path, which works without the tzdata package, and the review tests convert their expected day keys to UTC.

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2026-11-19 06:38:44 -07:00
frigate-agents[bot]andClaude Opus 5.5 510ef221c2 Merge remote-tracking branch 'origin/master' into dev
Conflict resolutions:
- Makefile: keep dev's VERSION 0.19.0
- docker/main/build_nginx.sh: take master's NGINX_VERSION 1.30.7 (CVE fix)
- docker/main/rootfs/usr/local/nginx/conf/nginx.conf: take dev's side,
  which already contains everything #25009 adds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 11:30:37 +00:00
Rhácius CasteloandGitHub 1c30924ff1 Add Gemini embeddings for semantic search (#24690)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* Add Gemini embeddings for semantic search

gemini-embedding-2 maps text and images into one space. Request 768 dimensions, send one input per call, and transcode WebP thumbnails to JPEG. Check model supported_actions for embedContent before advertising embeddings support, and raise ValueError on failure so the embeddings process stays up.

* Fix unreachable Gemini provider checks
2026-11-18 15:36:55 -07:00
Rmdev.proandGitHub 3c122150ae Fix ONNX Runtime CPU memory arena configuration (#25003)
* Fix CPU memory arena option on ONNX Runtime sessions

* Limit CPU arena correction to CPU enrichment sessions

* Retain default arena in GPU runner integration regression

* Preserve native detector session-options contract
2026-11-18 15:36:11 -07:00
Josh HawkinsandGitHub a19e23ae2d bump version to 0.18.3 (#25011)
CI / AMD64 Build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
2026-11-18 11:11:18 -06:00
Josh HawkinsandGitHub aadbda1104 Update nginx and backport module changes (#25009)
* update nginx to 1.30.7 and backport nginx module changes from dev

nginx 1.27.4 was vulnerable to CVE-2026-123007 (HTTP/2 flow control heap overflow) and CVE-2026-123633 (HTTP/2 use-after-free), both reachable before auth on the internal and external ports because http2 is on for the whole server block. Kaltura also deleted the nginx-vod-module and nginx-secure-token-module repos, so the build could no longer download either module.

- Update nginx to 1.30.7
- Backport the switch to the maintained dio-az nginx-vod-module fork (#24123)
- Backport the nginx-secure-token-module removal (#24893)

* bump playwright to 1.65.0 for ubuntu 26.04 runners
2026-11-18 09:52:28 -07:00
Josh HawkinsandGitHub 6c09629783 Miscellaneous fixes (#24996)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* tweak agents file

* add serbian latin

* fix serbian latin components

weblate put them in the wrong directory (sr_Latn). the component style was updated in weblate itself so this shouldn't happen for any future translations

* raise on empty genai embedding response so the maintainer thread survives
2026-11-17 14:25:05 -07:00
Nicolas MowenandGitHub 8a7d89170b Fix RKNN default perms for binaries and libraries (#25000)
* Fix RKNN default perms for binaries and libraries

* Add docs to handle specific rknn mounts
2026-11-17 15:03:11 -06:00
Josh HawkinsandGitHub 97f2096534 Add export case menu (#24997)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* add kebab menu to export cases

* disable download while case exports are still encoding

* stop case menu clicks from opening the case

* check case download readiness against jobs on every camera
2026-11-17 08:57:33 -07:00
640ae1058a Translated using Weblate (Serbian (Latin script))
Currently translated at 100.0% (64 of 64 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (60 of 60 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (66 of 66 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (500 of 500 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (1409 of 1409 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (49 of 49 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (130 of 130 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (145 of 145 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (37 of 37 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (1409 of 1409 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (64 of 64 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (130 of 130 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (68 of 68 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (141 of 141 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (37 of 37 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (50 of 50 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (266 of 266 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 67.1% (946 of 1409 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (130 of 130 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (68 of 68 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (500 of 500 strings)

Co-authored-by: Branislav Maricic <b.n.maricic@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/audio/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-camera/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-filter/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-player/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/objects/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-chat/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-classificationmodel/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-events/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-explore/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-facelibrary/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-motionsearch/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-replay/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-search/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/sr_Latn/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/audio
Translation: Frigate NVR/common
Translation: Frigate NVR/components-camera
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-filter
Translation: Frigate NVR/components-player
Translation: Frigate NVR/objects
Translation: Frigate NVR/views-chat
Translation: Frigate NVR/views-classificationmodel
Translation: Frigate NVR/views-events
Translation: Frigate NVR/views-explore
Translation: Frigate NVR/views-facelibrary
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-motionSearch
Translation: Frigate NVR/views-replay
Translation: Frigate NVR/views-search
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-17 07:58:33 -06:00
499cbcfc89 Translated using Weblate (Serbian (Latin script))
Currently translated at 100.0% (500 of 500 strings)

Co-authored-by: Branislav Maricic <b.n.maricic@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/audio/sr_Latn/
Translation: Frigate NVR/audio
2026-11-17 07:58:33 -06:00
106d59b683 Translated using Weblate (Serbian)
Currently translated at 100.0% (64 of 64 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (141 of 141 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (66 of 66 strings)

Translated using Weblate (Serbian)

Currently translated at 36.1% (51 of 141 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (130 of 130 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (60 of 60 strings)

Translated using Weblate (Serbian)

Currently translated at 16.0% (14 of 87 strings)

Translated using Weblate (Serbian)

Currently translated at 33.7% (49 of 145 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (68 of 68 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (500 of 500 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (26 of 26 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (25 of 25 strings)

Translated using Weblate (Serbian)

Currently translated at 33.2% (258 of 775 strings)

Translated using Weblate (Serbian)

Currently translated at 25.6% (134 of 522 strings)

Translated using Weblate (Serbian)

Currently translated at 85.5% (1205 of 1409 strings)

Translated using Weblate (Serbian)

Currently translated at 22.4% (174 of 775 strings)

Translated using Weblate (Serbian)

Currently translated at 8.2% (43 of 522 strings)

Translated using Weblate (Serbian)

Currently translated at 17.3% (49 of 282 strings)

Translated using Weblate (Serbian)

Currently translated at 85.5% (1205 of 1409 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (6 of 6 strings)

Translated using Weblate (Serbian)

Currently translated at 14.9% (13 of 87 strings)

Translated using Weblate (Serbian)

Currently translated at 61.7% (42 of 68 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (10 of 10 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (37 of 37 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (2 of 2 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (50 of 50 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (10 of 10 strings)

Translated using Weblate (Serbian)

Currently translated at 100.0% (266 of 266 strings)

Translated using Weblate (Serbian)

Currently translated at 2.2% (12 of 522 strings)

Translated using Weblate (Serbian)

Currently translated at 85.4% (1204 of 1409 strings)

Co-authored-by: Branislav Maricic <b.n.maricic@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/audio/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-auth/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-camera/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-filter/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-input/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-player/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-groups/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-validation/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/objects/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-chat/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-classificationmodel/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-configeditor/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-events/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-explore/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-exports/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-facelibrary/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-motionsearch/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-recording/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-replay/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/sr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/sr/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/Config - Groups
Translation: Frigate NVR/Config - Validation
Translation: Frigate NVR/audio
Translation: Frigate NVR/common
Translation: Frigate NVR/components-auth
Translation: Frigate NVR/components-camera
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-filter
Translation: Frigate NVR/components-input
Translation: Frigate NVR/components-player
Translation: Frigate NVR/objects
Translation: Frigate NVR/views-chat
Translation: Frigate NVR/views-classificationmodel
Translation: Frigate NVR/views-configeditor
Translation: Frigate NVR/views-events
Translation: Frigate NVR/views-explore
Translation: Frigate NVR/views-exports
Translation: Frigate NVR/views-facelibrary
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-motionSearch
Translation: Frigate NVR/views-recording
Translation: Frigate NVR/views-replay
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-17 07:58:33 -06:00
19d1a0f216 Translated using Weblate (Swedish)
Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (141 of 141 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (1409 of 1409 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (130 of 130 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (60 of 60 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (87 of 87 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (145 of 145 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (68 of 68 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (266 of 266 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (37 of 37 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (64 of 64 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (26 of 26 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (25 of 25 strings)

Translated using Weblate (Swedish)

Currently translated at 100.0% (66 of 66 strings)

Co-authored-by: Daniel Nylander <yeagersthlm2@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-player/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-groups/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-validation/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/objects/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-chat/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-classificationmodel/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-events/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-explore/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-exports/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-facelibrary/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-motionsearch/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-replay/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/sv/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/sv/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/Config - Groups
Translation: Frigate NVR/Config - Validation
Translation: Frigate NVR/common
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-player
Translation: Frigate NVR/objects
Translation: Frigate NVR/views-chat
Translation: Frigate NVR/views-classificationmodel
Translation: Frigate NVR/views-events
Translation: Frigate NVR/views-explore
Translation: Frigate NVR/views-exports
Translation: Frigate NVR/views-facelibrary
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-motionSearch
Translation: Frigate NVR/views-replay
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-17 07:58:33 -06:00
77a3095f12 Translated using Weblate (Czech)
Currently translated at 100.0% (64 of 64 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (1409 of 1409 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (130 of 130 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (Czech)

Currently translated at 100.0% (266 of 266 strings)

Co-authored-by: Ashus <ashus@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-motionsearch/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/cs/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/cs/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/common
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-motionSearch
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-17 07:58:33 -06:00
dfcb7da995 Translated using Weblate (Romanian)
Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Romanian)

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Romanian)

Currently translated at 100.0% (1409 of 1409 strings)

Translated using Weblate (Romanian)

Currently translated at 100.0% (130 of 130 strings)

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: lukasig <lukasig@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/ro/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-replay/ro/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/ro/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/ro/
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-replay
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-17 07:58:33 -06:00
740b155a1b Translated using Weblate (Estonian)
Currently translated at 100.0% (130 of 130 strings)

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Priit Jõerüüt <jrthwlate@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/et/
Translation: Frigate NVR/views-live
2026-11-17 07:58:33 -06:00
77a58a59ea Translated using Weblate (Danish)
Currently translated at 27.5% (33 of 120 strings)

Translated using Weblate (Danish)

Currently translated at 90.9% (242 of 266 strings)

Co-authored-by: Alexander Christensen <alexdmx@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/da/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/da/
Translation: Frigate NVR/common
Translation: Frigate NVR/components-dialog
2026-11-17 07:58:33 -06:00
fb9c928de5 Translated using Weblate (Turkish)
Currently translated at 100.0% (130 of 130 strings)

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Murat Odabasi <modabas@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/tr/
Translation: Frigate NVR/views-live
2026-11-17 07:58:33 -06:00
f2a264c15e Resize classification training images the same way as inference (#24988)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* Resize classification training images the same way as inference

Training let Keras resize dataset images to 224x224, which uses nearest
neighbor by default. Inference resizes the crop with cv2.resize
(bilinear). For crops much smaller than 224 px the two results look very
different, so a model could fit its training images perfectly and still
report the same state for every live frame.

Add resize_classification_image() and use it everywhere an image is
resized for a classification model. Before training, the dataset is
copied to a temporary directory through that same function, so Keras is
given images that are already the model input size and does no resizing
of its own.

The new test runs a frame through the state processor and the crop it
saves through the training process (stopped at model.fit), and checks
the model receives the same pixels from both, for random frame and crop
sizes. Adds hypothesis as a dev dependency.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fail training when a prepared image cannot be written

cv2.imwrite returns False instead of raising, so a full temporary
directory would have dropped images from training without any error.
Raise with the file path instead; the training process already logs
the exception and fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Trim classification parity tests and drop hypothesis

Per review: the parity test is now a plain loop over fixed crop sizes
(64, 79, 224 and 600 px) on a fixed 1280x720 frame, which covers both
upscaled and downscaled crops. The 224x224 check and the failed-write
test are removed; the parity test already covers the prepared image
size. hypothesis is no longer a dev dependency.

The 64, 79 and 600 px cases still fail on dev and pass with the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Victor Bajanov <victorb@spunmonkey.org>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 16:01:52 -07:00
Josh HawkinsandGitHub f22278bcfa Fix camera name prefix matching (#24992)
* only remove the deleted camera's media files

Camera deletion globbed snapshot, clean copy, and review thumbnail files by "{camera}-*", and camera names can contain "-", so deleting "front" also removed every one of those files for "front-door". Files are now matched on the full name, the camera followed by an event or review id.

* only use the camera's own preview frames for review descriptions

get_cache_frames matched cached preview frames by "preview_{camera}-", so when "front" had no frame after the review ended, the first "front-door" frame became the trailing frame and went into front's GenAI prompt. It now uses is_camera_preview_frame like the preview recorder and exports.

* keep cleaning up when a media directory can't be listed
2026-11-16 12:04:55 -06:00
A. AhmetandGitHub 128729f5ac Update DEEPX detector to DX-RT 3.5.0 (#24989)
* Update DEEPX detector to DX-RT 3.5.0

* Keep the DEEPX package for offline reinstalls, update docs.
2026-11-16 08:44:28 -07:00
Nicolas MowenandGitHub d04ed58d8f Organize extensions for Frigate (#24991) 2026-11-16 15:41:33 +00:00
jey burrowsandGitHub 8e9607eccd Update third_party_extensions.md with Home Assistant Marketplace integrations that support Frigate (#24965)
* Update third_party_extensions.md with new integrations

Added new integrations for Auto Arm and Camera AutoNotify to the documentation.

* Enhance integration descriptions for clarity

Updated descriptions for Auto Arm and Camera AutoNotify integrations to include additional features and synchronization options.
2026-11-16 08:27:56 -07:00
Josh HawkinsandGitHub ceb0374c2b limit go2rtc exec and echo to frigate's ffmpeg and disable ngrok (#24983)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
go2rtc merges its config files, and the HomeKit file and anything saved through go2rtc's unauthenticated config API load before Frigate's generated config. A planted exec: or echo: source, or an ngrok.command, ran whatever program it named, and as root under FRIGATE_ROOT_SERVICES=go2rtc. Unless GO2RTC_ALLOW_ARBITRARY_EXEC is set, the generated config now sets exec.allow_paths and echo.allow_paths to Frigate's ffmpeg and sets an empty ngrok.command, which override earlier files, and the config-save API rejects new exec and echo keys. The non-root docs note that a root go2rtc still isn't separated from the frigate user, since ffmpeg with arbitrary arguments can overwrite files as root.
2026-11-16 06:53:10 -07:00
Josh HawkinsandGitHub ec5f6d4f7f Miscellaneous fixes (#24982)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* disable onnxruntime telemetry

* hold the last frame on screen when the live mode changes

Turning on two-way talk while watching MSE switched the player to WebRTC and showed a buffering spinner until WebRTC played. The frame capture now runs on a mode change as well as a stream change, so the outgoing frame stays up until the new player plays.
2026-11-15 21:32:22 -07:00
Allan ELKAIMandGitHub 1d8adec669 Add select all control to review action group on mobile (#24975)
Mobile has no equivalent of the Ctrl+A shortcut, so selecting many
review items means long-pressing one and tapping every other card.
Show an "All" control next to "Unselect" on mobile while some items
are still unselected, matching Explore, Face Library, and the
classification training view.
2026-11-15 21:30:49 -07:00
Josh HawkinsandGitHub 190f4e0bd2 clarify region size in model guide (#24984)
The guide said a 320 model gets smaller regions than a 640 model. Since 0.17 the minimum region is 320 px for any model, so both models get the same crops and a 640 model usually receives an upscaled one.
2026-11-15 11:23:49 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Josh Hawkins
74a5973f6d Bump i18next from 26.7.2 to 27.1.1 in /web (#24980)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* Bump i18next from 26.7.2 to 27.1.1 in /web

Bumps [i18next](https://github.com/i18next/i18next) from 26.7.2 to 27.1.1.
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v26.7.2...v27.1.1)

---
updated-dependencies:
- dependency-name: i18next
  dependency-version: 27.1.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump react-i18next to 18 and fix i18next 27 types

react-i18next 18 peers i18next >= 27.0.1, so the two move together.
i18next 27's TFunction no longer fits the hand-written t signatures in
the config form, and it rejects undefined as the options argument.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2026-11-15 11:39:59 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
0a9ad3cd7e Update openai requirement from ==3.46.* to ==3.49.* in /docker/main (#24977)
Updates the requirements on [openai](https://github.com/openai/openai-python) to permit the latest version.
- [Release notes](https://github.com/openai/openai-python/releases)
- [Changelog](https://github.com/openai/openai-python/blob/main/CHANGELOG.md)
- [Commits](https://github.com/openai/openai-python/compare/v3.46.0...v3.49.0)

---
updated-dependencies:
- dependency-name: openai
  dependency-version: 3.49.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-15 11:28:43 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
126dfeebeb Bump the web-minor-patch group in /web with 12 updates (#24978)
Bumps the web-minor-patch group in /web with 12 updates:

| Package | From | To |
| --- | --- | --- |
| [@hookform/resolvers](https://github.com/react-hook-form/resolvers) | `7.0.3` | `7.0.6` |
| [apexcharts](https://github.com/apexcharts/apexcharts.js) | `8.7.0` | `8.8.1` |
| [axios](https://github.com/axios/axios) | `1.21.0` | `1.21.1` |
| [framer-motion](https://github.com/motiondivision/motion) | `14.10.0` | `14.12.0` |
| [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) | `1.70.0` | `1.72.0` |
| [react-dropzone](https://github.com/react-dropzone/react-dropzone) | `20.1.4` | `20.2.0` |
| [react-hook-form](https://github.com/react-hook-form/react-hook-form) | `7.91.0` | `7.92.0` |
| [scroll-into-view-if-needed](https://github.com/scroll-into-view/scroll-into-view-if-needed) | `3.1.0` | `3.2.0` |
| [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) | `6.2.1` | `6.3.0` |
| [prettier](https://github.com/prettier/prettier) | `3.9.10` | `3.10.1` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.72.1` | `8.72.2` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `8.3.6` | `8.3.8` |


Updates `@hookform/resolvers` from 7.0.3 to 7.0.6
- [Release notes](https://github.com/react-hook-form/resolvers/releases)
- [Commits](https://github.com/react-hook-form/resolvers/compare/v7.0.3...v7.0.6)

Updates `apexcharts` from 8.7.0 to 8.8.1
- [Release notes](https://github.com/apexcharts/apexcharts.js/releases)
- [Commits](https://github.com/apexcharts/apexcharts.js/compare/v8.7.0...v8.8.1)

Updates `axios` from 1.21.0 to 1.21.1
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.21.0...v1.21.1)

Updates `framer-motion` from 14.10.0 to 14.12.0
- [Changelog](https://github.com/motiondivision/motion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/motiondivision/motion/compare/v14.10.0...v14.12.0)

Updates `lucide-react` from 1.70.0 to 1.72.0
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.72.0/packages/lucide-react)

Updates `react-dropzone` from 20.1.4 to 20.2.0
- [Release notes](https://github.com/react-dropzone/react-dropzone/releases)
- [Commits](https://github.com/react-dropzone/react-dropzone/compare/v20.1.4...v20.2.0)

Updates `react-hook-form` from 7.91.0 to 7.92.0
- [Release notes](https://github.com/react-hook-form/react-hook-form/releases)
- [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md)
- [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.91.0...v7.92.0)

Updates `scroll-into-view-if-needed` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/scroll-into-view/scroll-into-view-if-needed/releases)
- [Changelog](https://github.com/scroll-into-view/scroll-into-view-if-needed/blob/main/CHANGELOG.md)
- [Commits](https://github.com/scroll-into-view/scroll-into-view-if-needed/compare/v3.1.0...v3.2.0)

Updates `@vitejs/plugin-react` from 6.2.1 to 6.3.0
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/plugin-react@6.3.0/packages/plugin-react)

Updates `prettier` from 3.9.10 to 3.10.1
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.9.10...3.10.1)

Updates `typescript-eslint` from 8.72.1 to 8.72.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.2/packages/typescript-eslint)

Updates `vite` from 8.3.6 to 8.3.8
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.3.8/packages/vite)

---
updated-dependencies:
- dependency-name: "@hookform/resolvers"
  dependency-version: 7.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: apexcharts
  dependency-version: 8.8.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: axios
  dependency-version: 1.21.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: framer-motion
  dependency-version: 14.12.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: lucide-react
  dependency-version: 1.72.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: react-dropzone
  dependency-version: 20.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: react-hook-form
  dependency-version: 7.92.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: scroll-into-view-if-needed
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: "@vitejs/plugin-react"
  dependency-version: 6.3.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: prettier
  dependency-version: 3.10.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: typescript-eslint
  dependency-version: 8.72.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: vite
  dependency-version: 8.3.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-15 11:26:34 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
930b845937 Update google-genai requirement (#24976)
Updates the requirements on [google-genai](https://github.com/googleapis/python-genai) to permit the latest version.

Updates `google-genai` to 3.2.0
- [Release notes](https://github.com/googleapis/python-genai/releases)
- [Changelog](https://github.com/googleapis/python-genai/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/python-genai/compare/v3.0.0...v3.2.0)

---
updated-dependencies:
- dependency-name: google-genai
  dependency-version: 3.2.0
  dependency-type: direct:production
  dependency-group: pydantic-genai
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-15 11:26:29 -06:00
Blake BlackshearandGitHub d3b7d4ea44 Add Frigate+ model selection guide (#24981) 2026-11-15 06:57:07 -07:00
Josh HawkinsandGitHub 7fd81171f0 Miscellaneous fixes (#24970)
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* analytics notifications flag and device grant warnings

- report notifications as on when any camera enables them, not only the global setting
- don't warn about device nodes the runtime users can already use, such as world-rw nodes in an unprivileged LXC

* clarify which stream the All Cameras dashboard uses

* add exception catchall for autotracking calibration

* only default review api after to 24 hours when no bounds are given

The review endpoint replaced a missing or zero `after` with 24 hours ago, so a `before`-only query older than 24 hours returned nothing and `after=0` couldn't mean no lower bound. The default now applies only when neither `before` nor `after` is sent, a `before`-only query has no lower bound, and both bounds use `is not None` checks. The Live dashboard alerts bar sends no bounds and keeps the 24 hour window.
2026-11-14 07:34:17 -07:00
Josh HawkinsandGitHub 0e3dca5915 Live view improvements (#24967)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* hold the last frame on screen while switching live streams

Switching streams in the single camera view blanked the player until the new stream played, because the old player unmounts in the same render and the hidden new player gave the card no height. The outgoing video's last frame is now drawn to a canvas before the remount and covers the gap until the new stream plays, and the card takes the camera's aspect ratio so it keeps its size while the video is hidden.

* show live streams as a one-tap grid in the mobile drawer

Switching streams on mobile meant scrolling past the camera toggles, opening a dropdown, and picking a stream. The drawer now opens with the stream section, and streams are a wrapping grid of toggles sized to their names, so a switch is two taps. A single stream shows as plain text. The audio and two-way talk lines show a spinner while the stream's go2rtc metadata loads instead of reporting audio as unavailable, which showed on the first switch to a transcoded stream.

* don't capture the switch frame on tiles that show the camera still
2026-11-13 09:51:16 -07:00
Josh HawkinsandGitHub 9276502e4f Switch Debug Replay scenes at runtime (#24958)
* allow switching the detect scene of a debug replay camera without a restart

- show the scene field in the replay detect settings
- drop the replay camera's cached model on a detect change so the refresh recycle picks up the new scene's model
- recreate the tracked object state on refresh when the camera's model changed
- reject a scene no model can serve with a 400 instead of crashing the tracker and maintainer threads
- size each camera's detection input shm for the largest model and recreate leftover smaller segments, so a camera re-added under a larger model no longer overflows it
- ignore event ends for objects already dropped by a state reset

* end tracked events before replacing replay camera state on a scene switch

- test the replay model rebind against two configured models
2026-11-13 09:08:29 -07:00
Josh HawkinsandGitHub bb04e6d49d Move genai review frame extraction off the embeddings loop (#24959)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* move genai review frame extraction off the embeddings loop

- Run frame gathering for finished review items on a thread so per-frame ffmpeg calls don't stall the embeddings maintainer
- Share one path between live and regenerated review descriptions
- Stop padding review start and end times in place, which widened the stored review item
- Lock timestamp expiry in EventsPerSecond since update() and eps() now run on different threads

* serialize recording frame extraction for review descriptions
2026-11-13 06:45:29 -07:00
Nicolas MowenandGitHub cc94cbc2da Add mjpeg warning (#24954)
CI / AMD64 Build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
2026-11-12 11:41:09 -07:00
b2f5315e09 Validate MQTT TLS options before startup (#24951)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* Validate MQTT TLS verification options before client startup

* Test MQTT configuration recovery with authentication available

* Cover both MQTT TLS verification values in safe-mode recovery

* Use a documentation address in MQTT regression tests

* Skip MQTT TLS validation when MQTT is disabled

* Simplify MQTT TLS validation regression coverage

---------

Co-authored-by: Peter Kay <dougle.peter.kay@googlemail.com>
2026-11-12 10:04:09 -06:00
Josh HawkinsandGitHub a655ddcb2e Pin debug replay to main recording stream (#24952)
* pin debug replay to one recording stream

Debug replay stream-copied the merged VOD playlist into one mp4. When main had gaps that sub filled, the clip switched streams mid-file, and a camera with an H.265 main and an H.264 sub produced an mp4 labeled H.264 that also held HEVC packets. The replay camera's decoder then failed and the watchdog killed ffmpeg. Replay now follows the clip download rule: it pins the playlist to main and only falls back to sub when the range has no main recordings.

* choose the replay stream with the vod coverage resolver

Stream selection counted a main row that only touched the range, while the pinned playlist served nothing for it, so replay failed instead of using the sub footage. Selection now uses resolve_coverage, the same resolver the pinned vod and export use.
2026-11-12 08:33:33 -07:00
Josh HawkinsandGitHub 806ee66562 Fix sub label filter for non-ascii names (#24953)
* fix sub label filter for non-ascii names

The sub_labels filter lowercased the requested name in Python but the stored value with SQLite's LOWER(), which only folds ASCII. Cyrillic and other non-ASCII names never matched, so filtering by a face name returned no events. Both sides are now lowered in SQLite, which keeps ASCII matching case-insensitive and non-ASCII matching exact.

* cover events/search in sub label filter test
2026-11-12 08:33:04 -07:00
Hosted WeblateandJosh Hawkins 42f5a7560b Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 21836c7444 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
e70eba2fb8 Translated using Weblate (Serbian (Latin script))
Currently translated at 28.7% (25 of 87 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 2.0% (1 of 49 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 21.8% (19 of 87 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (145 of 145 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 6.6% (4 of 60 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 97.9% (142 of 145 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 5.0% (3 of 60 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 44.1% (64 of 145 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (141 of 141 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 56.1% (791 of 1409 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 2.2% (2 of 87 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (68 of 68 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 5.2% (26 of 500 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (10 of 10 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (66 of 66 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 23.1% (326 of 1409 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 17.9% (252 of 1404 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (6 of 6 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (26 of 26 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (25 of 25 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (37 of 37 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (2 of 2 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (2 of 2 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (50 of 50 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (10 of 10 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (266 of 266 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 0.1% (2 of 1404 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 80.6% (421 of 522 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 52.2% (139 of 266 strings)

Translated using Weblate (Serbian (Latin script))

Currently translated at 5.0% (25 of 500 strings)

Co-authored-by: Branislav Maricic <b.n.maricic@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/audio/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-auth/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-camera/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-filter/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-icons/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-input/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-player/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-groups/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-validation/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/objects/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-chat/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-classificationmodel/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-configeditor/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-events/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-explore/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-exports/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-facelibrary/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-recording/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-search/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/sr_Latn/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/sr_Latn/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/Config - Groups
Translation: Frigate NVR/Config - Validation
Translation: Frigate NVR/audio
Translation: Frigate NVR/common
Translation: Frigate NVR/components-auth
Translation: Frigate NVR/components-camera
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-filter
Translation: Frigate NVR/components-icons
Translation: Frigate NVR/components-input
Translation: Frigate NVR/components-player
Translation: Frigate NVR/objects
Translation: Frigate NVR/views-chat
Translation: Frigate NVR/views-classificationmodel
Translation: Frigate NVR/views-configeditor
Translation: Frigate NVR/views-events
Translation: Frigate NVR/views-explore
Translation: Frigate NVR/views-exports
Translation: Frigate NVR/views-facelibrary
Translation: Frigate NVR/views-recording
Translation: Frigate NVR/views-search
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-12 08:23:49 -06:00
e0b5a6c965 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (64 of 64 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (66 of 66 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (26 of 26 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (775 of 775 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (522 of 522 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (282 of 282 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (1409 of 1409 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (87 of 87 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (68 of 68 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (266 of 266 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 93.9% (728 of 775 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 97.5% (509 of 522 strings)

Update translation files

Updated by "Cleanup translation files" add-on in Weblate.

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 91.7% (711 of 775 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 94.2% (492 of 522 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (37 of 37 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (Chinese (Simplified Han script))

Currently translated at 99.2% (264 of 266 strings)

Co-authored-by: GuoQing Liu <zhaisoul@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-player/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-validation/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-chat/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-events/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-exports/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-motionsearch/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/zh_Hans/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/Config - Validation
Translation: Frigate NVR/common
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-player
Translation: Frigate NVR/views-chat
Translation: Frigate NVR/views-events
Translation: Frigate NVR/views-exports
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-motionSearch
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-12 08:23:49 -06:00
6733a757e8 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 96.8% (62 of 64 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 81.8% (54 of 66 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 88.4% (23 of 26 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (25 of 25 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 89.6% (695 of 775 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 90.4% (472 of 522 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (141 of 141 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 64.1% (181 of 282 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 89.8% (1261 of 1404 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (49 of 49 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 77.5% (100 of 129 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (60 of 60 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 98.8% (86 of 87 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (145 of 145 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 98.5% (67 of 68 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (10 of 10 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (129 of 129 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 59.4% (22 of 37 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (2 of 2 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 89.1% (107 of 120 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (50 of 50 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 90.2% (240 of 266 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (500 of 500 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 96.8% (62 of 64 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 88.4% (23 of 26 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 89.6% (695 of 775 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 90.4% (472 of 522 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 100.0% (141 of 141 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 89.7% (1260 of 1404 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 98.8% (86 of 87 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 98.5% (67 of 68 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 90.2% (240 of 266 strings)

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: 蘭蘭露 <flandretw@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/audio/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-camera/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-filter/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-input/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-player/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-groups/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-validation/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/objects/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-chat/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-classificationmodel/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-configeditor/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-events/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-explore/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-exports/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-facelibrary/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-live/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-motionsearch/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-replay/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-search/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/zh_Hant/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-system/zh_Hant/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/Config - Groups
Translation: Frigate NVR/Config - Validation
Translation: Frigate NVR/audio
Translation: Frigate NVR/common
Translation: Frigate NVR/components-camera
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-filter
Translation: Frigate NVR/components-input
Translation: Frigate NVR/components-player
Translation: Frigate NVR/objects
Translation: Frigate NVR/views-chat
Translation: Frigate NVR/views-classificationmodel
Translation: Frigate NVR/views-configeditor
Translation: Frigate NVR/views-events
Translation: Frigate NVR/views-explore
Translation: Frigate NVR/views-exports
Translation: Frigate NVR/views-facelibrary
Translation: Frigate NVR/views-live
Translation: Frigate NVR/views-motionSearch
Translation: Frigate NVR/views-replay
Translation: Frigate NVR/views-search
Translation: Frigate NVR/views-settings
Translation: Frigate NVR/views-system
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 94e700fbac Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 5f59f7c53c Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 0e2da4e24a Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins dade7a6b3e Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 329430760e Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 2fbb66e475 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 5019984a33 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
db58f9f5cc Translated using Weblate (French)
Currently translated at 27.2% (211 of 775 strings)

Translated using Weblate (French)

Currently translated at 61.8% (323 of 522 strings)

Translated using Weblate (French)

Currently translated at 100.0% (74 of 74 strings)

Translated using Weblate (French)

Currently translated at 100.0% (120 of 120 strings)

Translated using Weblate (French)

Currently translated at 100.0% (50 of 50 strings)

Translated using Weblate (French)

Currently translated at 100.0% (266 of 266 strings)

Update translation files

Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: tiphergane <tiphergane@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/fr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-camera/fr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-dialog/fr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/components-filter/fr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-cameras/fr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/config-global/fr/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/Config - Cameras
Translation: Frigate NVR/Config - Global
Translation: Frigate NVR/common
Translation: Frigate NVR/components-camera
Translation: Frigate NVR/components-dialog
Translation: Frigate NVR/components-filter
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins f83b8b57db Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 146d61017e Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 86c9b4bf74 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins ed1a515c1b Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins c013f6dcb8 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins bb1736bb4d Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
68988780cd Translated using Weblate (Hindi)
Currently translated at 29.0% (145 of 500 strings)

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Thomas Maslanky <terminallychill@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/audio/hi/
Translation: Frigate NVR/audio
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins c148063e76 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 37ca717f63 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins b6d16fb6f3 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins e45b7de79b Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins a1f8f95497 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
cabbfd5d73 Translated using Weblate (Catalan)
Currently translated at 100.0% (1409 of 1409 strings)

Update translation files

Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Eduardo Pastor Fernández <edugaga@users.noreply.hosted.weblate.org>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/ca/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 20a3bd7ac5 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins e287833e8d Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins e150c5d1dd Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 60c4e37303 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
3ac35fe777 Translated using Weblate (Romanian)
Currently translated at 100.0% (1409 of 1409 strings)

Update translation files

Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: lukasig <lukasig@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/ro/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 8b0325aefb Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
c57b48e977 Translated using Weblate (Estonian)
Currently translated at 100.0% (266 of 266 strings)

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Priit Jõerüüt <jrthwlate@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/common/et/
Translation: Frigate NVR/common
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 74a2aac866 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 2af6dc34da Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
Hosted WeblateandJosh Hawkins 9eb336a3d8 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
bb0e2c0d5e Translated using Weblate (Turkish)
Currently translated at 100.0% (1409 of 1409 strings)

Update translation files

Updated by "Cleanup translation files" add-on in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Murat Odabasi <modabas@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/
Translate-URL: https://hosted.weblate.org/projects/frigate-nvr/views-settings/tr/
Translation: Frigate NVR/views-settings
2026-11-12 08:23:49 -06:00
yufrettiandGitHub 2d25f9a8b5 docs: add yuFriEye (iOS/macOS client) to third party extensions (#24942) 2026-11-11 09:52:48 -07:00
Josh HawkinsandGitHub 06d1365056 Report ownership scan progress (#24940)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* report ownership scan progress

The ownership scan printed nothing until it finished, which took 30+ minutes on large recordings volumes and looked stuck. It now logs a running count of checked and mismatched entries every 30 seconds.

* check the scan clock on every entry
2026-11-11 08:52:58 -07:00
Josh HawkinsandGitHub 8a88cefc9a Autotracking tweaks (#24935)
* fix autotracking movement time prediction and recorded move times

Movement time prediction multiplied the fitted intercept by the saved zero-step calibration time instead of 1, so predictions didn't match the regression. In absolute zoom mode, a pan/tilt followed by a zoom recorded the zoom's timestamps against the pan/tilt distance, because _zoom_absolute resets the PTZ start and stop times. The pan/tilt times are now captured before the zoom runs.

* predict velocity and zoom size for objects approaching the autotracked camera

The velocity check required both box corners to move in the same direction, but the corners of an approaching object diverge, so its velocity was rejected and zeroed and the camera aimed where the object had been. That check is removed, and the existing magnitude, delta, and variance checks still reject noise. The zoom size prediction fit area against epoch time with no intercept, which returned roughly the mean area instead of a forecast. It now scales the target box by the growth the corner velocities predict over the movement time.

* keep predicted target box positive and add regression tests

A shrinking object's predicted size could reach zero, so the relative zoom ratio divided by zero and sent a NaN zoom to the camera. The predicted size is now floored at 1 px. Tests also cover the movement time intercept and the pan/tilt timestamps that absolute zoom overwrites.
2026-11-11 08:38:21 -07:00
Josh HawkinsandGitHub fba967c74b fix annotation offset seeking in tracking details (#24936)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
The VOD manifest used to find the keyframe-snapped clip start was built from the live annotation offset while the playing clip used the offset from when the event opened. Each offset step fetched a manifest for a different clip, so the seek mapping drifted: the video jumped forward about one GOP every second of offset and flickered while each new manifest loaded. The manifest now uses the same stable source offset as the playlist
2026-11-10 07:57:21 -06:00
Josh HawkinsandGitHub 33c55649a4 report custom go2rtc and ffmpeg builds in analytics (#24928)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
Users can swap in their own go2rtc binary at /config/go2rtc or point ffmpeg.path at a custom build, and either can explain stream behavior that looks like a Frigate regression. The install section now reports a custom_go2rtc boolean and an ffmpeg enum (default, bundled, custom) for the configured global path, so no version strings or path text leave the install.
2026-11-09 14:05:16 -07:00
Josh HawkinsandGitHub c88434dc29 Write migrated config atomically (#24926)
* write migrated config atomically

Config migration rewrote config.yml in place with open("w") after each step, so nginx's get_nginx_settings.py, which starts alongside frigate, could read an empty file, get None from yaml.load, and crash on config.get. Each step now writes to a temp file with the original mode and os.replace's it into place.

* keep config owner and handle file bind mounts in migration writes

os.replace failed with EBUSY when config.yml was a file bind mount, as in the documented --validate-config command, and the replaced file lost its original owner when Frigate ran as root. The write now copies in place on EBUSY and restores the original owner when permitted. Tests cover a failed dump leaving the original config and the bind-mount fallback.

* follow config symlinks in migration writes
2026-11-09 13:56:34 -07:00
Josh HawkinsandGitHub e7256d58a1 strip nginx user directive when not running as root (#24925)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
2026-11-09 12:41:19 -06:00
b2a7e992c9 Request FP16 TensorRT engine for ONNX detector with device Tensorrt (#24923)
* Request FP16 TensorRT engine for ONNX detector with device Tensorrt

get_ort_providers only enables trt_fp16_enable when requires_fp16 is
passed, and the ONNX detector never passed it, so device: Tensorrt
always built an FP32 engine. USE_FP16=False still disables FP16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Make TensorRT FP16 opt-in via USE_FP16 only

Drop the unused requires_fp16 parameter from get_ort_providers and decide
trt_fp16_enable from the USE_FP16 environment variable alone, defaulting
to false. Revert the ONNX detector change and document USE_FP16=true for
device: Tensorrt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop the TensorRT docs line

The stock image ships only the TensorRT runtime, not the builder
libraries needed to create engines, so the instructions were misleading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:46:25 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
11f4dd194c Update google-genai requirement (#24920)
Updates the requirements on [google-genai](https://github.com/googleapis/python-genai) to permit the latest version.

Updates `google-genai` to 3.0.0
- [Release notes](https://github.com/googleapis/python-genai/releases)
- [Changelog](https://github.com/googleapis/python-genai/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/python-genai/compare/v2.34.0...v3.0.0)

---
updated-dependencies:
- dependency-name: google-genai
  dependency-version: 3.0.0
  dependency-type: direct:production
  dependency-group: pydantic-genai
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-09 08:25:39 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
0e7da1bee4 Bump the web-minor-patch group in /web with 5 updates (#24922)
Bumps the web-minor-patch group in /web with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [framer-motion](https://github.com/motiondivision/motion) | `14.9.1` | `14.10.0` |
| [i18next](https://github.com/i18next/i18next) | `26.7.1` | `26.7.2` |
| [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) | `1.69.0` | `1.70.0` |
| [react-i18next](https://github.com/i18next/react-i18next) | `17.1.12` | `17.1.13` |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.64.1` | `1.65.0` |


Updates `framer-motion` from 14.9.1 to 14.10.0
- [Changelog](https://github.com/motiondivision/motion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/motiondivision/motion/compare/v14.9.1...v14.10.0)

Updates `i18next` from 26.7.1 to 26.7.2
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v26.7.1...v26.7.2)

Updates `lucide-react` from 1.69.0 to 1.70.0
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.70.0/packages/lucide-react)

Updates `react-i18next` from 17.1.12 to 17.1.13
- [Changelog](https://github.com/i18next/react-i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/react-i18next/compare/v17.1.12...v17.1.13)

Updates `@playwright/test` from 1.64.1 to 1.65.0
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.64.1...v1.65.0)

---
updated-dependencies:
- dependency-name: framer-motion
  dependency-version: 14.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: i18next
  dependency-version: 26.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: lucide-react
  dependency-version: 1.70.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
- dependency-name: react-i18next
  dependency-version: 17.1.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: web-minor-patch
- dependency-name: "@playwright/test"
  dependency-version: 1.65.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: web-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-09 08:25:23 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
14870f5237 Bump ruff in /docker/main in the pip-main-minor-patch group (#24921)
Bumps the pip-main-minor-patch group in /docker/main with 1 update: [ruff](https://github.com/astral-sh/ruff).


Updates `ruff` from 0.17.3 to 0.17.4
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.17.3...0.17.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.17.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: pip-main-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-09 08:25:17 -06:00
Josh HawkinsandGitHub ca851a9238 Miscellaneous Fixes (#24914)
* strip intel media driver on install

The manually built iHD_drv_video.so was installed with full debug info, making it 513 MB in the image instead of 41 MB stripped. Installing with install/strip removes about 240 MB from the compressed amd64 image.

* remove rjsf 6.11.0 dependabot hold

The hold covered the GenAI form refilling the saved model after a provider switch. That was a GenAIModelWidget bug that rjsf 6.11 exposed, and it was fixed with the 6.11.1 bump in #24901, so no rjsf version needs holding.

* strip intel media driver after install

install/strip skipped iHD_drv_video.so because media-driver installs it with install(PROGRAMS), not as a target. Strip it directly instead.

* bump dev docs version in header

* attest published images with github build provenance

Published images carried unsigned BuildKit provenance, so nothing tied an image digest to the commit it was built from. Each published image (the default multi-arch build and the six variants) now gets an actions/attest provenance attestation pushed to GHCR, verifiable with gh attestation verify. Release tags are skopeo copies with the same digest, so they're covered too. Storage records are off because they require an org-owned repo.
2026-11-09 06:44:48 -07:00
81cf7be89a Add on-demand Frigate+ API key validation (#24918)
* Add on-demand Frigate+ API key validation

The Frigate+ settings page reported the API key as validated whenever it
matched the expected format, without ever checking it with the server.

- Clarify the status text to say the key matches the expected format
- Add PlusApi.validate_key(), which requests a token from Frigate+ and
  reports the key as valid, invalid, unreachable, or not set; server
  errors and timeouts are not reported as an invalid key
- Add an admin-only POST /plus/validate endpoint and regenerate the API spec
- Add a "Validate with Frigate+" button that shows the result inline

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4iDiZE2b3tVFVYyZrfZde

* Validate Frigate+ key asynchronously and keep cached token on bad replies

- Use aiohttp for the validation request so the endpoint awaits it
  instead of blocking a worker thread
- Only replace the cached token when the reply has a string accessToken
  and numeric expires; otherwise report unreachable so an unexpected
  response can't break later Frigate+ requests
- Test against a local aiohttp server, covering timeouts, connection
  failures, non-JSON replies and unusable token shapes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4iDiZE2b3tVFVYyZrfZde

* Honor proxy settings when validating the Frigate+ key

aiohttp ignores HTTP(S)_PROXY unless trust_env is set, so validation
reported Frigate+ as unreachable on installs that need a proxy while
other Frigate+ requests still worked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4iDiZE2b3tVFVYyZrfZde

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 06:30:35 -07:00
Blake BlackshearandGitHub 7d12583ebc update recommended camera list (#24919) 2026-11-09 05:49:43 -07:00
439 changed files with 24596 additions and 4410 deletions
+5 -4
View File
@@ -4,6 +4,8 @@ inputs:
GITHUB_TOKEN: GITHUB_TOKEN:
required: true required: true
outputs: outputs:
image-repo:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}
image-name: image-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ steps.create-short-sha.outputs.SHORT_SHA }} value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ steps.create-short-sha.outputs.SHORT_SHA }}
cache-name: cache-name:
@@ -21,7 +23,7 @@ runs:
# from root and temp-reserve-mb is what actually stays free on root. Keep 4G # from root and temp-reserve-mb is what actually stays free on root. Keep 4G
# there for setup-qemu/buildx caches in ~/.docker and the tool cache # there for setup-qemu/buildx caches in ~/.docker and the tool cache
- name: Maximize build space - name: Maximize build space
uses: easimon/maximize-build-space@master uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c # v10
with: with:
root-reserve-mb: 8192 root-reserve-mb: 8192
temp-reserve-mb: 4096 temp-reserve-mb: 4096
@@ -34,9 +36,8 @@ runs:
run: sudo systemctl start docker run: sudo systemctl start docker
shell: bash shell: bash
- id: lowercaseRepo - id: lowercaseRepo
uses: ASzc/change-string-case-action@v8 run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
with: shell: bash
string: ${{ github.repository }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v4 uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx - name: Set up Docker Buildx
-3
View File
@@ -136,9 +136,6 @@ updates:
# Later versions need Node 22 and extract false keys # Later versions need Node 22 and extract false keys
- dependency-name: "i18next-cli" - dependency-name: "i18next-cli"
versions: [">1.5.11"] versions: [">1.5.11"]
# 6.11.0 refills the saved model in the GenAI settings form
- dependency-name: "@rjsf/*"
versions: ["6.11.0"]
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/docs" directory: "/docs"
+120 -4
View File
@@ -14,6 +14,9 @@ concurrency:
group: ${{ github.ref }} group: ${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
permissions:
contents: read
env: env:
PYTHON_VERSION: 3.11 PYTHON_VERSION: 3.11
@@ -21,6 +24,9 @@ jobs:
amd64_build: amd64_build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
name: AMD64 Build name: AMD64 Build
permissions:
contents: read
packages: write
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v7 uses: actions/checkout@v7
@@ -45,6 +51,9 @@ jobs:
smoke_test: smoke_test:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
name: AMD64 Smoke Test name: AMD64 Smoke Test
permissions:
contents: read
packages: read
needs: needs:
- amd64_build - amd64_build
steps: steps:
@@ -156,8 +165,16 @@ jobs:
# the usb tree gets recursive grants plus a default ACL that # the usb tree gets recursive grants plus a default ACL that
# newly created nodes inherit (the Coral re-enumeration path) # newly created nodes inherit (the Coral re-enumeration path)
docker exec frigate sh -c 'mkdir -p /dev/bus/usb/001 && mknod /dev/bus/usb/001/002 c 189 1' docker exec frigate sh -c 'mkdir -p /dev/bus/usb/001 && mknod /dev/bus/usb/001/002 c 189 1'
docker exec frigate sh -c 'mkdir -p /opt/link-target && ln -s /opt/link-target /dev/bus/usb/001/link'
docker exec frigate sh -c 'export PATH=/command:$PATH; exec /etc/s6-overlay/s6-rc.d/init-devices/run' docker exec frigate sh -c 'export PATH=/command:$PATH; exec /etc/s6-overlay/s6-rc.d/init-devices/run'
docker exec frigate getfacl -p /dev/bus/usb/001 | grep -q "user:frigate:rwx" docker exec frigate getfacl -p /dev/bus/usb/001 | grep -q "user:frigate:rwx"
# a symlink in the usb tree is never followed
target_acl=$(docker exec frigate getfacl -p /opt/link-target)
if grep -q "user:frigate" <<< "$target_acl"; then
echo "init-devices followed a symlink under /dev/bus/usb"; exit 1
fi
# a fifo at the sentinel path is rejected at once instead of hanging the boot
docker exec frigate sh -c 'mkfifo /tmp/sentinel-fifo && timeout 5 /usr/local/bin/safe-sentinel read /tmp/sentinel-fifo; test $? -eq 1'
docker exec frigate sh -c 'mknod /dev/bus/usb/001/099 c 189 98 && chmod 664 /dev/bus/usb/001/099' docker exec frigate sh -c 'mknod /dev/bus/usb/001/099 c 189 98 && chmod 664 /dev/bus/usb/001/099'
inherited=$(docker exec frigate getfacl -p /dev/bus/usb/001/099) inherited=$(docker exec frigate getfacl -p /dev/bus/usb/001/099)
echo "$inherited" echo "$inherited"
@@ -244,6 +261,9 @@ jobs:
done done
if [ "$up" -ne 1 ]; then echo "granular container never came back after restart"; docker logs frigate-granular; exit 1; fi if [ "$up" -ne 1 ]; then echo "granular container never came back after restart"; docker logs frigate-granular; exit 1; fi
docker exec frigate-granular stat -c %u /media/frigate/clips/straggler.webp | grep -qx 1000 docker exec frigate-granular stat -c %u /media/frigate/clips/straggler.webp | grep -qx 1000
# the per-boot /config sweep leaves the sentinel root-owned, so the restart skips the full sweep
docker exec frigate-granular stat -c %u /config/.permissions_version | grep -qx 0
docker logs frigate-granular 2>&1 | grep -q "already applied, skipping"
docker rm -f frigate-granular docker rm -f frigate-granular
- name: Assert unknown root service fails fast - name: Assert unknown root service fails fast
run: | run: |
@@ -294,6 +314,18 @@ 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: |
@@ -423,6 +455,11 @@ jobs:
run: docker rm -f frigate || true run: docker rm -f frigate || true
arm64_build: arm64_build:
runs-on: ubuntu-22.04-arm runs-on: ubuntu-22.04-arm
permissions:
contents: read
packages: write
attestations: write
id-token: write
name: ARM Build name: ARM Build
steps: steps:
- name: Check out code - name: Check out code
@@ -435,6 +472,7 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push arm64 standard build - name: Build and push arm64 standard build
id: standard-arm64
uses: docker/build-push-action@v7 uses: docker/build-push-action@v7
with: with:
context: . context: .
@@ -445,6 +483,13 @@ jobs:
tags: | tags: |
${{ steps.setup.outputs.image-name }}-standard-arm64 ${{ steps.setup.outputs.image-name }}-standard-arm64
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64 cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
- name: Attest arm64 standard build
uses: actions/attest@v4
with:
subject-name: ${{ steps.setup.outputs.image-repo }}
subject-digest: ${{ steps.standard-arm64.outputs.digest }}
push-to-registry: true
create-storage-record: false
- name: Build and push RPi build - name: Build and push RPi build
uses: docker/bake-action@v7 uses: docker/bake-action@v7
with: with:
@@ -458,6 +503,11 @@ jobs:
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64,mode=max *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64,mode=max
jetson_jp6_build: jetson_jp6_build:
runs-on: ubuntu-22.04-arm runs-on: ubuntu-22.04-arm
permissions:
contents: read
packages: write
attestations: write
id-token: write
name: Jetson Jetpack 6 name: Jetson Jetpack 6
steps: steps:
- name: Check out code - name: Check out code
@@ -470,6 +520,7 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push TensorRT (Jetson, Jetpack 6) - name: Build and push TensorRT (Jetson, Jetpack 6)
id: tensorrt-jp6
env: env:
ARCH: arm64 ARCH: arm64
BASE_IMAGE: nvcr.io/nvidia/tensorrt:23.12-py3-igpu BASE_IMAGE: nvcr.io/nvidia/tensorrt:23.12-py3-igpu
@@ -485,8 +536,20 @@ jobs:
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp6 tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp6
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6 *.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6,mode=max *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6,mode=max
- name: Attest TensorRT (Jetson, Jetpack 6)
uses: actions/attest@v4
with:
subject-name: ${{ steps.setup.outputs.image-repo }}
subject-digest: ${{ fromJSON(steps.tensorrt-jp6.outputs.metadata)['tensorrt']['containerimage.digest'] }}
push-to-registry: true
create-storage-record: false
amd64_extra_builds: amd64_extra_builds:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
name: AMD64 Extra Build name: AMD64 Extra Build
needs: needs:
- amd64_build - amd64_build
@@ -501,6 +564,7 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push TensorRT (x86 GPU) - name: Build and push TensorRT (x86 GPU)
id: tensorrt
env: env:
COMPUTE_LEVEL: "50 60 70 80 90" COMPUTE_LEVEL: "50 60 70 80 90"
uses: docker/bake-action@v7 uses: docker/bake-action@v7
@@ -513,7 +577,15 @@ jobs:
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt *.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt,mode=max *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt,mode=max
- name: Attest TensorRT (x86 GPU)
uses: actions/attest@v4
with:
subject-name: ${{ steps.setup.outputs.image-repo }}
subject-digest: ${{ fromJSON(steps.tensorrt.outputs.metadata)['tensorrt']['containerimage.digest'] }}
push-to-registry: true
create-storage-record: false
- name: AMD/ROCm general build - name: AMD/ROCm general build
id: rocm
env: env:
HSA_OVERRIDE: 0 HSA_OVERRIDE: 0
uses: docker/bake-action@v7 uses: docker/bake-action@v7
@@ -526,8 +598,20 @@ jobs:
rocm.tags=${{ steps.setup.outputs.image-name }}-rocm rocm.tags=${{ steps.setup.outputs.image-name }}-rocm
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rocm,mode=max *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rocm,mode=max
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rocm *.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rocm
- name: Attest AMD/ROCm general build
uses: actions/attest@v4
with:
subject-name: ${{ steps.setup.outputs.image-repo }}
subject-digest: ${{ fromJSON(steps.rocm.outputs.metadata)['rocm']['containerimage.digest'] }}
push-to-registry: true
create-storage-record: false
arm64_extra_builds: arm64_extra_builds:
runs-on: ubuntu-22.04-arm runs-on: ubuntu-22.04-arm
permissions:
contents: read
packages: write
attestations: write
id-token: write
name: ARM Extra Build name: ARM Extra Build
needs: needs:
- arm64_build - arm64_build
@@ -542,6 +626,7 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Rockchip build - name: Build and push Rockchip build
id: rk
uses: docker/bake-action@v7 uses: docker/bake-action@v7
with: with:
source: . source: .
@@ -551,8 +636,20 @@ jobs:
set: | set: |
rk.tags=${{ steps.setup.outputs.image-name }}-rk rk.tags=${{ steps.setup.outputs.image-name }}-rk
*.cache-from=type=gha *.cache-from=type=gha
- name: Attest Rockchip build
uses: actions/attest@v4
with:
subject-name: ${{ steps.setup.outputs.image-repo }}
subject-digest: ${{ fromJSON(steps.rk.outputs.metadata)['rk']['containerimage.digest'] }}
push-to-registry: true
create-storage-record: false
synaptics_build: synaptics_build:
runs-on: ubuntu-22.04-arm runs-on: ubuntu-22.04-arm
permissions:
contents: read
packages: write
attestations: write
id-token: write
name: Synaptics Build name: Synaptics Build
needs: needs:
- arm64_build - arm64_build
@@ -567,6 +664,7 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Synaptics build - name: Build and push Synaptics build
id: synaptics
uses: docker/bake-action@v7 uses: docker/bake-action@v7
with: with:
source: . source: .
@@ -576,19 +674,29 @@ jobs:
set: | set: |
synaptics.tags=${{ steps.setup.outputs.image-name }}-synaptics synaptics.tags=${{ steps.setup.outputs.image-name }}-synaptics
*.cache-from=type=gha *.cache-from=type=gha
- name: Attest Synaptics build
uses: actions/attest@v4
with:
subject-name: ${{ steps.setup.outputs.image-repo }}
subject-digest: ${{ fromJSON(steps.synaptics.outputs.metadata)['synaptics']['containerimage.digest'] }}
push-to-registry: true
create-storage-record: false
# The majority of users running arm64 are rpi users, so the rpi # The majority of users running arm64 are rpi users, so the rpi
# build should be the primary arm64 image # build should be the primary arm64 image
assemble_default_build: assemble_default_build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
name: Assemble and push default build name: Assemble and push default build
needs: needs:
- amd64_build - amd64_build
- arm64_build - arm64_build
steps: steps:
- id: lowercaseRepo - id: lowercaseRepo
uses: ASzc/change-string-case-action@v8 run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
with:
string: ${{ github.repository }}
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
with: with:
@@ -597,9 +705,17 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Create short sha - name: Create short sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- uses: int128/docker-manifest-create-action@v2 - uses: int128/docker-manifest-create-action@d6ac360314337bbfb870747d9616b83118acb330 # v2.30.0
id: manifest
with: with:
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }} tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
sources: | sources: |
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-amd64 ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-amd64
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi
- name: Attest default build
uses: actions/attest@v4
with:
subject-name: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}
subject-digest: ${{ steps.manifest.outputs.digest }}
push-to-registry: true
create-storage-record: false
+3
View File
@@ -8,6 +8,9 @@ on:
- ".github/DISCUSSION_TEMPLATE/**" - ".github/DISCUSSION_TEMPLATE/**"
- ".github/ISSUE_TEMPLATE/**" - ".github/ISSUE_TEMPLATE/**"
permissions:
contents: read
env: env:
DEFAULT_PYTHON: 3.11 DEFAULT_PYTHON: 3.11
+11 -7
View File
@@ -5,6 +5,10 @@ on:
release: release:
types: [published] types: [published]
permissions:
contents: read
packages: write
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -14,9 +18,7 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
- id: lowercaseRepo - id: lowercaseRepo
uses: ASzc/change-string-case-action@v8 run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
with:
string: ${{ github.repository }}
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
with: with:
@@ -34,19 +36,21 @@ jobs:
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "CLEAN_VERSION=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's/^[v]//')" >> $GITHUB_ENV echo "CLEAN_VERSION=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's/^[v]//')" >> $GITHUB_ENV
- name: Tag and push the main image - name: Tag and push the main image
env:
SKOPEO: quay.io/skopeo/stable:v1.24.1-immutable@sha256:81a8d4265c339539cba229459fdc4cb3580e1d2c2cb4285271c75adaa0fcb9b5
run: | run: |
VERSION_TAG=${BASE}:${CLEAN_VERSION} VERSION_TAG=${BASE}:${CLEAN_VERSION}
STABLE_TAG=${BASE}:stable STABLE_TAG=${BASE}:stable
PULL_TAG=${BASE}:${BUILD_TAG} PULL_TAG=${BASE}:${BUILD_TAG}
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG} docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG}
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant} docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant}
done done
# stable tag # stable tag
if [[ "${BUILD_TYPE}" == "stable" ]]; then if [[ "${BUILD_TYPE}" == "stable" ]]; then
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG} docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG}
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant} docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant}
done done
fi fi
+6 -1
View File
@@ -7,11 +7,16 @@ on:
schedule: schedule:
- cron: "0 0 * * *" # run stalebot once a day - cron: "0 0 * * *" # run stalebot once a day
permissions:
actions: write
issues: write
pull-requests: write
jobs: jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@main - uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
id: stale id: stale
with: with:
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions." stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
+7 -6
View File
@@ -6,7 +6,7 @@ This document provides coding guidelines and best practices for contributing to
Frigate NVR is a realtime object detection system for IP cameras that uses: Frigate NVR is a realtime object detection system for IP cameras that uses:
- **Backend**: Python 3.13+ with FastAPI, OpenCV, TensorFlow/ONNX - **Backend**: Python 3.11 with FastAPI, OpenCV, TensorFlow/ONNX
- **Frontend**: React with TypeScript, Vite, TailwindCSS - **Frontend**: React with TypeScript, Vite, TailwindCSS
- **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
@@ -23,7 +23,7 @@ When reviewing code, do NOT comment on:
### Python Requirements ### Python Requirements
- **Compatibility**: Python 3.13+ - **Compatibility**: Python 3.11 (the version in the Docker image)
- **Language Features**: Use modern Python features: - **Language Features**: Use modern Python features:
- Pattern matching - Pattern matching
- Type hints (comprehensive typing preferred) - Type hints (comprehensive typing preferred)
@@ -97,11 +97,12 @@ When reviewing code, do NOT comment on:
### Async Programming ### Async Programming
- **External I/O**: All external I/O operations must be async - **Scope**: Frigate is mostly synchronous multiprocess code, and most API handlers are plain `def` running in FastAPI's threadpool. These rules apply to code that is already `async def`.
- **Best Practices**: - **Blocking I/O**: A handler that does blocking work (peewee queries, `requests`, subprocess) should be a plain `def`, not an `async def` that blocks the event loop
- Avoid sleeping in loops - use `asyncio.sleep()` not `time.sleep()` - **Best Practices** (inside `async def`):
- Use `asyncio.sleep()`, not `time.sleep()`
- Avoid awaiting in loops - use `asyncio.gather()` instead - Avoid awaiting in loops - use `asyncio.gather()` instead
- No blocking calls in async functions - No blocking calls
- Use `asyncio.create_task()` for background operations - Use `asyncio.create_task()` for background operations
- **Thread Safety**: Use proper synchronization for shared state - **Thread Safety**: Use proper synchronization for shared state
+7 -7
View File
@@ -14,11 +14,11 @@
set -euo pipefail set -euo pipefail
driver_version="v2.6.0" driver_version="v2.7.0"
# the commit the tag resolves to, since DEEPX signs neither tags nor releases # the commit the tag resolves to, since DEEPX signs neither tags nor releases
# and this is compiled and installed as root. Update both together # and this is compiled and installed as root. Update both together
driver_commit="7074748e7104f470b02f517583abba652b3f05fa" driver_commit="8455be625439e005d7b3a375cc79087f4b570404"
firmware_version="v2.7.4" firmware_version="v2.7.6"
sudo apt-get update sudo apt-get update
sudo apt-get install -y git build-essential "linux-headers-$(uname -r)" pciutils wget sudo apt-get install -y git build-essential "linux-headers-$(uname -r)" pciutils wget
@@ -69,10 +69,10 @@ if ! compgen -G "/dev/dxrt*" > /dev/null; then
exit 1 exit 1
fi fi
runtime_version="v3.4.0" runtime_version="v3.5.0"
declare -A runtime_sha256=( declare -A runtime_sha256=(
[amd64]="736cfef009ce9e974ab1ab610d867239d19d72a426a53e367ddcbd53297b6e20" [amd64]="c1993416e43059fb4751b2fd093d4232ab2ae8e67a5ec4156c79889e66260f64"
[arm64]="eb6107f5f02f2ad76ae89f414e8b5f346f34fbc6f0888236136853a26be6f6a0" [arm64]="f7c942ddfa325f435de3ab9a42b32b322f97dacff7f3468a37e32a6386a03681"
) )
runtime_release="${runtime_version#v}" runtime_release="${runtime_version#v}"
@@ -127,5 +127,5 @@ echo "Runtime version: ${runtime_release}"
echo "Device node(s): $(echo /dev/dxrt*)" echo "Device node(s): $(echo /dev/dxrt*)"
echo echo
echo "This driver expects NPU firmware ${firmware_version}. Check it with:" echo "This driver expects NPU firmware ${firmware_version}. Check it with:"
echo " dxrt-cli --status" echo " dxcli -s"
echo "Update the module if it does not match before starting Frigate." echo "Update the module if it does not match before starting Frigate."
+3
View File
@@ -245,6 +245,9 @@ ENV PYTHONWARNINGS="ignore:::numpy.core.getlimits"
# Set HailoRT to disable logging # Set HailoRT to disable logging
ENV HAILORT_LOGGER_PATH=NONE ENV HAILORT_LOGGER_PATH=NONE
# Disable ONNX Runtime's usage telemetry to Microsoft
ENV ORT_DISABLE_TELEMETRY=1
# TensorFlow C++ logging suppression (must be set before import) # TensorFlow C++ logging suppression (must be set before import)
# TF_CPP_MIN_LOG_LEVEL: 0=all, 1=INFO+, 2=WARNING+, 3=ERROR+ (we use 3 for errors only) # TF_CPP_MIN_LOG_LEVEL: 0=all, 1=INFO+, 2=WARNING+, 3=ERROR+ (we use 3 for errors only)
ENV TF_CPP_MIN_LOG_LEVEL=3 ENV TF_CPP_MIN_LOG_LEVEL=3
+1
View File
@@ -46,3 +46,4 @@ make -C /tmp/media-driver/build -j"$(nproc)"
# Install driver to rootfs for COPY --from # Install driver to rootfs for COPY --from
make -C /tmp/media-driver/build install DESTDIR=/rootfs make -C /tmp/media-driver/build install DESTDIR=/rootfs
strip --strip-unneeded /rootfs/usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
+1 -1
View File
@@ -2,7 +2,7 @@
set -euxo pipefail set -euxo pipefail
NGINX_VERSION="1.27.4" NGINX_VERSION="1.30.7"
VOD_MODULE_VERSION="v1.9.1" VOD_MODULE_VERSION="v1.9.1"
SET_MISC_MODULE_VERSION="v0.33" SET_MISC_MODULE_VERSION="v0.33"
NGX_DEVEL_KIT_VERSION="v0.3.3" NGX_DEVEL_KIT_VERSION="v0.3.3"
+1 -1
View File
@@ -1,4 +1,4 @@
ruff == 0.17.3 ruff == 0.17.5
# types # types
types-peewee == 4.0.* types-peewee == 4.0.*
+5 -5
View File
@@ -4,14 +4,14 @@ click == 8.5.*
aiohttp == 3.14.* aiohttp == 3.14.*
starlette == 1.10.* starlette == 1.10.*
starlette-context == 0.5.* starlette-context == 0.5.*
fastapi[standard-no-fastapi-cloud-cli] == 0.162.* fastapi[standard-no-fastapi-cloud-cli] == 0.165.*
uvicorn == 0.54.* uvicorn == 0.54.*
slowapi == 0.1.* slowapi == 0.1.*
joserfc == 1.8.* joserfc == 1.8.*
cryptography == 50.0.* cryptography == 50.0.*
pathvalidate == 3.3.* pathvalidate == 3.3.*
markupsafe == 3.0.* markupsafe == 3.0.*
python-multipart == 0.0.33 python-multipart == 0.0.34
# Classification Model Training # Classification Model Training
tensorflow == 2.19.* ; platform_machine == 'aarch64' tensorflow == 2.19.* ; platform_machine == 'aarch64'
tensorflow-cpu == 2.21.* ; platform_machine == 'x86_64' tensorflow-cpu == 2.21.* ; platform_machine == 'x86_64'
@@ -43,13 +43,13 @@ opencv-contrib-python == 4.11.0.*
scipy == 1.17.* scipy == 1.17.*
# OpenVino & ONNX # OpenVino & ONNX
openvino == 2026.4.* openvino == 2026.4.*
onnxruntime == 1.31.* onnxruntime == 1.32.*
# Embeddings # Embeddings
transformers == 5.22.* transformers == 5.22.*
# Generative AI # Generative AI
google-genai == 2.34.* google-genai == 3.6.*
ollama == 0.6.* ollama == 0.6.*
openai == 3.46.* openai == 3.55.*
# push notifications # push notifications
py-vapid == 1.9.6 py-vapid == 1.9.6
pywebpush == 2.5.* pywebpush == 2.5.*
@@ -12,7 +12,7 @@ echo "[INFO] Starting go2rtc healthcheck service..."
while sleep 30s; do while sleep 30s; do
# Check if the service is running # Check if the service is running
if ! curl --connect-timeout 10 --fail --silent --show-error --output /dev/null http://127.0.0.1:1984/api/streams 2>&1; then if ! curl --connect-timeout 10 --max-time 15 --fail --silent --show-error --output /dev/null http://127.0.0.1:1984/api/streams 2>&1; then
echo "[ERROR] The go2rtc service is not responding to ping, restarting..." echo "[ERROR] The go2rtc service is not responding to ping, restarting..."
# We can also use -r instead of -t to send kill signal rather than term # We can also use -r instead of -t to send kill signal rather than term
s6-svc -t /var/run/service/go2rtc 2>&1 s6-svc -t /var/run/service/go2rtc 2>&1
@@ -57,6 +57,17 @@ done
granted=0 granted=0
failed=0 failed=0
reachable() {
local node="$1" user
local access=(-r "$node" -a -w "$node")
if [[ -d "$node" ]]; then
access=(-r "$node" -a -x "$node")
fi
for user in frigate go2rtc; do
s6-setuidgid "$user" test "${access[@]}" || return 1
done
}
grant() { grant() {
local node="$1" local node="$1"
# nullglob only drops patterns that hold a metacharacter, so a literal # nullglob only drops patterns that hold a metacharacter, so a literal
@@ -72,6 +83,11 @@ grant() {
fi fi
if setfacl -m "$spec" "$node" 2>/dev/null; then if setfacl -m "$spec" "$node" 2>/dev/null; then
granted=$((granted + 1)) granted=$((granted + 1))
# an unprivileged LXC can't set ACLs on its idmapped nodes, which are often
# already world-rw
elif reachable "$node"; then
return 0
else else
failed=$((failed + 1)) failed=$((failed + 1))
echo "[WARN] could not grant device access on ${node}; see EXTRA_GROUPS in the non-root docs for the fallback" echo "[WARN] could not grant device access on ${node}; see EXTRA_GROUPS in the non-root docs for the fallback"
@@ -89,12 +105,14 @@ done
# node), so the directories also get a default ACL new nodes inherit. The # node), so the directories also get a default ACL new nodes inherit. The
# inherited grant is clamped by the creating mode's group bits, which is rw on # inherited grant is clamped by the creating mode's group bits, which is rw on
# udev hosts (0664) and nothing on raw devtmpfs (0600); hardware-verified. # udev hosts (0664) and nothing on raw devtmpfs (0600); hardware-verified.
# The tree may be a host devtmpfs bind mount the runtime users can write, so
# only real directories and device nodes are granted and links are never followed
if [[ -d /dev/bus/usb ]]; then if [[ -d /dev/bus/usb ]]; then
while IFS= read -r -d '' node; do while IFS= read -r -d '' node; do
grant "$node" grant "$node"
done < <(find /dev/bus/usb -mindepth 1 -print0) done < <(find /dev/bus/usb -mindepth 1 \( -type c -o -type d \) -print0)
while IFS= read -r -d '' dir; do while IFS= read -r -d '' dir; do
setfacl -d -m "u:frigate:rw,u:go2rtc:rw" "$dir" 2>/dev/null || \ setfacl -P -d -m "u:frigate:rw,u:go2rtc:rw" "$dir" 2>/dev/null || \
echo "[WARN] could not set a default ACL on ${dir}; a re-enumerating USB device may lose access" echo "[WARN] could not set a default ACL on ${dir}; a re-enumerating USB device may lose access"
done < <(find /dev/bus/usb -type d -print0) done < <(find /dev/bus/usb -type d -print0)
fi fi
@@ -80,6 +80,11 @@ cp -r /usr/local/nginx/conf/. /tmp/nginx/conf/
set_worker_processes set_worker_processes
# A non-root master ignores `user` and warns on every start
if [[ "$runs_as_root" -eq 0 ]]; then
sed -i '/^user root;$/d' /tmp/nginx/conf/nginx.conf
fi
# TLS certs: user-mounted certs at /etc/letsencrypt/live/frigate (documented # TLS certs: user-mounted certs at /etc/letsencrypt/live/frigate (documented
# contract) always win; otherwise fall back to a self-signed cert persisted in # contract) always win; otherwise fall back to a self-signed cert persisted in
# /config/tls, which stays writable under a read-only root filesystem. # /config/tls, which stays writable under a read-only root filesystem.
@@ -147,13 +152,24 @@ if [[ "$(id -u)" -eq 0 && "$runs_as_root" -eq 0 ]]; then
# nginx reopens /dev/stdout by path for its logs, and s6 made the pipe # nginx reopens /dev/stdout by path for its logs, and s6 made the pipe
# root-owned 0600; without this the non-root master exits EACCES # root-owned 0600; without this the non-root master exits EACCES
chown frigate /dev/stdout chown frigate /dev/stdout
# Only mounted certs need handing over; the self-signed pair is already
# owned by the runtime user that generated it. Never chown the /config copy:
# chown follows symlinks, so it would retarget onto any root file the
# runtime user pointed it at. Tolerant because mounted certs may be :ro.
if [ "$cert_path" = "$letsencrypt_path" ] && [ -f "$cert_path/privkey.pem" ]; then
chown frigate:frigate "$cert_path/privkey.pem" "$cert_path/fullchain.pem" 2>/dev/null || true
fi fi
# Mounted certs are never chowned: chown follows symlinks, and the runtime user
# may control the mounted folder. The key's group and group read survive certbot
# renewals, so the host grants access once.
if [[ "$cert_path" == "$letsencrypt_path" && "$runs_as_root" -eq 0 ]] &&
[[ "$(echo "$nginx_settings" | jq -r .tls.enabled)" == "true" ]]; then
as_runtime=()
if [[ "$(id -u)" -eq 0 ]]; then
as_runtime=(s6-setuidgid frigate)
fi
for file in privkey.pem fullchain.pem; do
if ! "${as_runtime[@]}" test -r "$cert_path/$file"; then
runtime_gid=$("${as_runtime[@]}" id -g)
echo "[ERROR] The mounted ${file} is not readable by the runtime user; on the host, give it group ${runtime_gid} with read access and let that group enter the folders above it" >&2
fi
done
fi fi
# Replace the bash process with the NGINX process, redirecting stderr to stdout # Replace the bash process with the NGINX process, redirecting stderr to stdout
+44 -19
View File
@@ -70,16 +70,6 @@ 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.
@@ -88,22 +78,39 @@ swept_clean=1
# Entries another mechanism deliberately owns. Chowning them undoes that work # Entries another mechanism deliberately owns. Chowning them undoes that work
# and leaves the same "mismatch" waiting for the next boot, so /config could # and leaves the same "mismatch" waiting for the next boot, so /config could
# never report itself clean: /config is chgrp'd to frigate-data below so go2rtc # never report itself clean: /config is chgrp'd to frigate-data below so go2rtc
# can traverse it, and the HomeKit file is handed to the go2rtc user by the # can traverse it, the HomeKit file is handed to the go2rtc user by the go2rtc
# go2rtc service. Only the GROUP on /config is exempt; a root-owned /config # service, and safe-sentinel only trusts a root-owned sentinel. The sentinel is
# must still be chowned or the runtime user cannot write there at all. # excluded on every call, including the granular per-boot /config sweep that
# runs without --sentinel. Only the GROUP on /config is exempt; a root-owned
# /config must still be chowned or the runtime user cannot write there at all.
# Shared by the counting and the chowning walk so the two cannot disagree. # Shared by the counting and the chowning walk so the two cannot disagree.
mismatch_expr=( mismatch_expr=(
"(" -not -uid "$target_uid" "(" -not -uid "$target_uid"
-o "(" -not -gid "$target_gid" -a ! -path /config ")" -o "(" -not -gid "$target_gid" -a ! -path /config ")"
")" ")"
-a ! -path /config/go2rtc_homekit.yml -a ! -path /config/go2rtc_homekit.yml
-a ! -path /config/.permissions_version
) )
if [[ -n "$sentinel" ]]; then
# safe-sentinel keeps the sentinel root-owned on purpose and rejects one first_mismatched_root() {
# owned by anybody else, so chowning it here would suppress the skip and find "$@" -maxdepth 0 "${mismatch_expr[@]}" -print -quit 2>/dev/null || true
# make every boot re-sweep. Only the trailing write puts it back today. }
mismatch_expr+=(-a ! -path "$sentinel")
# 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
fi
exec 3>&1
for path in "$@"; do for path in "$@"; do
# An absent root is an incomplete sweep, not a finished one: /media/frigate # An absent root is an incomplete sweep, not a finished one: /media/frigate
@@ -121,7 +128,18 @@ for path in "$@"; do
# stale mount. Tolerate it rather than aborting under errexit, but never # stale mount. Tolerate it rather than aborting under errexit, but never
# read a failed scan as "nothing to do": that would record the sweep as # read a failed scan as "nothing to do": that would record the sweep as
# complete without having looked. # complete without having looked.
if ! count=$(find "$path" -name lost+found -prune -o "${mismatch_expr[@]}" -printf '.' 2>/dev/null | wc -c); then # The walk prints nothing until it ends, so report every 30s through fd 3
# (stdout) while the count itself comes back through the substitution.
if ! count=$(find "$path" -name lost+found -prune -o "(" "${mismatch_expr[@]}" ")" -printf 'm\n' -o -printf '.\n' 2>/dev/null \
| awk -v path="$path" '
BEGIN { next_report = systime() + 30 }
$0 == "m" { mismatched++ }
systime() >= next_report {
printf "[INFO] fix-ownership: still scanning %s, %d entries checked, %d need changes\n", path, NR, mismatched > "/dev/fd/3"
fflush("/dev/fd/3")
next_report = systime() + 30
}
END { print mismatched + 0 }'); then
swept_clean=0 swept_clean=0
echo "[WARN] fix-ownership: could not scan ${path}; will retry on next boot" echo "[WARN] fix-ownership: could not scan ${path}; will retry on next boot"
continue continue
@@ -189,6 +207,13 @@ 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
@@ -20,7 +20,8 @@ MODE = 0o644
def do_read(path: str) -> int: def do_read(path: str) -> int:
try: try:
fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) # O_NONBLOCK so a fifo opens at once and fails the regular-file check
fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
except OSError: except OSError:
return 1 return 1
try: try:
@@ -22,3 +22,6 @@ add_header Set-Cookie $auth_cookie;
## Pass the location header back up if it exists ## Pass the location header back up if it exists
auth_request_set $redirection_url $upstream_http_location; auth_request_set $redirection_url $upstream_http_location;
add_header Location $redirection_url; add_header Location $redirection_url;
## The add_header lines above stop this location inheriting server-level headers
include security_headers.conf;
@@ -2,7 +2,7 @@
# file, all other path directives follow --prefix and must stay absolute. # file, all other path directives follow --prefix and must stay absolute.
daemon off; daemon off;
# ignored by a non-root master; keeps workers root under FRIGATE_RUN_AS_ROOT # keeps workers root under FRIGATE_RUN_AS_ROOT; the run script strips it otherwise
user root; user root;
worker_processes auto; worker_processes auto;
@@ -152,7 +152,6 @@ http {
sub_filter '.m4s' '.m4s$is_args$args'; sub_filter '.m4s' '.m4s$is_args$args';
sub_filter '.mp4"' '.mp4$is_args$args"'; sub_filter '.mp4"' '.mp4$is_args$args"';
include security_headers.conf;
add_header Cache-Control "no-store"; add_header Cache-Control "no-store";
expires off; expires off;
@@ -161,7 +160,6 @@ http {
location /stream/ { location /stream/ {
include auth_request.conf; include auth_request.conf;
include security_headers.conf;
add_header Cache-Control "no-store"; add_header Cache-Control "no-store";
expires off; expires off;
@@ -185,8 +183,7 @@ http {
} }
expires 7d; expires 7d;
include security_headers.conf; add_header Cache-Control "private";
add_header Cache-Control "public";
autoindex on; autoindex on;
root /media/frigate; root /media/frigate;
@@ -208,6 +205,7 @@ http {
video/mp4 mp4; video/mp4 mp4;
} }
add_header Cache-Control "private";
autoindex on; autoindex on;
autoindex_format json; autoindex_format json;
root /media/frigate; root /media/frigate;
@@ -219,6 +217,7 @@ http {
video/mp4 mp4; video/mp4 mp4;
} }
add_header Cache-Control "private";
autoindex on; autoindex on;
autoindex_format json; autoindex_format json;
root /media/frigate; root /media/frigate;
@@ -226,7 +225,7 @@ http {
location /ws { location /ws {
include auth_request.conf; include auth_request.conf;
proxy_pass http://mqtt_ws/; proxy_pass http://mqtt_ws;
include proxy.conf; include proxy.conf;
} }
@@ -290,7 +289,6 @@ http {
location /api/ { location /api/ {
include auth_request.conf; include auth_request.conf;
include security_headers.conf;
add_header Cache-Control "no-store"; add_header Cache-Control "no-store";
expires off; expires off;
proxy_pass http://frigate_api/; proxy_pass http://frigate_api/;
@@ -8,7 +8,11 @@ from typing import Any
from ruamel.yaml import YAML from ruamel.yaml import YAML
sys.path.insert(0, "/opt/frigate") sys.path.insert(0, "/opt/frigate")
from frigate.util.config import find_config_file, parse_listen_address from frigate.util.config import (
find_config_file,
ipv6_listen_address,
parse_listen_address,
)
sys.path.remove("/opt/frigate") sys.path.remove("/opt/frigate")
@@ -51,6 +55,9 @@ for key, default in (("internal", 5000), ("external", 8971)):
listen_config[key] = value listen_config[key] = value
listen_config[f"{key}_port"] = port listen_config[f"{key}_port"] = port
listen_config[f"{key}_ipv6"] = (
ipv6_listen_address(value, port) if ipv6_config["enabled"] else None
)
if listen_config["internal_port"] == listen_config["external_port"]: if listen_config["internal_port"] == listen_config["external_port"]:
print( print(
@@ -1,12 +1,12 @@
# Internal (IPv4 always; IPv6 optional) # Internal; a wildcard address also listens on [::] when IPv6 is enabled
listen {{ .listen.internal }}; listen {{ .listen.internal }};
{{ if .ipv6.enabled }}listen [::]:{{ .listen.internal_port }};{{ end }} {{ if .listen.internal_ipv6 }}listen {{ .listen.internal_ipv6 }};{{ end }}
# intended for external traffic, protected by auth # intended for external traffic, protected by auth
{{ if .tls.enabled }} {{ if .tls.enabled }}
# external HTTPS (IPv4 always; IPv6 optional) # external HTTPS
listen {{ .listen.external }} ssl; listen {{ .listen.external }} ssl;
{{ if .ipv6.enabled }}listen [::]:{{ .listen.external_port }} ssl;{{ end }} {{ if .listen.external_ipv6 }}listen {{ .listen.external_ipv6 }} ssl;{{ end }}
ssl_certificate {{ .tls.cert_path }}/fullchain.pem; ssl_certificate {{ .tls.cert_path }}/fullchain.pem;
ssl_certificate_key {{ .tls.cert_path }}/privkey.pem; ssl_certificate_key {{ .tls.cert_path }}/privkey.pem;
@@ -30,7 +30,7 @@ listen {{ .listen.internal }};
root /etc/letsencrypt/www; root /etc/letsencrypt/www;
} }
{{ else }} {{ else }}
# (No tls) default to HTTP (IPv4 always; IPv6 optional) # (No tls) default to HTTP
listen {{ .listen.external }}; listen {{ .listen.external }};
{{ if .ipv6.enabled }}listen [::]:{{ .listen.external_port }};{{ end }} {{ if .listen.external_ipv6 }}listen {{ .listen.external_ipv6 }};{{ end }}
{{ end }} {{ end }}
+5 -5
View File
@@ -29,11 +29,11 @@ ENV FRIGATE_IMAGE_VARIANT=rk
COPY docker/rockchip/COCO /COCO COPY docker/rockchip/COCO /COCO
COPY docker/rockchip/conv2rknn.py /opt/conv2rknn.py COPY docker/rockchip/conv2rknn.py /opt/conv2rknn.py
ADD https://github.com/MarcA711/rknn-toolkit2/releases/download/v2.3.2/librknnrt.so /usr/lib/ ADD --chmod=644 https://github.com/MarcA711/rknn-toolkit2/releases/download/v2.3.2/librknnrt.so /usr/lib/
ADD --chmod=111 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/6.1-11/ffmpeg /usr/lib/ffmpeg/6.0/bin/ ADD --chmod=755 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/6.1-11/ffmpeg /usr/lib/ffmpeg/6.0/bin/
ADD --chmod=111 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/6.1-11/ffprobe /usr/lib/ffmpeg/6.0/bin/ ADD --chmod=755 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/6.1-11/ffprobe /usr/lib/ffmpeg/6.0/bin/
ADD --chmod=111 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/7.1-1/ffmpeg /usr/lib/ffmpeg/7.0/bin/ ADD --chmod=755 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/7.1-1/ffmpeg /usr/lib/ffmpeg/7.0/bin/
ADD --chmod=111 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/7.1-1/ffprobe /usr/lib/ffmpeg/7.0/bin/ ADD --chmod=755 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/7.1-1/ffprobe /usr/lib/ffmpeg/7.0/bin/
ENV DEFAULT_FFMPEG_VERSION="6.0" ENV DEFAULT_FFMPEG_VERSION="6.0"
ENV INCLUDED_FFMPEG_VERSIONS="${DEFAULT_FFMPEG_VERSION}:${INCLUDED_FFMPEG_VERSIONS}" ENV INCLUDED_FFMPEG_VERSIONS="${DEFAULT_FFMPEG_VERSION}:${INCLUDED_FFMPEG_VERSIONS}"
+1 -1
View File
@@ -26,4 +26,4 @@ ENV FRIGATE_IMAGE_VARIANT=synaptics
COPY --from=synap1680-wheels /rootfs/usr/local/lib/*.so /usr/lib COPY --from=synap1680-wheels /rootfs/usr/local/lib/*.so /usr/lib
ADD https://raw.githubusercontent.com/synaptics-astra/synap-release/v1.5.0/models/dolphin/object_detection/coco/model/mobilenet224_full80/model.synap /synaptics/mobilenet.synap ADD --chmod=644 https://raw.githubusercontent.com/synaptics-astra/synap-release/v1.5.0/models/dolphin/object_detection/coco/model/mobilenet224_full80/model.synap /synaptics/mobilenet.synap
@@ -102,7 +102,7 @@ proxy:
# Optional: Auth secret that is checked against the X-Proxy-Secret header sent from # Optional: Auth secret that is checked against the X-Proxy-Secret header sent from
# the proxy. If not set, all requests are trusted regardless of origin. # the proxy. If not set, all requests are trusted regardless of origin.
auth_secret: None auth_secret: None
# Optional: The default role to use for proxy auth. Must be "admin" or "viewer" # Optional: The default role to use for proxy auth. Must be "admin", "viewer", a custom role, or "none" to deny
default_role: viewer default_role: viewer
# Optional: The character used to separate multiple values in the proxy headers. (default: shown below) # Optional: The character used to separate multiple values in the proxy headers. (default: shown below)
separator: "," separator: ","
+1 -1
View File
@@ -287,7 +287,7 @@ Frigate exposes a few networking options. IPv6 and the listen ports are set in t
### Enabling IPv6 ### Enabling IPv6
By default Frigate listens on IPv4 only. To also listen on IPv6 (on port `5000`, and on `8971` when TLS is configured), enable it in the `networking` configuration. By default Frigate listens on IPv4 only. To also listen on IPv6 (on port `5000`, and on `8971` when TLS is configured), enable it in the `networking` configuration. A listen port bound to a specific address stays on that address only.
<ConfigTabs> <ConfigTabs>
<TabItem value="ui"> <TabItem value="ui">
+4 -1
View File
@@ -234,6 +234,8 @@ proxy:
Setting `default_role` to `none` denies access instead of falling back to a role. Any proxy-authenticated user whose headers do not match an explicit `role_map` entry receives a 403 response. This is useful when the upstream proxy authenticates a broader set of users than should reach Frigate, so that only mapped groups are allowed in. Setting `default_role` to `none` denies access instead of falling back to a role. Any proxy-authenticated user whose headers do not match an explicit `role_map` entry receives a 403 response. This is useful when the upstream proxy authenticates a broader set of users than should reach Frigate, so that only mapped groups are allowed in.
A `default_role` that does not name a configured role is treated as `none`.
```yaml ```yaml
proxy: proxy:
... ...
@@ -266,7 +268,8 @@ In this example:
- If the proxy passes a role header containing `camera-viewer`, the user is assigned the `viewer` role. - If the proxy passes a role header containing `camera-viewer`, the user is assigned the `viewer` role.
- If the proxy passes a role header containing `operators`, the user is assigned the `operator` custom role. - If the proxy passes a role header containing `operators`, the user is assigned the `operator` custom role.
- If no mapping matches, Frigate falls back to `default_role` if configured, or denies access if `default_role` is `none`. - If no mapping matches, Frigate falls back to `default_role` if configured, or denies access if `default_role` is `none`.
- If `role_map` is not defined, Frigate assumes the role header directly contains `admin`, `viewer`, or a custom role name. - If a group matches but its mapped role no longer exists (for example, a deleted custom role), access is denied.
- If `role_map` is not defined, Frigate assumes the role header directly contains `admin`, `viewer`, or a custom role name, matched without regard to case.
**Note on matching semantics:** **Note on matching semantics:**
+3 -1
View File
@@ -84,7 +84,7 @@ 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) |
@@ -160,6 +160,8 @@ 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.
+28 -7
View File
@@ -53,7 +53,7 @@ Each provider handles one or more **roles**: `chat`, `descriptions`, `embeddings
| Ollama (`ollama`) | ✅ | ✅ | ✅ | ❌ | | Ollama (`ollama`) | ✅ | ✅ | ✅ | ❌ |
| OpenAI (`openai`) | ✅ | ✅ | ❌ | ✅ | | OpenAI (`openai`) | ✅ | ✅ | ❌ | ✅ |
| Azure OpenAI (`azure_openai`) | ✅ | ✅ | ❌ | ✅ | | Azure OpenAI (`azure_openai`) | ✅ | ✅ | ❌ | ✅ |
| Google Gemini (`gemini`) | ✅ | ✅ | ❌ | ✅ | | Google Gemini (`gemini`) | ✅ | ✅ | ✅ | ✅ |
A ✅ means Frigate can use the provider for that feature. The configured model must also support it: a vision model for descriptions and chat, a multimodal embedding model for embeddings (see [Embedding models](#embedding-models)), and an audio-capable model for transcription. Some features also need extra provider setup, covered in each provider's section below. OpenAI-compatible servers use the `openai` provider, so they follow the OpenAI row. A ✅ means Frigate can use the provider for that feature. The configured model must also support it: a vision model for descriptions and chat, a multimodal embedding model for embeddings (see [Embedding models](#embedding-models)), and an audio-capable model for transcription. Some features also need extra provider setup, covered in each provider's section below. OpenAI-compatible servers use the `openai` provider, so they follow the OpenAI row.
@@ -86,10 +86,11 @@ You must use a vision-capable model with Frigate. The following models are recom
The `embeddings` role needs a different kind of model. Text queries are matched against the stored image embeddings, so the model must be trained to place images and text into the same vector space. A chat or description model will still return vectors when asked, but those vectors are not trained for retrieval and text searches will return poor matches with no error to indicate why. The `embeddings` role needs a different kind of model. Text queries are matched against the stored image embeddings, so the model must be trained to place images and text into the same vector space. A chat or description model will still return vectors when asked, but those vectors are not trained for retrieval and text searches will return poor matches with no error to indicate why.
| Model | Notes | | Model | Type | Notes |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `embeddinggemma-2` | Multimodal embeddings for [Semantic Search](/configuration/semantic_search#genai-provider). Strong semantic search accuracy with efficient inference on a small model. | | `embeddinggemma-2` | `local` | Multimodal embeddings for [Semantic Search](/configuration/semantic_search#genai-provider). Strong semantic search accuracy with efficient inference on a small model. |
| `qwen3-vl-embedding` | Multimodal embeddings for [Semantic Search](/configuration/semantic_search#genai-provider). Good performance, large model that requires strong hardware for inference. | | `qwen3-vl-embedding` | `local` | Multimodal embeddings for [Semantic Search](/configuration/semantic_search#genai-provider). Good performance, large model that requires strong hardware for inference. |
| `gemini-embedding-2` | `cloud` | Multimodal embeddings for [Semantic Search](/configuration/semantic_search#genai-provider) via [Google Gemini](#google-gemini). Sends thumbnails and search text to Google. |
#### Transcription models #### Transcription models
@@ -225,7 +226,7 @@ Frigate supports any provider that implements the OpenAI API standard. This incl
:::tip :::tip
For OpenAI-compatible servers (such as llama.cpp) that don't expose the configured context size in the API response, you can manually specify the context size in `provider_options`: Frigate reads the model's context size from the server when it is reported (such as by vLLM or OpenRouter). For OpenAI-compatible servers (such as llama.cpp) that don't expose the configured context size in the API response, you can manually specify the context size in `provider_options`:
```yaml ```yaml
genai: genai:
@@ -383,6 +384,26 @@ Other HTTP options are available, see the [python-genai documentation](https://g
::: :::
#### Embeddings
Gemini can serve the `embeddings` role for [Semantic Search](/configuration/semantic_search#genai-provider) with a multimodal embedding model such as `gemini-embedding-2`. Give that model its own provider entry.
Reindexing sends every stored thumbnail to Google and uses API quota. See [Network Requirements](/frigate/network_requirements#generative-ai).
```yaml
genai:
gemini_embeddings:
provider: gemini
api_key: "{FRIGATE_GEMINI_API_KEY}"
model: gemini-embedding-2
roles:
- embeddings
semantic_search:
enabled: True
model: gemini_embeddings
```
### OpenAI ### OpenAI
OpenAI does not have a free tier for their API. OpenAI does not have a free tier for their API.
@@ -427,7 +448,7 @@ To use a different OpenAI-compatible API endpoint, set the `OPENAI_BASE_URL` env
:::tip :::tip
For OpenAI-compatible servers (such as llama.cpp) that don't expose the configured context size in the API response, you can manually specify the context size in `provider_options`: Frigate reads the model's context size from the server when it is reported (such as by vLLM or OpenRouter). For OpenAI-compatible servers (such as llama.cpp) that don't expose the configured context size in the API response, you can manually specify the context size in `provider_options`:
```yaml {6,7} ```yaml {6,7}
genai: genai:
+1 -1
View File
@@ -98,7 +98,7 @@ Additionally, when creating and editing camera groups in the UI, you can choose
:::note :::note
Frigate's default dashboard ("All Cameras") will always use the first entry you've defined in streams when playing live streams from your cameras. Frigate's default dashboard ("All Cameras") always uses the first entry in `streams`. That should be your highest quality stream, because Auto starts on the first stream and only steps down from there. To show a lower quality stream on a dashboard, create a camera group and choose the stream in each camera's [streaming settings](#streaming-options-on-camera-group-dashboards) for that group.
::: :::
+1 -1
View File
@@ -9,7 +9,7 @@ import NavPath from "@site/src/components/NavPath";
# Metrics # Metrics
Frigate exposes Prometheus metrics at the `/api/metrics` endpoint that can be used to monitor the performance and health of your Frigate instance. Frigate exposes Prometheus metrics at the `/api/metrics` endpoint that can be used to monitor the performance and health of your Frigate instance. On the authenticated port (8971), the endpoint requires an admin user, so point scrapers at the internal port (5000) as shown below.
## Enabling Telemetry ## Enabling Telemetry
+18 -3
View File
@@ -36,6 +36,8 @@ There are two reasons to use it:
Try the device grants and `EXTRA_GROUPS` first. The `frigate` service runs the API and every ffmpeg process that decodes your camera streams, so listing it puts those back on root as well, not just your detectors. Try the device grants and `EXTRA_GROUPS` first. The `frigate` service runs the API and every ffmpeg process that decodes your camera streams, so listing it puts those back on root as well, not just your detectors.
Listing `go2rtc` without `frigate` doesn't separate the two. go2rtc's API accepts unauthenticated config changes from inside the container, so the unprivileged `frigate` service can make a root go2rtc run ffmpeg with any arguments, which can overwrite any file as root.
A listed service also stops honoring a [custom ffmpeg or go2rtc build](/configuration/advanced/system#custom-dependencies) kept in `/config`, since that directory stays owned by the unprivileged user and a binary there would run as root. `FRIGATE_RUN_AS_ROOT=true` has no such restriction. A listed service also stops honoring a [custom ffmpeg or go2rtc build](/configuration/advanced/system#custom-dependencies) kept in `/config`, since that directory stays owned by the unprivileged user and a binary there would run as root. `FRIGATE_RUN_AS_ROOT=true` has no such restriction.
Recordings and exports are owned by `PUID`/`PGID` as soon as they're written, even by a root service. Snapshots, thumbnails, and other files under `clips/` are corrected on each restart, so they can show as root-owned from the host until then. A listed service also keeps root's home directory, so library caches go to the container layer instead of `/config`. The same applies to the [detector runtimes](/frigate/network_requirements#detector-runtimes) Frigate installs at first start (Hailo, MemryX, AXEngine): a root `frigate` service installs them into `/root/.local`, which is lost when the container is recreated, and never loads a copy left behind in `/config/.local`. Recordings and exports are owned by `PUID`/`PGID` as soon as they're written, even by a root service. Snapshots, thumbnails, and other files under `clips/` are corrected on each restart, so they can show as root-owned from the host until then. A listed service also keeps root's home directory, so library caches go to the container layer instead of `/config`. The same applies to the [detector runtimes](/frigate/network_requirements#detector-runtimes) Frigate installs at first start (Hailo, MemryX, AXEngine): a root `frigate` service installs them into `/root/.local`, which is lost when the container is recreated, and never loads a copy left behind in `/config/.local`.
@@ -71,18 +73,29 @@ Both the script and the boot sweep report progress, so you can tell a slow sweep
``` ```
[INFO] fix-ownership: scanning /media/frigate for ownership mismatches; this may take a while on large filesystems [INFO] fix-ownership: scanning /media/frigate for ownership mismatches; this may take a while on large filesystems
[INFO] fix-ownership: still scanning /media/frigate, 2481000 entries checked, 2390112 need changes
[WARN] fix-ownership: adjusting ownership of 4823941 entries under /media/frigate [WARN] fix-ownership: adjusting ownership of 4823941 entries under /media/frigate
[INFO] fix-ownership: /media/frigate 5% (241197/4823941 entries) [INFO] fix-ownership: /media/frigate 5% (241197/4823941 entries)
[INFO] fix-ownership: /media/frigate 10% (482394/4823941 entries) [INFO] fix-ownership: /media/frigate 10% (482394/4823941 entries)
[INFO] fix-ownership: finished /media/frigate in 12m 4s [INFO] fix-ownership: finished /media/frigate in 12m 4s
``` ```
The scan has no percentage because the total isn't known until it finishes. Watch the boot sweep with `docker logs -f frigate`. The scan has no percentage because the total isn't known until it finishes, so it reports a running count every 30 seconds instead. Watch the boot sweep with `docker logs -f frigate`.
Once the volumes are aligned, start Frigate normally. A file at `/config/.permissions_version` records what was done, so later boots skip the sweep unless you change `PUID`/`PGID`. Once the volumes are aligned, start Frigate normally. A file at `/config/.permissions_version` records what was done, so later boots skip the sweep unless you change `PUID`/`PGID`.
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:
@@ -91,7 +104,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` 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: **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:
``` ```
//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
@@ -382,9 +395,11 @@ One Docker specific trap: published ports are inserted ahead of the host firewal
`telemetry.stats.network_bandwidth` uses nethogs, which needs `CAP_NET_ADMIN` and `CAP_NET_RAW` and therefore root. The stat is turned off automatically when Frigate isn't running as root, with one warning in the log. Use `FRIGATE_ROOT_SERVICES=frigate` (or `FRIGATE_RUN_AS_ROOT=true`) if you need it. `telemetry.stats.network_bandwidth` uses nethogs, which needs `CAP_NET_ADMIN` and `CAP_NET_RAW` and therefore root. The stat is turned off automatically when Frigate isn't running as root, with one warning in the log. Use `FRIGATE_ROOT_SERVICES=frigate` (or `FRIGATE_RUN_AS_ROOT=true`) if you need it.
Rockchip NPU and GPU usage come from `/sys/kernel/debug`, which the kernel makes readable only by root. To keep these stats, bind the two load files into the container as shown in the [Rockchip installation steps](/frigate/installation#rockchip-platform). Without them, Frigate logs one warning and leaves the stats out.
go2rtc's ffmpeg processes no longer appear in Intel GPU stats. Frigate reads per-process GPU usage from `/proc/<pid>/fdinfo`, which the kernel won't let one user read for another user's processes, so anything go2rtc spawns is invisible to it. Overall GPU utilization is unaffected. go2rtc's ffmpeg processes no longer appear in Intel GPU stats. Frigate reads per-process GPU usage from `/proc/<pid>/fdinfo`, which the kernel won't let one user read for another user's processes, so anything go2rtc spawns is invisible to it. Overall GPU utilization is unaffected.
If you mount your own TLS certificate at `/etc/letsencrypt/live/frigate`, the private key has to be readable by the runtime user, which runs nginx. Frigate hands the key to that user at startup if the mount is writable; on a read-only mount, make the key readable by uid 1000 (or your `PUID`) yourself. If you mount your own TLS certificate at `/etc/letsencrypt/live/frigate`, the key and the certificate have to be readable by the runtime user, which runs nginx, and that user has to be able to enter the folders above them. Frigate doesn't change ownership of mounted certificates, so give the key to the runtime user's group (gid 1000, your `PGID`, or the group in Docker's `user:`) with group read on the host. certbot keeps the key's group and group read on renewal, so this is a one-time step.
If you're debugging nginx, run the config check as the runtime user with stdout discarded: If you're debugging nginx, run the config check as the runtime user with stdout discarded:
+2 -2
View File
@@ -682,7 +682,7 @@ To run a model on a DEEPX NPU, list a `deepx` device on that model.
:::info :::info
The DX-RT Python bindings are not part of the Frigate image. They are downloaded and installed into `/config/.local` the first time a DEEPX device is configured, verified against pinned checksums, and updated automatically when a Frigate release pins a new version. If the container has no internet access, see [Detector runtimes](/frigate/network_requirements#detector-runtimes) for how to provide the files yourself. The DX-RT Python bindings are not part of the Frigate image. The `libdxrt-bin` package is downloaded and its `dx_engine` wheel installed into `/config/.local` the first time a DEEPX device is configured, verified against pinned checksums, and updated automatically when a Frigate release pins a new version. The package stays in the runtime cache, so a container recreated without internet access reinstalls from it. If the container has no internet access, see [Detector runtimes](/frigate/network_requirements#detector-runtimes) for how to provide the file yourself.
::: :::
@@ -708,7 +708,7 @@ models:
height: 640 height: 640
``` ```
For PPU models, use a `.dxnn` compiled with DX-COM 2.4.0 or later. Frigate reads the PPU head layout the compiler writes into the file and refuses to load a PPU model without it. For PPU models, use a `.dxnn` compiled with DX-COM 2.4.0 or later. Frigate reads the PPU head layout the compiler writes into the file and refuses to load a PPU model without it. Both the older padded header and the v9 format DX-COM 2.5.0 writes are read, so models from either compiler work with DX-RT 3.5.0.
`model_type` must be set to `yolo-generic` or `yolox` to match the model; `yolo-generic` is the recommended default unless the model is a raw YOLOX export. Frigate defaults it to `ssd`, which this detector does not support, so the detector refuses to start on a model that leaves it unset. `model_type` must be set to `yolo-generic` or `yolox` to match the model; `yolo-generic` is the recommended default unless the model is a raw YOLOX export. Frigate defaults it to `ssd`, which this detector does not support, so the detector refuses to start on a model that leaves it unset.
+2 -1
View File
@@ -414,11 +414,12 @@ Avoid removing audio from only one of the two streams (for example with `-an`).
As a general rule, features that read recordings prefer the main stream and fall back to the sub stream for time ranges where the main recordings have expired. Analytics features use only the main stream. As a general rule, features that read recordings prefer the main stream and fall back to the sub stream for time ranges where the main recordings have expired. Analytics features use only the main stream.
| Feature | Stream used | | Feature | Stream used |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Recording playback (History and Review) | Both (main preferred with sub fallback by default), or exactly one stream when a quality is selected manually | | Recording playback (History and Review) | Both (main preferred with sub fallback by default), or exactly one stream when a quality is selected manually |
| Tracking details and Explore clip playback | Main, falling back to sub where the main recordings have expired | | Tracking details and Explore clip playback | Main, falling back to sub where the main recordings have expired |
| Exports | Both (main preferred with sub fallback by default), or exactly one stream when a quality is selected in the export dialog | | Exports | Both (main preferred with sub fallback by default), or exactly one stream when a quality is selected in the export dialog |
| Clip downloads | Main; sub is used when no main recordings remain in the range (streams are never mixed in one file) | | Clip downloads | Main; sub is used when no main recordings remain in the range (streams are never mixed in one file) |
| Debug replay | Main; sub is used when no main recordings remain in the range (streams are never mixed in one file) |
| Frames grabbed from a recording in History (download snapshot, submit frame to Frigate+) | Main preferred, sub fallback | | Frames grabbed from a recording in History (download snapshot, submit frame to Frigate+) | Main preferred, sub fallback |
| Audio extraction (e.g., transcription) | Main preferred, sub fallback | | Audio extraction (e.g., transcription) | Main preferred, sub fallback |
| Motion search | Main only | | Motion search | Main only |
+1 -1
View File
@@ -223,7 +223,7 @@ For security reasons, the `echo:`, `expr:`, and `exec:` stream sources are disab
go2rtc's `${VAR:default}` variable syntax is also disabled by default in stream sources, since its default can name one of those sources. Use Frigate's [`{FRIGATE_*}` substitution](./config.md#environment-variable-substitution) instead. go2rtc's `${VAR:default}` variable syntax is also disabled by default in stream sources, since its default can name one of those sources. Use Frigate's [`{FRIGATE_*}` substitution](./config.md#environment-variable-substitution) instead.
If you attempt to use these sources in your configuration, the streams will be removed and an error message will be printed in the logs. If you attempt to use these sources in your configuration, the streams will be removed and an error message will be printed in the logs. go2rtc also refuses to run anything but Frigate's ffmpeg from `exec:` and `echo:` sources added through its API or `/config/go2rtc_homekit.yml`.
To enable these sources, you must set the environment variable `GO2RTC_ALLOW_ARBITRARY_EXEC=true`. This can be done in your Docker Compose file or container environment, or for Home Assistant App users with the `go2rtc_allow_arbitrary_exec` option in the App's configuration. The `environment_vars` section of the Frigate config can't enable it: To enable these sources, you must set the environment variable `GO2RTC_ALLOW_ARBITRARY_EXEC=true`. This can be done in your Docker Compose file or container environment, or for Home Assistant App users with the `go2rtc_allow_arbitrary_exec` option in the App's configuration. The `environment_vars` section of the Frigate config can't enable it:
+1 -1
View File
@@ -47,7 +47,7 @@ frigate:
Within the folder, the private key is expected to be named `privkey.pem` and the certificate is expected to be named `fullchain.pem`. Mounted certificates take precedence over the self signed pair in `/config/tls`. Within the folder, the private key is expected to be named `privkey.pem` and the certificate is expected to be named `fullchain.pem`. Mounted certificates take precedence over the self signed pair in `/config/tls`.
`privkey.pem` must be readable by the runtime user that runs NGINX. Frigate hands it over at startup when the mount is writable; on a `:ro` mount, make it readable by uid 1000 (or your `PUID`) yourself. See [Running as a non-root user](/configuration/non_root). `privkey.pem` and `fullchain.pem` must be readable by the runtime user that runs NGINX, and that user must be able to enter the folders above them. Frigate doesn't change ownership of mounted certificates, so give the key to the runtime user's group (gid 1000, your `PGID`, or the group in Docker's `user:`) with group read on the host, for example `chgrp 1000 privkey.pem && chmod g+r privkey.pem`. certbot keeps the key's group and group read on renewal, so this is a one-time step. See [Running as a non-root user](/configuration/non_root).
Note that certbot uses symlinks, and those can't be followed by the container unless it has access to the targets as well, so if using certbot you'll also have to mount the `archive` folder for your domain, e.g.: Note that certbot uses symlinks, and those can't be followed by the container unless it has access to the targets as well, so if using certbot you'll also have to mount the `archive` folder for your domain, e.g.:
+4 -5
View File
@@ -9,7 +9,7 @@ import CommunityBadge from '@site/src/components/CommunityBadge';
Cameras that output H.264 video and AAC audio will offer the most compatibility with all features of Frigate and Home Assistant. It is also helpful if your camera supports multiple substreams to allow different resolutions to be used for detection, streaming, and recordings without re-encoding. Cameras that output H.264 video and AAC audio will offer the most compatibility with all features of Frigate and Home Assistant. It is also helpful if your camera supports multiple substreams to allow different resolutions to be used for detection, streaming, and recordings without re-encoding.
I recommend Dahua, Hikvision, and Amcrest in that order. Dahua edges out Hikvision because they are easier to find and order, not because they are better cameras. I personally use Dahua cameras because they are easier to purchase directly. In my experience Dahua and Hikvision both have multiple streams with configurable resolutions and frame rates and rock solid streams. They also both have models with large sensors well known for excellent image quality at night. Not all the models are equal. Larger sensors are better than higher resolutions; especially at night. Amcrest is the fallback recommendation because they are rebranded Dahuas. They are rebranding the lower end models with smaller sensors or less configuration options. I recommend Dahua and Hikvision. Dahua edges out Hikvision because they are easier to find and order, not because they are better cameras. I personally use Dahua cameras because they are easier to purchase directly. In my experience Dahua and Hikvision both have multiple streams with configurable resolutions and frame rates and rock solid streams. They also both have models with large sensors well known for excellent image quality at night. Not all the models are equal. Larger sensors are better than higher resolutions; especially at night.
WiFi cameras are not recommended as [their streams are less reliable and cause connection loss and/or lost video data](https://ipcamtalk.com/threads/camera-conflicts.68142/#post-738821), especially when more than a few WiFi cameras will be used at the same time. WiFi cameras are not recommended as [their streams are less reliable and cause connection loss and/or lost video data](https://ipcamtalk.com/threads/camera-conflicts.68142/#post-738821), especially when more than a few WiFi cameras will be used at the same time.
@@ -17,10 +17,9 @@ Many users have reported various issues with 4K-plus Reolink cameras, it is best
Here are some of the cameras I recommend: Here are some of the cameras I recommend:
- <a href="https://amzn.to/4fwoNWA" target="_blank" rel="nofollow noopener sponsored">Loryta(Dahua) IPC-T549M-ALED-S3</a> (affiliate link) - <a href="https://link.amazon/B0hnw1JEZ" target="_blank" rel="nofollow noopener sponsored">GemaVision(Dahua) IPC-T549M-ALED-S3</a> (affiliate link)
- <a href="https://amzn.to/3YXpcMw" target="_blank" rel="nofollow noopener sponsored">Loryta(Dahua) IPC-T54IR-AS</a> (affiliate link) - <a href="https://link.amazon/B06naLGqL" target="_blank" rel="nofollow noopener sponsored">GemaVision(Dahua) IPC-T54IR-AS</a> (affiliate link)
- <a href="https://amzn.to/3AvBHoY" target="_blank" rel="nofollow noopener sponsored">Amcrest IP5M-T1179EW-AI-V3</a> (affiliate link) - <a href="https://link.amazon/B0iD97zC7" target="_blank" rel="nofollow noopener sponsored">HIKVISION DS-2CD2387G2P-LSU/SL ColorVu 8MP Panoramic Turret IP Camera</a> (affiliate link)
- <a href="https://www.bhphotovideo.com/c/product/1705511-REG/hikvision_colorvu_ds_2cd2387g2p_lsu_sl_8mp_network.html" target="_blank" rel="nofollow noopener">HIKVISION DS-2CD2387G2P-LSU/SL ColorVu 8MP Panoramic Turret IP Camera</a> (affiliate link)
I may earn a small commission for my endorsement, recommendation, testimonial, or link to any products or services from this website. I may earn a small commission for my endorsement, recommendation, testimonial, or link to any products or services from this website.
+32 -9
View File
@@ -394,22 +394,22 @@ DEEPX NPU support in Frigate is developed and maintained by [Sixfab](https://six
#### Versions #### Versions
A DEEPX install has several separately versioned pieces, and they all have to agree. The driver, the runtime, and the daemon live on the Docker host; Frigate itself carries only the Python bindings, which it downloads on first start: A DEEPX install has several separately versioned pieces, and they all have to agree. The driver, the runtime, and the daemon live on the Docker host; Frigate itself carries none of them, and downloads the matching runtime package for its Python bindings on first start:
| Component | Version | Installed on | Installed by | | Component | Version | Installed on | Installed by |
| -------------- | -------- | ------------ | ------------------------- | | -------------- | -------- | ------------ | ------------------------- |
| Kernel driver | `v2.6.0` | Host | `user_installation.sh` | | Kernel driver | `v2.7.0` | Host | `user_installation.sh` |
| DX-RT runtime | `v3.4.0` | Host | `user_installation.sh` | | DX-RT runtime | `v3.5.0` | Host | `user_installation.sh` |
| NPU firmware | `v2.7.4` | The module | Flashed from the host | | NPU firmware | `v2.7.6` | The module | Flashed from the host |
| DX-RT bindings | `v3.4.0` | Frigate | Downloaded at first start | | DX-RT bindings | `v3.5.0` | Frigate | Downloaded at first start |
:::warning :::warning
A version mismatch does not produce a startup error. It typically shows up as inference requests that are accepted but never return a result, so detections simply stop appearing while Frigate looks healthy. If that happens after a Frigate upgrade, check every version in the table before anything else. A mismatch between the runtime and its Python bindings is caught at import, because the bindings refuse to load against a different runtime version. A mismatch between the runtime, the kernel driver and the firmware can still show up only as inference requests that are accepted but never return a result, so detections stop appearing while Frigate looks healthy. If that happens after a Frigate upgrade, check every version in the table before anything else.
::: :::
The installation script installs the DX-RT runtime on the host and enables `dxrt.service`, so the daemon starts at boot and any other program on the host can share the NPU with Frigate. Check the firmware version with `dxrt-cli --status` and update the module if it does not match the table above. The installation script installs the DX-RT runtime on the host and enables `dxrt.service`, so the daemon starts at boot and any other program on the host can share the NPU with Frigate. Check the firmware version with `dxcli -s` and update the module if it does not match the table above.
#### Installation #### Installation
@@ -435,6 +435,8 @@ ls /run/dxrt/
#### Setup #### Setup
The DX-RT bindings are installed on first start, so the container needs to reach GitHub once. For a host without internet access, seed the package as described in [Detector runtimes](/frigate/network_requirements#detector-runtimes).
To set up Frigate, follow the default installation instructions, for example: `ghcr.io/blakeblackshear/frigate:stable` To set up Frigate, follow the default installation instructions, for example: `ghcr.io/blakeblackshear/frigate:stable`
#### Docker configuration #### Docker configuration
@@ -456,7 +458,7 @@ Add one `--device` per NPU, contiguously from `/dev/dxrt0`, since the client sto
The installation script configures `dxrt.service` to place its socket in `/run/dxrt` through a systemd drop-in. Mounting the directory rather than the socket file means the container sees the new socket after `dxrt.service` is restarted, rather than holding on to a deleted one. The installation script configures `dxrt.service` to place its socket in `/run/dxrt` through a systemd drop-in. Mounting the directory rather than the socket file means the container sees the new socket after `dxrt.service` is restarted, rather than holding on to a deleted one.
`dxrtd` listens on an abstract socket as well, but that one does not cross into a container, so Frigate names the filesystem socket through `DXRT_DYNAMIC_IPC_ENDPOINT` on your behalf. Set that variable on the container yourself only if the daemon listens somewhere else, which means you also set it for `dxrtd` through its own systemd drop-in. The script writes `/etc/systemd/system/dxrt.service.d/frigate.conf` for exactly that, and has `dxrt.service` link the socket to `/tmp/dxrt_dynamic_ipc.sock` when it starts, so the host's own `dxrt-cli` and `dxtop` keep finding it at the default path they fall back to. `dxrtd` listens on an abstract socket as well, but that one does not cross into a container, so Frigate names the filesystem socket through `DXRT_DYNAMIC_IPC_ENDPOINT` on your behalf. Set that variable on the container yourself only if the daemon listens somewhere else, which means you also set it for `dxrtd` through its own systemd drop-in. The script writes `/etc/systemd/system/dxrt.service.d/frigate.conf` for exactly that, and has `dxrt.service` link the socket to `/tmp/dxrt_dynamic_ipc.sock` when it starts, so the host's own `dxcli` and `dxtop` keep finding it at the default path they fall back to.
:::note :::note
@@ -468,7 +470,7 @@ The device node is needed as well as the socket, because the client opens the NP
`/dev/shm` does not need sharing. `/dev/shm` does not need sharing.
The DX-RT python bindings are not shipped in the Frigate image. Frigate downloads them on first start when a DEEPX detector is configured, and caches them under `/config`. The DX-RT python bindings are not shipped in the Frigate image. Frigate downloads the matching `libdxrt-bin` package on first start when a DEEPX detector is configured, takes the `dx_engine` wheel and the libraries it links against out of it, and keeps the package under `/config` so later reinstalls need no download.
#### Configuration #### Configuration
@@ -523,6 +525,27 @@ or add these options to your `docker run` command:
--volume /sys/:/sys/:ro --volume /sys/:/sys/:ro
``` ```
Frigate reads NPU and GPU (RGA) usage from `/sys/kernel/debug`, which the kernel makes readable only by root. Frigate's services don't run as root, so to show these stats on the System page, bind the two load files into the container. This works with or without `privileged: true`:
```yaml
volumes:
- /sys/kernel/debug/rknpu/load:/rockchip/rknpu/load:ro
- /sys/kernel/debug/rkrga/load:/rockchip/rkrga/load:ro
```
or for `docker run`:
```
--volume /sys/kernel/debug/rknpu/load:/rockchip/rknpu/load:ro \
--volume /sys/kernel/debug/rkrga/load:/rockchip/rkrga/load:ro
```
These lines are optional, and everything else works without them. Only add a line for a file that exists on your host, because Docker won't start the container if one is missing. Check with:
```
$ sudo ls /sys/kernel/debug/rknpu/load /sys/kernel/debug/rkrga/load
```
#### Configuration #### Configuration
Next, you should configure [hardware object detection](/configuration/object_detectors#rockchip-platform) and [hardware video processing](/configuration/hardware_acceleration_video#rockchip-platform). Next, you should configure [hardware object detection](/configuration/object_detectors#rockchip-platform) and [hardware video processing](/configuration/hardware_acceleration_video#rockchip-platform).
+5 -2
View File
@@ -66,15 +66,18 @@ The SDKs for a few hardware detectors are not shipped in the Frigate image. They
| [MemryX MX3](/configuration/object_detectors#memryx-mx3) | 2.1.0 | `mx_accl_frigate-2.1.0.zip` (the release source archive, renamed) | [GitHub archive](https://github.com/memryx/mx_accl_frigate/archive/refs/tags/v2.1.0.zip) | | [MemryX MX3](/configuration/object_detectors#memryx-mx3) | 2.1.0 | `mx_accl_frigate-2.1.0.zip` (the release source archive, renamed) | [GitHub archive](https://github.com/memryx/mx_accl_frigate/archive/refs/tags/v2.1.0.zip) |
| [AXERA AXEngine](/configuration/object_detectors#axera) | 0.1.3 | `axengine-0.1.3-py3-none-any.whl` | [GitHub release](https://github.com/AXERA-TECH/pyaxengine/releases/tag/0.1.3-frigate) | | [AXERA AXEngine](/configuration/object_detectors#axera) | 0.1.3 | `axengine-0.1.3-py3-none-any.whl` | [GitHub release](https://github.com/AXERA-TECH/pyaxengine/releases/tag/0.1.3-frigate) |
| [Axelera Metis](/configuration/object_detectors#axelera-metis) | 1.8.0 | `axelera_runtime-1.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl` on x86, `axelera_runtime-1.8.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl` on arm64, plus `axelera_firmware-1.8.0-py3-none-any.whl` on both | [Axelera Artifactory PyPI](https://software.axelera.ai/artifactory/#web/ui/redirect/pypi/axelera-pypi/simple) | | [Axelera Metis](/configuration/object_detectors#axelera-metis) | 1.8.0 | `axelera_runtime-1.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl` on x86, `axelera_runtime-1.8.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl` on arm64, plus `axelera_firmware-1.8.0-py3-none-any.whl` on both | [Axelera Artifactory PyPI](https://software.axelera.ai/artifactory/#web/ui/redirect/pypi/axelera-pypi/simple) |
| [DEEPX NPU](/configuration/object_detectors#deepx-npu) | 3.5.0 | `libdxrt-bin_3.5.0_amd64.deb` on x86, `libdxrt-bin_3.5.0_arm64.deb` on arm64 (Frigate installs the `dx_engine` wheel the package carries) | [GitHub](https://github.com/DEEPX-AI/dx_rt/tree/v3.5.0/release/3.5.0) |
If the container cannot reach GitHub, provide the files yourself: If the container cannot reach GitHub, provide the files yourself:
1. Download the files for your architecture on a machine with internet access. 1. Download the files for your architecture on a machine with internet access.
2. Place them, with exactly the file names listed above, in `/config/model_cache/runtimes/<detector>/`, where `<detector>` is the detector named in your config's `devices` (`hailo`, `memryx`, `axengine`, or `axelera`). 2. Place them, with exactly the file names listed above, in `/config/model_cache/runtimes/<detector>/`, where `<detector>` is the detector named in your config's `devices` (`hailo`, `memryx`, `axengine`, `axelera`, or `deepx`).
3. Start Frigate. Files whose checksum matches are installed without any download; a file with the wrong checksum is discarded and downloaded again, so a failed startup log names the file to replace. 3. Start Frigate. Files whose checksum matches are installed without any download; a file with the wrong checksum is discarded and downloaded again, so a failed startup log names the file to replace.
The `GITHUB_ENDPOINT` mirror variable below applies to these downloads as well. The `GITHUB_ENDPOINT` mirror variable below applies to these downloads as well.
DEEPX pins the runtime package rather than a wheel, so seed the `.deb`. Frigate takes the `dx_engine` wheel and the libraries out of it and keeps the package in the cache, so reinstalling after a container is recreated needs no download.
### Preventing Model Downloads ### Preventing Model Downloads
If you have already downloaded all required models and want to prevent Frigate from attempting any outbound connections to HuggingFace or the Transformers library, set the following environment variables on your Frigate container: If you have already downloaded all required models and want to prevent Frigate from attempting any outbound connections to HuggingFace or the Transformers library, set the following environment variables on your Frigate container:
@@ -114,7 +117,7 @@ See [Frigate+](/integrations/plus) for details.
### Generative AI ### Generative AI
When a Generative AI provider is configured, Frigate sends images and prompts to the configured provider for event descriptions, chat, and camera monitoring. Available providers: When a Generative AI provider is configured, Frigate sends images and prompts to the configured provider for the various features that are enabled. Available providers:
| Provider | Internet Required | | Provider | Internet Required |
| ------------- | --------------------------------------------------------------- | | ------------- | --------------------------------------------------------------- |
+7 -7
View File
@@ -5,7 +5,7 @@ title: Updating
# Updating Frigate # Updating Frigate
The current stable version of Frigate is **0.18.2**. The release notes and any breaking changes for this version can be found on the [Frigate GitHub releases page](https://github.com/blakeblackshear/frigate/releases/tag/v0.18.2). The current stable version of Frigate is **0.18.3**. The release notes and any breaking changes for this version can be found on the [Frigate GitHub releases page](https://github.com/blakeblackshear/frigate/releases/tag/v0.18.3).
Keeping Frigate up to date ensures you benefit from the latest features, performance improvements, and bug fixes. The update process varies slightly depending on your installation method (Docker, Home Assistant App, etc.). Below are instructions for the most common setups. Keeping Frigate up to date ensures you benefit from the latest features, performance improvements, and bug fixes. The update process varies slightly depending on your installation method (Docker, Home Assistant App, etc.). Below are instructions for the most common setups.
@@ -31,21 +31,21 @@ If you’re running Frigate via Docker (recommended method), follow these steps:
2. **Update and Pull the Latest Image**: 2. **Update and Pull the Latest Image**:
- If using Docker Compose: - If using Docker Compose:
- Edit your `docker-compose.yml` file to specify the desired version tag (e.g., `0.18.2` instead of `0.17.1`). For example: - Edit your `docker-compose.yml` file to specify the desired version tag (e.g., `0.18.3` instead of `0.17.1`). For example:
```yaml ```yaml
services: services:
frigate: frigate:
image: ghcr.io/blakeblackshear/frigate:0.18.2 image: ghcr.io/blakeblackshear/frigate:0.18.3
``` ```
- Then pull the image: - Then pull the image:
```bash ```bash
docker pull ghcr.io/blakeblackshear/frigate:0.18.2 docker pull ghcr.io/blakeblackshear/frigate:0.18.3
``` ```
- **Note for `stable` Tag Users**: If your `docker-compose.yml` uses the `stable` tag (e.g., `ghcr.io/blakeblackshear/frigate:stable`), you don’t need to update the tag manually. The `stable` tag always points to the latest stable release after pulling. - **Note for `stable` Tag Users**: If your `docker-compose.yml` uses the `stable` tag (e.g., `ghcr.io/blakeblackshear/frigate:stable`), you don’t need to update the tag manually. The `stable` tag always points to the latest stable release after pulling.
- If using `docker run`: - If using `docker run`:
- Pull the image with the appropriate tag (e.g., `0.18.2`, `0.18.2-tensorrt`, or `stable`): - Pull the image with the appropriate tag (e.g., `0.18.3`, `0.18.3-tensorrt`, or `stable`):
```bash ```bash
docker pull ghcr.io/blakeblackshear/frigate:0.18.2 docker pull ghcr.io/blakeblackshear/frigate:0.18.3
``` ```
3. **Start the Container**: 3. **Start the Container**:
@@ -100,7 +100,7 @@ If an update causes issues:
1. Stop Frigate. 1. Stop Frigate.
2. Restore your backed-up config file and database. 2. Restore your backed-up config file and database.
3. Revert to the previous image version: 3. Revert to the previous image version:
- For Docker: Specify an older tag (e.g., `ghcr.io/blakeblackshear/frigate:0.18.1`) in your `docker run` command. - For Docker: Specify an older tag (e.g., `ghcr.io/blakeblackshear/frigate:0.18.2`) in your `docker run` command.
- For Docker Compose: Edit your `docker-compose.yml`, specify the older version tag (e.g., `ghcr.io/blakeblackshear/frigate:0.16.4`), and re-run `docker compose up -d`. - For Docker Compose: Edit your `docker-compose.yml`, specify the older version tag (e.g., `ghcr.io/blakeblackshear/frigate:0.16.4`), and re-run `docker compose up -d`.
- For Home Assistant: Restore from the app/addon backup you took before you updated. - For Home Assistant: Restore from the app/addon backup you took before you updated.
4. Verify the old version is running again. 4. Verify the old version is running again.
@@ -13,60 +13,92 @@ Please use your own knowledge to assess and vet them before you install anything
::: :::
## [Advanced Camera Card (formerly known as Frigate Card](https://card.camera/#/README) ## Cameras and Streaming
The [Advanced Camera Card](https://card.camera/#/README) is a Home Assistant dashboard card with deep Frigate integration. Tools that help get video from your cameras into Frigate, or change how Frigate's video is delivered.
## [cctvQL](https://github.com/arunrajiah/cctvql) ### [frigate-abr](https://github.com/007hacky007/frigate-abr)
[frigate-abr](https://github.com/007hacky007/frigate-abr) is a drop-in Docker image of Frigate that adds adaptive bitrate (ABR) playback for recordings: a sidecar transcodes footage to lower quality tiers on demand, for reviewing over slow remote connections. Segments are transcoded when played and cached, so no additional stream is recorded. Frigate itself is not modified.
### [reostream](https://github.com/VoltTech21/reostream)
[reostream](https://github.com/VoltTech21/reostream) is a proxy for Reolink cameras that pulls video over Reolink's own protocol (the one the Reolink app and NVR use) instead of the camera's RTSP server, and serves it back as RTSP for go2rtc and Frigate. It helps models whose RTSP stream smears, drops frames or loses full resolution, and supports two-way talk.
### [Scrypted - Frigate bridge plugin](https://github.com/apocaliss92/scrypted-frigate-bridge)
[Scrypted - Frigate bridge](https://github.com/apocaliss92/scrypted-frigate-bridge) is a plugin that allows you to ingest Frigate detections, motion, videoclips on Scrypted as well as provide templates to export rebroadcast configurations on Frigate.
### [Strix](https://github.com/eduard256/Strix)
[Strix](https://github.com/eduard256/Strix) auto-discovers working stream URLs for IP cameras and generates ready-to-use Frigate configs. It tests thousands of URL patterns against your camera and supports cameras without RTSP or ONVIF. 67K+ camera models from 3.6K+ brands.
## Events and Media
Tools that enrich, query, or back up the events, snapshots, and reviews Frigate produces.
### [cctvQL](https://github.com/arunrajiah/cctvql)
[cctvQL](https://github.com/arunrajiah/cctvql) is a natural language query layer for Frigate and other CCTV systems. It connects to Frigate's REST API and MQTT broker to let you ask conversational questions about cameras and events (e.g. "Was there motion at the front door last night?"), with support for real-time event streaming, anomaly detection, PTZ control, alert rules, and a Home Assistant custom component. [cctvQL](https://github.com/arunrajiah/cctvql) is a natural language query layer for Frigate and other CCTV systems. It connects to Frigate's REST API and MQTT broker to let you ask conversational questions about cameras and events (e.g. "Was there motion at the front door last night?"), with support for real-time event streaming, anomaly detection, PTZ control, alert rules, and a Home Assistant custom component.
## [Double Take](https://github.com/skrashevich/double-take) ### [Double Take](https://github.com/skrashevich/double-take)
[Double Take](https://github.com/skrashevich/double-take) provides a unified UI and API for processing and training images for facial recognition. [Double Take](https://github.com/skrashevich/double-take) provides a unified UI and API for processing and training images for facial recognition.
It supports automatically setting the sub labels in Frigate for person objects that are detected and recognized. It supports automatically setting the sub labels in Frigate for person objects that are detected and recognized.
This is a fork (with fixed errors and new features) of [original Double Take](https://github.com/jakowenko/double-take) project which, unfortunately, isn't being maintained by author. This is a fork (with fixed errors and new features) of [original Double Take](https://github.com/jakowenko/double-take) project which, unfortunately, isn't being maintained by author.
## [frigate-abr](https://github.com/007hacky007/frigate-abr) ### [Frigate Snap-Sync](https://github.com/thequantumphysicist/frigate-snap-sync/)
[frigate-abr](https://github.com/007hacky007/frigate-abr) is a drop-in Docker image of Frigate that adds adaptive bitrate (ABR) playback for recordings: a sidecar transcodes footage to lower quality tiers on demand, for reviewing over slow remote connections. Segments are transcoded when played and cached, so no additional stream is recorded. Frigate itself is not modified.
## [Frigate Notify](https://github.com/0x2142/frigate-notify)
[Frigate Notify](https://github.com/0x2142/frigate-notify) is a simple app designed to send notifications from Frigate to your favorite platforms. Intended to be used with standalone Frigate installations - Home Assistant not required, MQTT is optional but recommended.
## [Frigate Notify Alert](https://github.com/Sysoev86/frigate-notify-alert)
[Frigate Notify Alert](https://github.com/Sysoev86/frigate-notify-alert) sends Frigate events to Telegram as a photo + video media group. It supports multiple camera groups (each notifying its own chat), optional zone filtering (notify only when an object enters a chosen zone), and in-chat buttons to pause notifications for a set time. Works with standalone Frigate over MQTT; Home Assistant not required.
## [Frigate Snap-Sync](https://github.com/thequantumphysicist/frigate-snap-sync/)
[Frigate Snap-Sync](https://github.com/thequantumphysicist/frigate-snap-sync/) is a program that works in tandem with Frigate. It responds to Frigate when a snapshot or a review is made (and more can be added), and uploads them to one or more remote server(s) of your choice. [Frigate Snap-Sync](https://github.com/thequantumphysicist/frigate-snap-sync/) is a program that works in tandem with Frigate. It responds to Frigate when a snapshot or a review is made (and more can be added), and uploads them to one or more remote server(s) of your choice.
## [Frigate telegram](https://github.com/OldTyT/frigate-telegram) ## Notifications
Standalone apps that send Frigate events to messaging platforms without requiring Home Assistant. For notifications through Home Assistant, see [Camera AutoNotify](#camera-autonotify).
### [Frigate Notify](https://github.com/0x2142/frigate-notify)
[Frigate Notify](https://github.com/0x2142/frigate-notify) is a simple app designed to send notifications from Frigate to your favorite platforms. Intended to be used with standalone Frigate installations - Home Assistant not required, MQTT is optional but recommended.
### [Frigate Notify Alert](https://github.com/Sysoev86/frigate-notify-alert)
[Frigate Notify Alert](https://github.com/Sysoev86/frigate-notify-alert) sends Frigate events to Telegram as a photo + video media group. It supports multiple camera groups (each notifying its own chat), optional zone filtering (notify only when an object enters a chosen zone), and in-chat buttons to pause notifications for a set time. Works with standalone Frigate over MQTT; Home Assistant not required.
### [Frigate telegram](https://github.com/OldTyT/frigate-telegram)
[Frigate telegram](https://github.com/OldTyT/frigate-telegram) makes it possible to send events from Frigate to Telegram. Events are sent as a message with a text description, video, and thumbnail. [Frigate telegram](https://github.com/OldTyT/frigate-telegram) makes it possible to send events from Frigate to Telegram. Events are sent as a message with a text description, video, and thumbnail.
## [FrigatePiP](https://github.com/maciejgornicz/frigate-pip) ## Clients and Viewers
Apps and displays for viewing Frigate outside of its built-in web UI.
### [FrigatePiP](https://github.com/maciejgornicz/frigate-pip)
[FrigatePiP](https://github.com/maciejgornicz/frigate-pip) pops up a small picture-in-picture window with a camera's live video in a corner of the screen when Frigate detects an object, and closes it when the activity ends. It runs as a Windows tray app and on Linux (desktop windows, a console framebuffer, a terminal or tmux popups), receives events over Frigate's WebSocket or MQTT and plays the go2rtc RTSP stream with hardware decoding and camera audio. [FrigatePiP](https://github.com/maciejgornicz/frigate-pip) pops up a small picture-in-picture window with a camera's live video in a corner of the screen when Frigate detects an object, and closes it when the activity ends. It runs as a Windows tray app and on Linux (desktop windows, a console framebuffer, a terminal or tmux popups), receives events over Frigate's WebSocket or MQTT and plays the go2rtc RTSP stream with hardware decoding and camera audio.
## [kiosk-monitor](https://github.com/extremeshok/kiosk-monitor) ### [kiosk-monitor](https://github.com/extremeshok/kiosk-monitor)
[kiosk-monitor](https://github.com/extremeshok/kiosk-monitor) is a Raspberry Pi watchdog that runs Chromium fullscreen on a Frigate dashboard (optionally with VLC on a second monitor for an RTSP camera stream), auto-restarts on frozen screens or unreachable URLs, and ships a Birdseye-aware Chromium helper that auto-sizes the grid to the display. [kiosk-monitor](https://github.com/extremeshok/kiosk-monitor) is a Raspberry Pi watchdog that runs Chromium fullscreen on a Frigate dashboard (optionally with VLC on a second monitor for an RTSP camera stream), auto-restarts on frozen screens or unreachable URLs, and ships a Birdseye-aware Chromium helper that auto-sizes the grid to the display.
## [Periscope](https://github.com/maksz42/periscope) ### [Periscope](https://github.com/maksz42/periscope)
[Periscope](https://github.com/maksz42/periscope) is a lightweight Android app that turns old devices into live viewers for Frigate. It works on Android 2.2 and above, including Android TV. It supports authentication and HTTPS. [Periscope](https://github.com/maksz42/periscope) is a lightweight Android app that turns old devices into live viewers for Frigate. It works on Android 2.2 and above, including Android TV. It supports authentication and HTTPS.
## [reostream](https://github.com/VoltTech21/reostream) ### [yuFriEye](https://apps.apple.com/app/id6832456692)
[reostream](https://github.com/VoltTech21/reostream) is a proxy for Reolink cameras that pulls video over Reolink's own protocol (the one the Reolink app and NVR use) instead of the camera's RTSP server, and serves it back as RTSP for go2rtc and Frigate. It helps models whose RTSP stream smears, drops frames or loses full resolution, and supports two-way talk. [yuFriEye](https://apps.apple.com/app/id6832456692) is a free native iOS, iPadOS and macOS client for Frigate. It shows the live camera grid with low-latency go2rtc streams, alerts and detections with clip playback and motion boxes, recordings by day with continuous playback, Frigate and go2rtc logs, and supports multiple servers with local and remote addresses. Works with or without Frigate authentication; no account or data collection.
## [Scrypted - Frigate bridge plugin](https://github.com/apocaliss92/scrypted-frigate-bridge) ## Home Assistant
[Scrypted - Frigate bridge](https://github.com/apocaliss92/scrypted-frigate-bridge) is a plugin that allows you to ingest Frigate detections, motion, videoclips on Scrypted as well as provide templates to export rebroadcast configurations on Frigate. Cards and Home Assistant Marketplace integrations that build on the [Frigate Home Assistant integration](/integrations/home-assistant).
## [Strix](https://github.com/eduard256/Strix) ### [Advanced Camera Card (formerly known as Frigate Card)](https://card.camera/#/README)
[Strix](https://github.com/eduard256/Strix) auto-discovers working stream URLs for IP cameras and generates ready-to-use Frigate configs. It tests thousands of URL patterns against your camera and supports cameras without RTSP or ONVIF. 67K+ camera models from 3.6K+ brands. The [Advanced Camera Card](https://card.camera/#/README) is a Home Assistant dashboard card with deep Frigate integration.
### [Auto Arm](https://autoarm.rhizomatics.org.uk)
Home Assistant Marketplace integration to automatically manage alarm state based on time of day, occupancy, sun state, physical buttons etc. Can synchronize Frigate profiles to alarm state, so for example use `disarmed` profile to reduce noisy notifications when occupied during the day.
### [Camera AutoNotify](https://camera-autonotify.rhizomatics.org.uk)
Home Assistant Marketplace integration to set up notifications for Frigate cameras without use of blueprints or automations. Triggered by camera events and optionally by GenAI reviews, with option for daily/periodic GenAI Review Report emailed, and alerts if Frigate or any cameras are unavailable. Integration with [Supernotify](https://supernotify.rhizomatics.org.uk/) to auto configure mobile devices and customize notifications for alarm state, occupancy etc.
+121
View File
@@ -0,0 +1,121 @@
---
id: choosing_a_model
title: Choosing a model
---
Frigate+ offers several model types, sizes, and input resolutions. This page compares their accuracy and speed to help you decide which one to request. Make sure the model type you choose is supported by your detector, as shown in the [supported detector types](./index.md#supported-detector-types) table.
## Recommendations
- **YOLOv9-s at 320** is the balanced default if your hardware runs it well. It detects about twice as many objects as MobileDet, and 15 more per 100 than YOLO-NAS-s at 320, at the same false alarm rate.
- **Moving up a size at 320** helps more than moving to 640 for most cameras. YOLOv9-m at 320 detects more objects than YOLOv9-s at 640 (60% vs 59%) with lower GPU latency.
- **640 input** is rarely needed. Frigate doesn't run detection on the full frame. It crops a region around motion, at least 320 pixels wide for any model, and resizes it to the model's input size. Most regions are small, so a 640 model usually receives an upscaled crop and does worse than a 320 model given the same crop at its native size. 640 models detect small objects better only within a large region. See [object size and input resolution](#object-size-and-input-resolution) for details.
- **YOLOv9-c** gains little over YOLOv9-m: about 2 points of detection rate at 320 and none at 640, with more latency. On CPU it takes 1.4 to 1.7 times as long as YOLOv9-m.
- **YOLOv9-t at 640** is no better than YOLOv9-s at 320 (55% vs 54%) and is slower on both GPU and CPU.
- **YOLO-NAS-s** and **MobileDet** are only worth considering on hardware that can't run YOLOv9. Everywhere else, a YOLOv9 model of similar speed is more accurate.
Results on your own hardware and cameras will differ, so test with the base models before requesting a model.
### Thresholds
Each model's threshold for 95% precision is listed in the [accuracy](#accuracy) table. YOLOv9 models reach it at about 0.70 to 0.77. MobileDet (0.82) and YOLO-NAS-s (0.86 to 0.89) need higher thresholds, so with Frigate's default threshold they produce more false positives than the YOLOv9 models. See [object filters](../configuration/object_filters.md#object-scores) for how to adjust thresholds.
## How these were measured
The numbers on this page are for the 2026.3 base models.
- **Images:** 10,947 images from the Frigate+ validation set, from real Frigate cameras. Images that share a source with training images are excluded.
- **Processing:** every model runs through Frigate's own detector code and post-processing (Frigate 0.18.2), exactly as deployed.
- **Labels:** results cover the 12 most common labels: `car`, `person`, `waste_bin`, `license_plate`, `dog`, `cat`, `face`, `bicycle`, `bird`, `deer`, `bbq_grill`, and `package`.
- **Single frames:** each image is scored on its own. In Frigate, an object has to score well across several frames before it becomes a tracked object, so brief one-frame mistakes rarely reach you. Use these numbers to compare models with each other, not as event rates.
**Detection rate at 95% precision** is the main accuracy number. It's the share of real objects a model detects when its threshold is set so that 95% of its detections are correct (about 1 false detection in 20). Every model is held to the same false alarm rate, so the detection rates compare directly. The threshold that achieves this is shown too, because it differs between models.
## Accuracy
| Model | Input | Detection rate at 95% precision | Missed objects per 100 | Threshold for 95% precision | AP50 |
| ---------- | ----- | ------------------------------- | ---------------------- | --------------------------- | ---- |
| MobileDet | 320 | 24% | 76 | 0.82 | 0.47 |
| YOLO-NAS-s | 320 | 39% | 61 | 0.86 | 0.44 |
| YOLO-NAS-s | 640 | 48% | 52 | 0.89 | 0.55 |
| YOLOv9-t | 320 | 45% | 55 | 0.69 | 0.44 |
| YOLOv9-t | 640 | 55% | 45 | 0.70 | 0.54 |
| YOLOv9-s | 320 | 54% | 46 | 0.74 | 0.54 |
| YOLOv9-s | 640 | 59% | 41 | 0.75 | 0.61 |
| YOLOv9-m | 320 | 60% | 40 | 0.75 | 0.58 |
| YOLOv9-m | 640 | 64% | 36 | 0.77 | 0.64 |
| YOLOv9-c | 320 | 62% | 38 | 0.75 | 0.60 |
| YOLOv9-c | 640 | 63% | 37 | 0.77 | 0.64 |
AP50 is the standard COCO metric (IoU 0.5) averaged over the 12 labels. It summarizes accuracy across every threshold, while the detection rate describes one realistic setting.
:::note
These AP50 numbers can't be compared to the COCO results published for YOLOv9, YOLO-NAS, and other models. Those results are measured on the COCO dataset, while these are measured on images from security cameras, with a different set of labels (several, such as `license_plate`, `face`, and `package`, aren't in COCO) and through Frigate's own post-processing. Published COCO results also usually report mAP averaged over IoU 0.5 to 0.95 rather than AP50. Use these numbers only to compare Frigate+ models with each other.
:::
### By object size
AP50 by object size:
| Model | Input | Small | Medium | Large |
| ---------- | ----- | ----- | ------ | ----- |
| MobileDet | 320 | 0.23 | 0.62 | 0.71 |
| YOLO-NAS-s | 320 | 0.23 | 0.57 | 0.60 |
| YOLO-NAS-s | 640 | 0.42 | 0.63 | 0.58 |
| YOLOv9-t | 320 | 0.22 | 0.60 | 0.67 |
| YOLOv9-t | 640 | 0.42 | 0.63 | 0.57 |
| YOLOv9-s | 320 | 0.35 | 0.70 | 0.73 |
| YOLOv9-s | 640 | 0.51 | 0.69 | 0.69 |
| YOLOv9-m | 320 | 0.40 | 0.73 | 0.74 |
| YOLOv9-m | 640 | 0.54 | 0.71 | 0.72 |
| YOLOv9-c | 320 | 0.44 | 0.73 | 0.77 |
| YOLOv9-c | 640 | 0.54 | 0.71 | 0.74 |
In these single-image results, 640 input mostly helps small objects, such as distant people, license plates, and faces, and doesn't help medium and large objects. For example, license plate AP50 rises from 0.32 to 0.55 for YOLOv9-s. These numbers overstate the benefit of 640 in Frigate, as explained below.
#### Object size and input resolution
Frigate doesn't send the full camera frame to the model. It crops a region around motion or a tracked object, at least 320 pixels wide for any model, and resizes it to the model's input size. Most regions are small, so a 640 model usually receives a crop upscaled from 320 pixels, which adds no detail and performs worse than a 320 model given the same crop at its native size. A 640 model detects small objects better only when the region is large.
640 input can still help in scenes with large objects in the foreground and small objects in the background at the same time, such as a doorbell camera that sees a person on the porch and another person across the street. The region has to be large enough to fit the nearby person, so the distant person is small within it. Frigate already handles much of this case: when an object is small relative to the region it was detected in, Frigate runs a separate detection on a smaller region around it.
### By label
AP50 by label:
| Label | MobileDet 320 | YOLO-NAS-s 320 | YOLOv9-t 320 | YOLOv9-s 320 | YOLOv9-m 320 | YOLOv9-c 320 | YOLO-NAS-s 640 | YOLOv9-t 640 | YOLOv9-s 640 | YOLOv9-m 640 | YOLOv9-c 640 |
| --------------- | ------------- | -------------- | ------------ | ------------ | ------------ | ------------ | -------------- | ------------ | ------------ | ------------ | ------------ |
| `car` | 0.73 | 0.72 | 0.70 | 0.77 | 0.81 | 0.82 | 0.82 | 0.79 | 0.83 | 0.85 | 0.84 |
| `person` | 0.65 | 0.62 | 0.62 | 0.72 | 0.75 | 0.76 | 0.71 | 0.69 | 0.76 | 0.78 | 0.77 |
| `waste_bin` | 0.52 | 0.49 | 0.49 | 0.55 | 0.57 | 0.58 | 0.60 | 0.60 | 0.62 | 0.62 | 0.63 |
| `license_plate` | 0.31 | 0.31 | 0.23 | 0.32 | 0.36 | 0.39 | 0.55 | 0.46 | 0.55 | 0.60 | 0.61 |
| `dog` | 0.38 | 0.35 | 0.39 | 0.53 | 0.53 | 0.57 | 0.40 | 0.48 | 0.53 | 0.55 | 0.58 |
| `cat` | 0.41 | 0.37 | 0.39 | 0.51 | 0.57 | 0.59 | 0.43 | 0.46 | 0.58 | 0.61 | 0.62 |
| `face` | 0.39 | 0.41 | 0.23 | 0.33 | 0.42 | 0.45 | 0.60 | 0.43 | 0.57 | 0.63 | 0.63 |
| `bicycle` | 0.46 | 0.43 | 0.40 | 0.51 | 0.56 | 0.55 | 0.54 | 0.49 | 0.58 | 0.62 | 0.60 |
| `bird` | 0.30 | 0.18 | 0.33 | 0.42 | 0.47 | 0.50 | 0.23 | 0.30 | 0.39 | 0.43 | 0.38 |
| `deer` | 0.51 | 0.50 | 0.51 | 0.62 | 0.69 | 0.71 | 0.59 | 0.56 | 0.60 | 0.70 | 0.67 |
| `bbq_grill` | 0.68 | 0.60 | 0.69 | 0.77 | 0.78 | 0.81 | 0.74 | 0.74 | 0.81 | 0.83 | 0.84 |
| `package` | 0.35 | 0.28 | 0.34 | 0.46 | 0.47 | 0.49 | 0.39 | 0.43 | 0.50 | 0.48 | 0.50 |
## Speed
Average time per detection in milliseconds, measured through Frigate's detector code and including post-processing. Lower is better. A blank cell means that combination was not measured.
| Model | Input | NVIDIA RTX 5060 Ti (ONNX, CUDA) | Intel i9-13900K (OpenVINO, CPU) | Intel i9-13900K (ONNX, CPU) | Intel i9-13900K (TFLite, CPU) |
| ---------- | ----- | ------------------------------- | ------------------------------- | --------------------------- | ----------------------------- |
| MobileDet | 320 | | | | 8.4 |
| YOLO-NAS-s | 320 | 4.9 | 8.4 | 8.9 | |
| YOLO-NAS-s | 640 | 7.1 | 29.6 | 28.6 | |
| YOLOv9-t | 320 | 2.9 | 4.3 | 6.5 | |
| YOLOv9-t | 640 | 5.0 | 12.9 | 17.0 | |
| YOLOv9-s | 320 | 3.9 | 9.3 | 11.5 | |
| YOLOv9-s | 640 | 6.3 | 33.1 | 32.6 | |
| YOLOv9-m | 320 | 5.2 | 23.2 | 19.8 | |
| YOLOv9-m | 640 | 10.1 | 88.1 | 69.5 | |
| YOLOv9-c | 320 | 5.4 | 38.8 | 27.5 | |
| YOLOv9-c | 640 | 11.1 | 147.8 | 99.5 | |
CPU times vary by about ±15% between runs. Speeds on other hardware, such as Google Coral, Hailo, Intel iGPUs and NPUs, AMD GPUs, and Rockchip NPUs, are not included here. Test the base models on your own hardware to compare speeds.
+1 -1
View File
@@ -17,7 +17,7 @@ For more detailed recommendations, you can refer to the docs on [annotating](./a
## Step 2: Submit a model request ## Step 2: Submit a model request
Once you have an initial set of verified images, you can request a model on the Models page. For guidance on choosing a model type, refer to [this part of the documentation](./index.md#available-model-types). If you are unsure which type to request, you can test the base model for each version from the "Base Models" tab. For most hardware, `yolov9` is recommended; `mobiledet` is a legacy model type and will be removed in 2027. Each model request requires 1 of the 12 trainings that you receive with your annual subscription. This model will support all [label types available](./index.md#available-label-types) even if you do not submit any examples for those labels. Model creation can take up to 36 hours. Once you have an initial set of verified images, you can request a model on the Models page. For guidance on choosing a model type, refer to [available model types](./index.md#available-model-types) and [choosing a model](./choosing_a_model.md). If you are unsure which type to request, you can test the base model for each version from the "Base Models" tab. For most hardware, `yolov9` is recommended; `mobiledet` is a legacy model type and will be removed in 2027. Each model request requires 1 of the 12 trainings that you receive with your annual subscription. This model will support all [label types available](./index.md#available-label-types) even if you do not submit any examples for those labels. Model creation can take up to 36 hours.
![Plus Models Page](/img/plus/plus-models.jpg) ![Plus Models Page](/img/plus/plus-models.jpg)
## Step 3: Set your model ## Step 3: Set your model
+10 -10
View File
@@ -13,12 +13,12 @@ Information on how to integrate Frigate+ with Frigate can be found in the [integ
There are three model types offered in Frigate+, `yolov9`, `yolonas`, and `mobiledet` (legacy). All of these models are object detection models and are trained to detect the same set of labels [listed below](#available-label-types). There are three model types offered in Frigate+, `yolov9`, `yolonas`, and `mobiledet` (legacy). All of these models are object detection models and are trained to detect the same set of labels [listed below](#available-label-types).
Not all model types are supported by all detectors, so it's important to choose a model type to match your detector as shown in the table under [supported detector types](#supported-detector-types). You can test model types for compatibility and speed on your hardware by using the base models. Not all model types are supported by all detectors, so it's important to choose a model type to match your detector as shown in the table under [supported detector types](#supported-detector-types). You can test model types for compatibility and speed on your hardware by using the base models. For accuracy and speed comparisons between model types, sizes, and resolutions, see [choosing a model](./choosing_a_model.md).
| Model Type | Description | | Model Type | Description |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `yolov9` | A leading SOTA (state of the art) object detection model with similar performance to yolonas, but on a wider range of hardware options. Runs on most hardware. | | `yolov9` | A leading SOTA (state of the art) object detection model. More accurate than yolonas at similar speeds, and runs on a wider range of hardware. Runs on most hardware. |
| `yolonas` | A newer architecture that offers slightly higher accuracy and improved detection of small objects. Runs on Intel, NVidia GPUs, and AMD GPUs. | | `yolonas` | An alternative architecture for hardware that can't run yolov9. Runs on Intel, NVidia GPUs, and AMD GPUs. |
| `mobiledet` | Legacy. Based on the same architecture as the default model included with Frigate. Runs on Google Coral devices and CPUs. | | `mobiledet` | Legacy. Based on the same architecture as the default model included with Frigate. Runs on Google Coral devices and CPUs. |
:::warning :::warning
@@ -29,14 +29,14 @@ Not all model types are supported by all detectors, so it's important to choose
### YOLOv9 Details ### YOLOv9 Details
YOLOv9 models are available in `t`, `s`, `c`, and `edgetpu` variants, and an `m` size is coming soon. When requesting a `yolov9` model, you will be prompted to choose a variant. If you want the model to be compatible with a Google Coral, you will need to choose the `edgetpu` variant, which requires Frigate 0.17 or later. If you are unsure what variant to choose, you should perform some tests with the base models to find the performance level that suits you. The `s` size is most similar to the current `yolonas` models in terms of inference times and accuracy, and a good place to start is the `320x320` resolution model for `yolov9s`. The `c` size is larger and offers higher accuracy at the cost of slower inference, so it is best suited to more powerful hardware such as GPUs. YOLOv9 models are available in `t`, `s`, `m`, `c`, and `edgetpu` variants. When requesting a `yolov9` model, you will be prompted to choose a variant. If you want the model to be compatible with a Google Coral, you will need to choose the `edgetpu` variant, which requires Frigate 0.17 or later. If you are unsure what variant to choose, you should perform some tests with the base models to find the performance level that suits you. The `s` size has similar inference times to the current `yolonas` models with noticeably higher accuracy, and a good place to start is the `320x320` resolution model for `yolov9s`. The `m` size offers higher accuracy at the cost of slower inference, so it is best suited to more powerful hardware such as GPUs. The `c` size is slower still and offers little accuracy gain over `m`. See [choosing a model](./choosing_a_model.md) for detailed accuracy and speed comparisons.
| Variant | Size | Parameters | Speed and accuracy | Best suited for | | Variant | Size | Parameters | Speed and accuracy | Best suited for |
| --------- | -------------------- | ---------- | ----------------------------------------------------------- | -------------------------------------------------- | | --------- | ------- | ---------- | ------------------------------------------------------------- | -------------------------------------------------- |
| `t` | Tiny | ~2.0M | Fastest inference, lowest accuracy | Low power hardware or a large number of cameras | | `t` | Tiny | ~2.0M | Fastest inference, lowest accuracy | Low power hardware or a large number of cameras |
| `s` | Small | ~7.1M | Balanced. Similar inference times and accuracy to `yolonas` | Most users. Start with `320x320` | | `s` | Small | ~7.1M | Balanced. Similar inference times to `yolonas`, more accurate | Most users. Start with `320x320` |
| `m` | Medium (coming soon) | ~20.0M | Slower than `s` with higher accuracy | Mid-range GPUs and NPUs | | `m` | Medium | ~20.0M | Slower than `s` with higher accuracy | Mid-range GPUs and NPUs |
| `c` | Compact | ~25.3M | Highest accuracy, slowest inference | More powerful hardware such as GPUs | | `c` | Compact | ~25.3M | Similar accuracy to `m`, slowest inference | More powerful hardware such as GPUs |
| `edgetpu` | N/A | N/A | Optimized to run on the Coral's Edge TPU | Google Coral devices only (requires Frigate 0.17+) | | `edgetpu` | N/A | N/A | Optimized to run on the Coral's Edge TPU | Google Coral devices only (requires Frigate 0.17+) |
Parameter counts are for the standard YOLOv9 architectures. Actual inference times depend on your hardware and the input resolution you choose, so test with the base models before requesting a model. Parameter counts are for the standard YOLOv9 architectures. Actual inference times depend on your hardware and the input resolution you choose, so test with the base models before requesting a model.
@@ -49,7 +49,7 @@ When switching to YOLOv9, you may need to adjust your thresholds for some object
#### Hailo Support #### Hailo Support
If you have a Hailo device, you will need to specify the hardware you have when submitting a model request because they are not cross compatible. Hailo models are available for the `t`, `s`, and `c` variants on Hailo8, Hailo8L, and Hailo8R devices. Please test using the available base models before submitting your model request. If you have a Hailo device, you will need to specify the hardware you have when submitting a model request because they are not cross compatible. Hailo models are available for the `t`, `s`, `m`, and `c` variants on Hailo8, Hailo8L, and Hailo8R devices. Please test using the available base models before submitting your model request.
#### Rockchip (RKNN) Support #### Rockchip (RKNN) Support
+17
View File
@@ -112,3 +112,20 @@ This metric scales with how many detections per second Frigate runs and how expe
- **Tune stationary object behavior.** Objects that never settle into a stationary state are re-detected continuously. Raising `detect -> stationary -> interval` reduces how often detection runs on objects that are already parked. See [stationary objects](../configuration/stationary_objects). - **Tune stationary object behavior.** Objects that never settle into a stationary state are re-detected continuously. Raising `detect -> stationary -> interval` reduces how often detection runs on objects that are already parked. See [stationary objects](../configuration/stationary_objects).
Adding [more detector instances](#multiple-detector-instances) spreads this work across more CPU cores, but does not reduce the total CPU used. Adding [more detector instances](#multiple-detector-instances) spreads this work across more CPU cores, but does not reduce the total CPU used.
## Tracked object processing could not keep up {#tracked-object-processing-behind}
After detection, Frigate hands each camera's frames to a single tracked object processor in the main Frigate process. It handles zones, loitering, snapshots, and event and MQTT updates for all cameras. When the processor falls more than about a second behind, Frigate drops new frames instead of waiting for it. Frigate raises this notice in the UI's Notices pane when it drops at least 5% of a camera's frames for more than a minute.
This is different from "Detection could not keep up", which means the [object detector](#2-detector-selection-and-configuration) is too slow. Dropped frames mean the system itself is short on CPU or stalling.
The notice stays until you acknowledge or mute it, and is raised again only after drops stop and later start again. `/api/stats` reports each camera's current `dropped_pct`.
Detection, tracking, and recording continue while frames are dropped. Zone [inertia](../configuration/zones.md#zone-inertia) and [loitering time](../configuration/zones.md#zone-loitering) count fewer frames, so a fast object can miss a small zone and loitering triggers late. Snapshots are picked from fewer frames, and events, MQTT messages, and notifications are delayed until the processor catches up.
To reduce dropped frames:
- Check CPU use and any CPU limits on the container or VM (`cpus`, `cpuset`, or the cores assigned to a VM or LXC container). A rising `nr_throttled` in `/sys/fs/cgroup/cpu.stat` means a limit is throttling Frigate.
- Use a detect fps of 5, and no more than 10. See [choosing a detect frame rate](../frigate/camera_setup.md#choosing-a-detect-frame-rate).
- Lower the detect resolution. The snapshot saved when an object ends is encoded from the full detect frame.
- Keep `/media/frigate` on local storage, since the processor writes snapshots and thumbnails itself.
+1 -1
View File
@@ -4,7 +4,7 @@ import type { Config, PluginConfig } from "@docusaurus/types";
import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs"; import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
// Bump when a new stable release ships // Bump when a new stable release ships
const STABLE_VERSION = "0.18"; const STABLE_VERSION = "0.19";
const config: Config = { const config: Config = {
title: "Frigate", title: "Frigate",
+1
View File
@@ -162,6 +162,7 @@ const sidebars: SidebarsConfig = {
], ],
"Frigate+": [ "Frigate+": [
"plus/index", "plus/index",
"plus/choosing_a_model",
"plus/annotating", "plus/annotating",
"plus/first_model", "plus/first_model",
"plus/faq", "plus/faq",
+23 -1
View File
@@ -683,6 +683,15 @@
"title": "FeaturesSection", "title": "FeaturesSection",
"type": "object" "type": "object"
}, },
"FfmpegSource": {
"enum": [
"default",
"bundled",
"custom"
],
"title": "FfmpegSource",
"type": "string"
},
"FpsBucket": { "FpsBucket": {
"enum": [ "enum": [
"le_5", "le_5",
@@ -1017,6 +1026,17 @@
"description": "CPU architecture", "description": "CPU architecture",
"x-public": true "x-public": true
}, },
"custom_go2rtc": {
"description": "Whether an executable /config/go2rtc build exists",
"title": "Custom Go2Rtc",
"type": "boolean",
"x-public": true
},
"ffmpeg": {
"$ref": "#/$defs/FfmpegSource",
"description": "Configured global ffmpeg.path: the default build, another bundled version, or a custom path",
"x-public": true
},
"image_variant": { "image_variant": {
"$ref": "#/$defs/ImageVariant", "$ref": "#/$defs/ImageVariant",
"description": "Published image the install runs", "description": "Published image the install runs",
@@ -1054,7 +1074,9 @@
"install_type", "install_type",
"arch", "arch",
"kernel", "kernel",
"run_as_root" "run_as_root",
"custom_go2rtc",
"ffmpeg"
], ],
"title": "InstallSection", "title": "InstallSection",
"type": "object" "type": "object"
+34 -93
View File
@@ -2311,8 +2311,8 @@ paths:
$ref: '#/components/schemas/HTTPValidationError' $ref: '#/components/schemas/HTTPValidationError'
security: security:
- frigateUserAuth: [] - frigateUserAuth: []
x-required-role: camera x-required-role: any
description: '**Access:** Authenticated user with access to the referenced camera.' description: '**Access:** Any authenticated user.'
/review/{review_id}: /review/{review_id}:
get: get:
tags: tags:
@@ -2546,7 +2546,7 @@ paths:
- App - App
summary: Metrics summary: Metrics
description: |- description: |-
**Access:** Any authenticated user. **Access:** Admin role required.
Expose Prometheus metrics endpoint and update metrics with latest stats Expose Prometheus metrics endpoint and update metrics with latest stats
operationId: metrics_metrics_get operationId: metrics_metrics_get
@@ -2557,8 +2557,8 @@ paths:
application/json: application/json:
schema: {} schema: {}
security: security:
- frigateUserAuth: [] - frigateAdminAuth: []
x-required-role: any x-required-role: admin
/genai/models: /genai/models:
get: get:
tags: tags:
@@ -3148,6 +3148,25 @@ paths:
- frigateUserAuth: [] - frigateUserAuth: []
x-required-role: any x-required-role: any
description: '**Access:** Any authenticated user.' description: '**Access:** Any authenticated user.'
/plus/validate:
post:
tags:
- App
summary: Validate Plus Key
description: |-
**Access:** Admin role required.
Validate the configured Frigate+ API key with the Frigate+ server.
operationId: validate_plus_key_plus_validate_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
security:
- frigateAdminAuth: []
x-required-role: admin
/recognized_license_plates: /recognized_license_plates:
get: get:
tags: tags:
@@ -4589,14 +4608,6 @@ paths:
- type: 'null' - type: 'null'
default: 1 default: 1
title: Include Thumbnails title: Include Thumbnails
- name: favorites
in: query
required: false
schema:
anyOf:
- type: integer
- type: 'null'
title: Favorites
- name: min_score - name: min_score
in: query in: query
required: false required: false
@@ -5127,75 +5138,6 @@ paths:
security: security:
- frigateAdminAuth: [] - frigateAdminAuth: []
x-required-role: admin x-required-role: admin
/events/{event_id}/retain:
post:
tags:
- Events
summary: Set event retain indefinitely.
description: |-
**Access:** Admin role required.
Sets an event to retain indefinitely.
Returns a success message or an error if the event is not found.
NOTE: This is a legacy endpoint and is not supported in the frontend.
operationId: set_retain_events__event_id__retain_post
parameters:
- name: event_id
in: path
required: true
schema:
type: string
title: Event Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GenericResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- frigateAdminAuth: []
x-required-role: admin
delete:
tags:
- Events
summary: Stop event from being retained indefinitely
description: |-
**Access:** Admin role required.
Stops an event from being retained indefinitely.
Returns a success message or an error if the event is not found.
NOTE: This is a legacy endpoint and is not supported in the frontend.
operationId: delete_retain_events__event_id__retain_delete
parameters:
- name: event_id
in: path
required: true
schema:
type: string
title: Event Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GenericResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- frigateAdminAuth: []
x-required-role: admin
/events/{event_id}/plus: /events/{event_id}/plus:
post: post:
tags: tags:
@@ -5826,6 +5768,10 @@ paths:
tags: tags:
- Media - Media
summary: Mjpeg Feed summary: Mjpeg Feed
description: |-
**Access:** Authenticated user with access to the referenced camera.
An MJPEG stream of the camera's latest processed frame, intended for debugging only. Every frame of every open stream is color converted, annotated, resized, and JPEG encoded in Frigate's main process, which adds load to the system and can slow down Frigate's processing. It is strictly not recommended to view this stream continuously, such as on a dashboard. For live viewing, use a go2rtc restream instead. The frame rate and resolution can be raised with the fps and height parameters, for example ?fps=10&height=1080, at the cost of additional load.
operationId: mjpeg_feed__camera_name__get operationId: mjpeg_feed__camera_name__get
parameters: parameters:
- name: camera_name - name: camera_name
@@ -5913,7 +5859,6 @@ paths:
security: security:
- frigateUserAuth: [] - frigateUserAuth: []
x-required-role: camera x-required-role: camera
description: '**Access:** Authenticated user with access to the referenced camera.'
/{camera_name}/ptz/info: /{camera_name}/ptz/info:
get: get:
tags: tags:
@@ -6130,9 +6075,7 @@ paths:
in: path in: path
required: true required: true
schema: schema:
anyOf: type: string
- type: string
- type: 'null'
title: Camera Name title: Camera Name
- name: frame_time - name: frame_time
in: path in: path
@@ -6153,9 +6096,9 @@ paths:
schema: schema:
$ref: '#/components/schemas/HTTPValidationError' $ref: '#/components/schemas/HTTPValidationError'
security: security:
- frigateUserAuth: [] - frigateAdminAuth: []
x-required-role: camera x-required-role: admin
description: '**Access:** Authenticated user with access to the referenced camera.' description: '**Access:** Admin role required.'
/{camera_name}/start/{start_ts}/end/{end_ts}/clip.mp4: /{camera_name}/start/{start_ts}/end/{end_ts}/clip.mp4:
get: get:
tags: tags:
@@ -8433,9 +8376,6 @@ components:
has_snapshot: has_snapshot:
type: boolean type: boolean
title: Has Snapshot title: Has Snapshot
retain_indefinitely:
type: boolean
title: Retain Indefinitely
plus_id: plus_id:
anyOf: anyOf:
- type: string - type: string
@@ -8473,7 +8413,6 @@ components:
- thumbnail - thumbnail
- has_clip - has_clip
- has_snapshot - has_snapshot
- retain_indefinitely
- plus_id - plus_id
- model_hash - model_hash
- detector_type - detector_type
@@ -9608,6 +9547,8 @@ components:
title: Condition title: Condition
max_duration_minutes: max_duration_minutes:
type: integer type: integer
maximum: 1440.0
minimum: 1.0
title: Max Duration Minutes title: Max Duration Minutes
default: 60 default: 60
labels: labels:
+2 -1
View File
@@ -139,7 +139,8 @@ def collect(ctx: ReportContext) -> FeaturesSection:
restream=config.birdseye.restream, restream=config.birdseye.restream,
), ),
mqtt=config.mqtt.enabled, mqtt=config.mqtt.enabled,
notifications=config.notifications.enabled, notifications=config.notifications.enabled
or any(camera.notifications.enabled for camera in cameras),
auth=config.auth.enabled, auth=config.auth.enabled,
proxy_auth=config.proxy.header_map.user is not None, proxy_auth=config.proxy.header_map.user is not None,
tls=config.tls.enabled, tls=config.tls.enabled,
+22 -1
View File
@@ -6,7 +6,15 @@ import re
from frigate.analytics.collectors.common import closed from frigate.analytics.collectors.common import closed
from frigate.analytics.context import ReportContext from frigate.analytics.context import ReportContext
from frigate.analytics.schema import Arch, ImageVariant, InstallSection, InstallType from frigate.analytics.schema import (
Arch,
FfmpegSource,
ImageVariant,
InstallSection,
InstallType,
)
from frigate.const import CONFIG_DIR, DEFAULT_FFMPEG_VERSION, INCLUDED_FFMPEG_VERSIONS
from frigate.util.config import is_valid_ffmpeg_path
from frigate.version import VERSION from frigate.version import VERSION
KERNEL_PATTERN = re.compile(r"^(\d{1,3})\.(\d{1,3})") KERNEL_PATTERN = re.compile(r"^(\d{1,3})\.(\d{1,3})")
@@ -54,6 +62,17 @@ def kernel(release: str) -> str:
return f"{match.group(1)}.{match.group(2)}" if match else "unknown" return f"{match.group(1)}.{match.group(2)}" if match else "unknown"
def ffmpeg_source(path: str) -> FfmpegSource:
"""Classify the configured ffmpeg.path, applying resolve_ffmpeg_path's alias fallbacks."""
if path.startswith("/") and is_valid_ffmpeg_path(path):
return FfmpegSource.custom
if path != DEFAULT_FFMPEG_VERSION and path in INCLUDED_FFMPEG_VERSIONS:
return FfmpegSource.bundled
return FfmpegSource.default
def collect(ctx: ReportContext) -> InstallSection: def collect(ctx: ReportContext) -> InstallSection:
"""Describe the Frigate version, image, install method, and platform.""" """Describe the Frigate version, image, install method, and platform."""
return InstallSection( return InstallSection(
@@ -63,4 +82,6 @@ def collect(ctx: ReportContext) -> InstallSection:
arch=arch(platform.machine()), arch=arch(platform.machine()),
kernel=kernel(platform.release()), kernel=kernel(platform.release()),
run_as_root=os.geteuid() == 0, run_as_root=os.geteuid() == 0,
custom_go2rtc=os.access(os.path.join(CONFIG_DIR, "go2rtc"), os.X_OK),
ffmpeg=ffmpeg_source(ctx.config.ffmpeg.path),
) )
+10
View File
@@ -47,6 +47,12 @@ class Arch(StrEnum):
other = "other" other = "other"
class FfmpegSource(StrEnum):
default = "default"
bundled = "bundled"
custom = "custom"
class GpuVendor(StrEnum): class GpuVendor(StrEnum):
intel = "intel" intel = "intel"
amd = "amd" amd = "amd"
@@ -201,6 +207,10 @@ class InstallSection(AnalyticsModel):
"Host kernel as major.minor", pattern=r"^(\d{1,3}\.\d{1,3}|unknown)$" "Host kernel as major.minor", pattern=r"^(\d{1,3}\.\d{1,3}|unknown)$"
) )
run_as_root: bool = metric("Whether the main process runs as root") run_as_root: bool = metric("Whether the main process runs as root")
custom_go2rtc: bool = metric("Whether an executable /config/go2rtc build exists")
ffmpeg: FfmpegSource = metric(
"Configured global ffmpeg.path: the default build, another bundled version, or a custom path"
)
class GpuInfo(AnalyticsModel): class GpuInfo(AnalyticsModel):
+114 -52
View File
@@ -40,12 +40,13 @@ from frigate.api.defs.request.app_body import (
MediaSyncBody, MediaSyncBody,
) )
from frigate.api.defs.tags import Tags from frigate.api.defs.tags import Tags
from frigate.api.plus_util import plus_rate_limited_response
from frigate.config import FrigateConfig, GenAIConfig, GenAIProviderEnum from frigate.config import FrigateConfig, GenAIConfig, GenAIProviderEnum
from frigate.config.camera.updater import ( from frigate.config.camera.updater import (
CameraConfigUpdateEnum, CameraConfigUpdateEnum,
CameraConfigUpdateTopic, CameraConfigUpdateTopic,
) )
from frigate.const import REDACTED_CREDENTIAL_SENTINEL from frigate.const import REDACTED_CREDENTIAL_SENTINEL, REPLAY_CAMERA_PREFIX
from frigate.ffmpeg_presets import FFMPEG_HWACCEL_VAAPI, _gpu_selector from frigate.ffmpeg_presets import FFMPEG_HWACCEL_VAAPI, _gpu_selector
from frigate.genai import PROVIDERS, load_providers from frigate.genai import PROVIDERS, load_providers
from frigate.jobs.media_sync import ( from frigate.jobs.media_sync import (
@@ -54,7 +55,7 @@ from frigate.jobs.media_sync import (
start_media_sync_job, start_media_sync_job,
) )
from frigate.models import Event, Timeline from frigate.models import Event, Timeline
from frigate.plus import load_plus_model_info from frigate.plus import PlusKeyStatus, PlusRateLimitError, load_plus_model_info
from frigate.stats.prometheus import get_metrics, update_metrics from frigate.stats.prometheus import get_metrics, update_metrics
from frigate.types import JobStatusTypesEnum from frigate.types import JobStatusTypesEnum
from frigate.util.builtin import ( from frigate.util.builtin import (
@@ -64,6 +65,7 @@ from frigate.util.builtin import (
is_masked_camera_path, is_masked_camera_path,
load_labels, load_labels,
process_config_query_string, process_config_query_string,
scope_stats_for_non_admin,
split_config_key_path, split_config_key_path,
update_yaml_file_bulk, update_yaml_file_bulk,
) )
@@ -72,7 +74,7 @@ from frigate.util.config import (
find_config_file, find_config_file,
redact_credential, redact_credential,
) )
from frigate.util.env import substitute_frigate_vars from frigate.util.env import candidate_env_vars, substitute_frigate_vars
from frigate.util.live_streams import ( from frigate.util.live_streams import (
generated_transcode_streams, generated_transcode_streams,
sync_transcode_streams, sync_transcode_streams,
@@ -131,37 +133,12 @@ def stats(
): ):
stats_data = request.app.stats_emitter.get_latest_stats() stats_data = request.app.stats_emitter.get_latest_stats()
# Admins see the full snapshot
if request.headers.get("remote-role") == "admin": if request.headers.get("remote-role") == "admin":
return JSONResponse(content=stats_data) return JSONResponse(content=stats_data)
allowed_set = set(allowed_cameras) return JSONResponse(
content=scope_stats_for_non_admin(stats_data, set(allowed_cameras))
# Shallow-copy so we don't mutate the cached stats history entry. )
filtered = {**stats_data}
cameras = stats_data.get("cameras")
if cameras is not None:
filtered["cameras"] = {
name: data for name, data in cameras.items() if name in allowed_set
}
bandwidth = stats_data.get("bandwidth_usages")
if bandwidth is not None:
filtered["bandwidth_usages"] = {
name: data for name, data in bandwidth.items() if name in allowed_set
}
# cmdline can leak camera URLs/paths; strip but keep cpu/mem so
# client-side problem heuristics still work.
cpu_usages = stats_data.get("cpu_usages")
if cpu_usages is not None:
filtered["cpu_usages"] = {
pid: {k: v for k, v in usage.items() if k != "cmdline"}
for pid, usage in cpu_usages.items()
}
return JSONResponse(content=filtered)
@router.get("/stats/history", dependencies=[Depends(require_role(["admin"]))]) @router.get("/stats/history", dependencies=[Depends(require_role(["admin"]))])
@@ -172,7 +149,7 @@ def stats_history(request: Request, keys: str = None):
return JSONResponse(content=request.app.stats_emitter.get_stats_history(keys)) return JSONResponse(content=request.app.stats_emitter.get_stats_history(keys))
@router.get("/metrics", dependencies=[Depends(allow_any_authenticated())]) @router.get("/metrics", dependencies=[Depends(require_role(["admin"]))])
def metrics(request: Request): def metrics(request: Request):
"""Expose Prometheus metrics endpoint and update metrics with latest stats""" """Expose Prometheus metrics endpoint and update metrics with latest stats"""
# Retrieve the latest statistics and update the Prometheus metrics # Retrieve the latest statistics and update the Prometheus metrics
@@ -320,10 +297,12 @@ def config(request: Request):
is_admin = request.headers.get("remote-role") == "admin" is_admin = request.headers.get("remote-role") == "admin"
# hide environment_vars and the notification email from non-admin users # hide environment_vars, the notification email and ffmpeg args (which
# can carry auth headers) from non-admin users
if not is_admin: if not is_admin:
config.pop("environment_vars", None) config.pop("environment_vars", None)
redact_credential(config["notifications"], "email") redact_credential(config["notifications"], "email")
_drop_ffmpeg_args(config.get("ffmpeg", {}))
# redact mqtt credentials # redact mqtt credentials
redact_credential(config["mqtt"], "password") redact_credential(config["mqtt"], "password")
@@ -331,11 +310,15 @@ def config(request: Request):
# redact proxy secret # redact proxy secret
redact_credential(config["proxy"], "auth_secret") redact_credential(config["proxy"], "auth_secret")
# redact genai api keys # redact genai api keys; base_url and provider_options can carry proxy auth
for _genai_name, genai_cfg in config.get("genai", {}).items(): for _genai_name, genai_cfg in config.get("genai", {}).items():
if isinstance(genai_cfg, dict): if isinstance(genai_cfg, dict):
redact_credential(genai_cfg, "api_key") redact_credential(genai_cfg, "api_key")
if not is_admin:
genai_cfg.pop("base_url", None)
genai_cfg.pop("provider_options", None)
for camera_name, camera in request.app.frigate_config.cameras.items(): for camera_name, camera in request.app.frigate_config.cameras.items():
camera_dict = config["cameras"][camera_name] camera_dict = config["cameras"][camera_name]
@@ -353,6 +336,21 @@ 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
# non-admin UI never reads them
if not is_admin:
ffmpeg = camera_dict.get("ffmpeg", {})
_drop_ffmpeg_args(ffmpeg)
for input in ffmpeg.get("inputs", []):
input["path"] = ""
_drop_ffmpeg_args(input)
camera_dict["ffmpeg_cmds"] = []
camera_dict.pop("webui_url", None)
# ensure that zones are relative # ensure that zones are relative
for zone_name, zone in config_obj.cameras[camera_name].zones.items(): for zone_name, zone in config_obj.cameras[camera_name].zones.items():
camera_dict["zones"][zone_name]["color"] = zone.color camera_dict["zones"][zone_name]["color"] = zone.color
@@ -363,11 +361,13 @@ def config(request: Request):
# over the camera's actual base values (e.g. threshold=20). # over the camera's actual base values (e.g. threshold=20).
if camera.profiles: if camera.profiles:
for profile_name, profile_config in camera.profiles.items(): for profile_name, profile_config in camera.profiles.items():
camera_dict.setdefault("profiles", {})[profile_name] = ( profile_dict = profile_config.model_dump(
profile_config.model_dump(
mode="json", warnings="none", exclude_unset=True mode="json", warnings="none", exclude_unset=True
) )
) camera_dict.setdefault("profiles", {})[profile_name] = profile_dict
if not is_admin:
redact_credential(profile_dict.get("notifications") or {}, "email")
# When a profile is active, the top-level camera sections contain # When a profile is active, the top-level camera sections contain
# profile-merged (effective) values. Include the original base # profile-merged (effective) values. Include the original base
@@ -409,6 +409,15 @@ def config(request: Request):
_redact_go2rtc_credentials(config["go2rtc"]) _redact_go2rtc_credentials(config["go2rtc"])
if not is_admin:
# go2rtc allows arbitrary extra keys, so non-admins get only what the
# UI reads: stream names, and webrtc, whose ice_servers credentials
# the browser needs
config["go2rtc"] = {
"streams": {name: [] for name in config["go2rtc"].get("streams", {})},
"webrtc": config["go2rtc"].get("webrtc", {}),
}
config["plus"] = {"enabled": request.app.frigate_config.plus_api.is_active()} config["plus"] = {"enabled": request.app.frigate_config.plus_api.is_active()}
for index, model in enumerate(config_obj.models): for index, model in enumerate(config_obj.models):
@@ -435,6 +444,11 @@ def config(request: Request):
return JSONResponse(content=config) return JSONResponse(content=config)
def _drop_ffmpeg_args(ffmpeg: dict[str, Any]) -> None:
for key in ("global_args", "input_args", "output_args"):
ffmpeg.pop(key, None)
def _redact_go2rtc_credentials(go2rtc: dict[str, Any]) -> None: def _redact_go2rtc_credentials(go2rtc: dict[str, Any]) -> None:
"""Redact go2rtc secrets outside of stream URLs, in place.""" """Redact go2rtc secrets outside of stream URLs, in place."""
for section in ("rtsp", "api", "mqtt"): for section in ("rtsp", "api", "mqtt"):
@@ -577,14 +591,18 @@ def config_raw():
) )
def _go2rtc_config(raw_config: str) -> dict[str, Any]: def _go2rtc_config(raw_config: str) -> tuple[dict[str, Any], Any]:
"""Load the go2rtc section with the same loader Frigate and go2rtc startup use. """Load the go2rtc section and environment_vars with the same loader Frigate
and go2rtc startup use.
Raises ruamel.yaml.YAMLError when the config cannot be parsed. Raises ruamel.yaml.YAMLError when the config cannot be parsed.
""" """
loaded = ruamel.yaml.YAML().load(raw_config) loaded = ruamel.yaml.YAML().load(raw_config)
go2rtc = loaded.get("go2rtc") if isinstance(loaded, dict) else None if not isinstance(loaded, dict):
return go2rtc if isinstance(go2rtc, dict) else {} return {}, None
go2rtc = loaded.get("go2rtc")
return go2rtc if isinstance(go2rtc, dict) else {}, loaded.get("environment_vars")
def _restricted_go2rtc_response( def _restricted_go2rtc_response(
@@ -596,7 +614,7 @@ def _restricted_go2rtc_response(
otherwise load them from the saved config on the next restart. otherwise load them from the saved config on the next restart.
""" """
try: try:
new_go2rtc = _go2rtc_config(new_raw_config) new_go2rtc, new_env_vars = _go2rtc_config(new_raw_config)
except ruamel.yaml.YAMLError: except ruamel.yaml.YAMLError:
logger.warning("Rejected config change that could not be parsed") logger.warning("Rejected config change that could not be parsed")
return JSONResponse( return JSONResponse(
@@ -605,13 +623,13 @@ def _restricted_go2rtc_response(
) )
try: try:
old_go2rtc = _go2rtc_config(old_raw_config) old_go2rtc, _ = _go2rtc_config(old_raw_config)
except ruamel.yaml.YAMLError: except ruamel.yaml.YAMLError:
# with no readable saved config, every source is treated as new # with no readable saved config, every source is treated as new
old_go2rtc = {} old_go2rtc = {}
issues = find_restricted_go2rtc_stream_changes( issues = find_restricted_go2rtc_stream_changes(
old_go2rtc.get("streams"), new_go2rtc.get("streams") old_go2rtc.get("streams"), new_go2rtc.get("streams"), new_env_vars
) )
exec_keys = find_restricted_go2rtc_exec_changes(old_go2rtc, new_go2rtc) exec_keys = find_restricted_go2rtc_exec_changes(old_go2rtc, new_go2rtc)
if not issues and not exec_keys: if not issues and not exec_keys:
@@ -775,16 +793,20 @@ def config_save(save_option: str, body: Any = Body(media_type="text/plain")):
) )
def _restore_masked_camera_paths(config_data: dict, saved: dict) -> str | None: def _restore_masked_camera_paths(
config_data: dict, saved: dict, shown_env_vars: dict[str, str]
) -> str | None:
"""Substitute incoming masked camera paths with the saved ones. """Substitute incoming masked camera paths with the saved ones.
The /config response masks ffmpeg input credentials, so the settings UI The /config response masks ffmpeg input credentials, so the settings UI
sends the masked path back when sibling fields (e.g. hwaccel_args) are sends the masked path back when sibling fields (e.g. hwaccel_args) are
edited. Each masked path is matched to the saved input that masks to the edited. Each masked path is matched to the saved input that masks to the
same value, with roles breaking a tie, so deleting or reordering inputs same value, with roles breaking a tie, so deleting or reordering inputs
keeps each path's own credentials. The saved path is restored as written, keeps each path's own credentials. Saved paths resolve with
keeping any {FRIGATE_*} placeholder. Mutates `config_data` in place and `shown_env_vars`, the block the running config and /config used. The saved
returns an error message when a masked path has no single match. path is restored as written, keeping any {FRIGATE_*} placeholder. Mutates
`config_data` in place and returns an error message when a masked path has
no single match.
""" """
cameras = config_data.get("cameras") cameras = config_data.get("cameras")
if not isinstance(cameras, dict): if not isinstance(cameras, dict):
@@ -820,10 +842,12 @@ def _restore_masked_camera_paths(config_data: dict, saved: dict) -> str | None:
path = input_obj.get("path") path = input_obj.get("path")
if not isinstance(path, str) or not is_masked_camera_path(path): if not isinstance(path, str) or not is_masked_camera_path(path):
continue continue
with candidate_env_vars(shown_env_vars):
candidates = [ candidates = [
inp inp
for inp in saved_inputs for inp in saved_inputs
if clean_camera_user_pass(_resolve_frigate_vars(inp["path"])) == path if clean_camera_user_pass(_resolve_frigate_vars(inp["path"]))
== path
] ]
if len({inp["path"] for inp in candidates}) > 1: if len({inp["path"] for inp in candidates}) > 1:
candidates = [ candidates = [
@@ -868,14 +892,14 @@ def _saved_config_from_memory(config: FrigateConfig) -> dict[str, Any]:
def _config_data_to_updates( def _config_data_to_updates(
config_data: dict, saved: dict[str, Any] config_data: dict, saved: dict[str, Any], running: FrigateConfig
) -> tuple[dict[str, Any], str | None]: ) -> tuple[dict[str, Any], str | None]:
"""Flatten a /config/set payload after restoring masked credentials. """Flatten a /config/set payload after restoring masked credentials.
`saved` is the config the masked values were taken from. Returns the flat `saved` is the config the masked values were taken from. Returns the flat
updates, or an error message when a masked value can't be restored. updates, or an error message when a masked value can't be restored.
""" """
error = _restore_masked_camera_paths(config_data, saved) error = _restore_masked_camera_paths(config_data, saved, running.environment_vars)
if error: if error:
return {}, error return {}, error
@@ -929,7 +953,9 @@ def _config_set_in_memory(request: Request, body: AppConfigSetBody) -> JSONRespo
updates = {} updates = {}
if body.config_data: if body.config_data:
updates, error = _config_data_to_updates( updates, error = _config_data_to_updates(
body.config_data, _saved_config_from_memory(request.app.frigate_config) body.config_data,
_saved_config_from_memory(request.app.frigate_config),
request.app.frigate_config,
) )
if error: if error:
return JSONResponse( return JSONResponse(
@@ -979,6 +1005,17 @@ def _config_set_in_memory(request: Request, body: AppConfigSetBody) -> JSONRespo
status_code=400, status_code=400,
) )
# an unresolvable scene would crash the threads that look up the model
detect_update = sections.get("detect")
if isinstance(detect_update, dict) and "scene" in detect_update:
try:
config._resolve_camera_model(cam_name, detect_update["scene"])
except (TypeError, ValueError):
return JSONResponse(
content={"success": False, "message": "Invalid detect scene"},
status_code=400,
)
for section_name, update in sections.items(): for section_name, update in sections.items():
err = apply_section_update(camera_config, section_name, update) err = apply_section_update(camera_config, section_name, update)
if err is not None: if err is not None:
@@ -987,6 +1024,11 @@ def _config_set_in_memory(request: Request, body: AppConfigSetBody) -> JSONRespo
status_code=400, status_code=400,
) )
# the model is resolved again from the scene when the replay
# camera is recycled by the refresh below
if "detect" in sections and cam_name.startswith(REPLAY_CAMERA_PREFIX):
config.drop_camera_model(cam_name)
# Publish ZMQ updates so processing threads pick up changes # Publish ZMQ updates so processing threads pick up changes
if body.update_topic and body.update_topic.startswith("config/cameras/"): if body.update_topic and body.update_topic.startswith("config/cameras/"):
_, _, camera, field = body.update_topic.split("/") _, _, camera, field = body.update_topic.split("/")
@@ -1094,6 +1136,7 @@ def config_set(request: Request, body: AppConfigSetBody):
updates, error = _config_data_to_updates( updates, error = _config_data_to_updates(
body.config_data, body.config_data,
saved_config if isinstance(saved_config, dict) else {}, saved_config if isinstance(saved_config, dict) else {},
request.app.frigate_config,
) )
if error: if error:
@@ -1638,7 +1681,10 @@ def plusModels(request: Request, filterByCurrentModelDetector: bool = False):
status_code=400, status_code=400,
) )
try:
models: dict[Any, Any] = request.app.frigate_config.plus_api.get_models() models: dict[Any, Any] = request.app.frigate_config.plus_api.get_models()
except PlusRateLimitError as err:
return plus_rate_limited_response(err)
if not models["list"]: if not models["list"]:
return JSONResponse( return JSONResponse(
@@ -1675,6 +1721,22 @@ def plusModels(request: Request, filterByCurrentModelDetector: bool = False):
return JSONResponse(content=validModels) return JSONResponse(content=validModels)
@router.post("/plus/validate", dependencies=[Depends(require_role(["admin"]))])
async def validate_plus_key(request: Request):
"""Validate the configured Frigate+ API key with the Frigate+ server."""
plus_api = request.app.frigate_config.plus_api
status = await plus_api.validate_key()
content: dict[str, Any] = {
"success": status == PlusKeyStatus.valid,
"status": status.value,
}
if status == PlusKeyStatus.rate_limited:
content["retry_after"] = plus_api.rate_limit_remaining()
return JSONResponse(content=content)
@router.get( @router.get(
"/recognized_license_plates", dependencies=[Depends(allow_any_authenticated())] "/recognized_license_plates", dependencies=[Depends(allow_any_authenticated())]
) )
+16 -18
View File
@@ -81,10 +81,11 @@ def require_admin_by_default():
"/", "/",
"/version", "/version",
"/config/schema.json", "/config/schema.json",
# Authenticated user endpoints (allow_any_authenticated) # Admin endpoints that enforce require_role on the route
"/metrics", "/metrics",
"/stats",
"/stats/history", "/stats/history",
# Authenticated user endpoints (allow_any_authenticated)
"/stats",
"/config", "/config",
"/vainfo", "/vainfo",
"/nvinfo", "/nvinfo",
@@ -580,8 +581,9 @@ def resolve_role(
(split by proxy_config.separator) and map to roles. (split by proxy_config.separator) and map to roles.
Admin matches short-circuit to admin. Admin matches short-circuit to admin.
- If no role_map is configured, treat the header as role names directly. - If no role_map is configured, treat the header as role names directly.
2. If no valid role is found, return proxy_config.default_role if it's valid in config_roles, else 'viewer'. 2. If no valid role is found, return proxy_config.default_role if it's valid in config_roles, else 'none'.
The literal value 'none' is a valid default and means access should be denied. The literal value 'none' means access should be denied.
A role_map match whose mapped roles no longer exist in config_roles also resolves to 'none'.
Args: Args:
headers (dict): Incoming request headers (case-insensitive). headers (dict): Incoming request headers (case-insensitive).
@@ -594,17 +596,11 @@ def resolve_role(
default_role = proxy_config.default_role default_role = proxy_config.default_role
role_header = proxy_config.header_map.role role_header = proxy_config.header_map.role
# Validate default_role against config; fallback to 'viewer' if invalid. # Role names match case-insensitively, as header values are lowercased.
# "none" is a sentinel meaning "deny access when no mapping matches"; it is # "none" is the deny sentinel; an unknown or missing default also denies,
# reserved in AuthConfig.validate_roles so it is never a configured role. # since falling back to viewer would grant every camera.
validated_default = ( roles_by_name = {r.lower(): r for r in config_roles}
default_role validated_default = roles_by_name.get((default_role or "").lower(), "none")
if default_role in config_roles or default_role == "none"
else "viewer"
)
if not config_roles:
# Edge case: no roles defined
validated_default = "none" if default_role == "none" else "viewer"
if not role_header: if not role_header:
logger.debug( logger.debug(
@@ -631,7 +627,7 @@ def resolve_role(
logger.debug("Parsed groups from role header: %s", groups) logger.debug("Parsed groups from role header: %s", groups)
matched_roles = { matched_roles = {
role_name role_name.lower()
for role_name, required_groups in proxy_config.header_map.role_map.items() for role_name, required_groups in proxy_config.header_map.role_map.items()
if any(group in groups for group in required_groups) if any(group in groups for group in required_groups)
} }
@@ -643,9 +639,11 @@ def resolve_role(
logger.debug("Resolved role (with role_map) to 'admin'.") logger.debug("Resolved role (with role_map) to 'admin'.")
return "admin" return "admin"
# A mapped role that was deleted or renamed denies rather than
# widening to the default role
if matched_roles: if matched_roles:
resolved = next( resolved = next(
(r for r in config_roles if r in matched_roles), validated_default (r for r in config_roles if r.lower() in matched_roles), "none"
) )
logger.debug("Resolved role (with role_map) to '%s'.", resolved) logger.debug("Resolved role (with role_map) to '%s'.", resolved)
return resolved return resolved
@@ -664,7 +662,7 @@ def resolve_role(
logger.debug("Parsed roles directly from header: %s", roles_from_header) logger.debug("Parsed roles directly from header: %s", roles_from_header)
resolved = next( resolved = next(
(r for r in config_roles if r in roles_from_header), (r for r in config_roles if r.lower() in roles_from_header),
validated_default, validated_default,
) )
if resolved == validated_default and roles_from_header: if resolved == validated_default and roles_from_header:
+24 -8
View File
@@ -6,6 +6,7 @@ import logging
import re import re
from importlib.util import find_spec from importlib.util import find_spec
from pathlib import Path from pathlib import Path
from typing import Any
from urllib.parse import quote_plus from urllib.parse import quote_plus
import httpx import httpx
@@ -82,6 +83,23 @@ def _is_valid_host(host: str) -> bool:
return False return False
def _clean_stream(request: Request, stream: dict[str, Any]) -> dict[str, Any]:
"""Mask producer urls for admins; others get only producer medias.
Producer and consumer urls and sources can carry credentials that masking
misses, and the non-admin UI only reads producer medias.
"""
producers = stream.get("producers") or []
if request.headers.get("remote-role") != "admin":
return {"producers": [{"medias": p.get("medias")} for p in producers]}
for producer in producers:
producer["url"] = clean_camera_user_pass(producer.get("url", ""))
return stream
@router.get("/go2rtc/streams", dependencies=[Depends(allow_any_authenticated())]) @router.get("/go2rtc/streams", dependencies=[Depends(allow_any_authenticated())])
async def go2rtc_streams(request: Request): async def go2rtc_streams(request: Request):
try: try:
@@ -114,10 +132,11 @@ async def go2rtc_streams(request: Request):
if _get_stream_owner_cameras(request, name) & allowed_cameras if _get_stream_owner_cameras(request, name) & allowed_cameras
} }
for data in stream_data.values(): return JSONResponse(
for producer in data.get("producers") or []: content={
producer["url"] = clean_camera_user_pass(producer.get("url", "")) name: _clean_stream(request, data) for name, data in stream_data.items()
return JSONResponse(content=stream_data) }
)
@router.get( @router.get(
@@ -155,10 +174,7 @@ def go2rtc_camera_stream(request: Request, stream_name: str):
content=({"success": False, "message": "Error fetching stream data"}), content=({"success": False, "message": "Error fetching stream data"}),
status_code=500, status_code=500,
) )
stream_data = r.json() return JSONResponse(content=_clean_stream(request, r.json()))
for producer in stream_data.get("producers", []):
producer["url"] = clean_camera_user_pass(producer.get("url", ""))
return JSONResponse(content=stream_data)
@router.put( @router.put(
+26 -8
View File
@@ -6,6 +6,7 @@ import json
import logging import logging
import operator import operator
import time import time
import uuid
from datetime import datetime from datetime import datetime
from functools import reduce from functools import reduce
from typing import Any, Literal from typing import Any, Literal
@@ -14,7 +15,7 @@ import cv2
import numpy as np import numpy as np
from fastapi import APIRouter, Body, Depends, HTTPException, Request from fastapi import APIRouter, Body, Depends, HTTPException, Request
from fastapi.responses import JSONResponse, StreamingResponse from fastapi.responses import JSONResponse, StreamingResponse
from pydantic import BaseModel from pydantic import BaseModel, Field
from frigate.api.auth import ( from frigate.api.auth import (
allow_any_authenticated, allow_any_authenticated,
@@ -56,6 +57,7 @@ from frigate.genai.utils import (
) )
from frigate.jobs.export import ExportQueueFullError, start_export_job from frigate.jobs.export import ExportQueueFullError, start_export_job
from frigate.jobs.vlm_watch import ( from frigate.jobs.vlm_watch import (
MAX_WATCH_MINUTES,
VLMWatchJob, VLMWatchJob,
get_vlm_watch_job, get_vlm_watch_job,
start_vlm_watch_job, start_vlm_watch_job,
@@ -88,7 +90,7 @@ class VLMMonitorRequest(BaseModel):
camera: str camera: str
condition: str condition: str
max_duration_minutes: int = 60 max_duration_minutes: int = Field(default=60, ge=1, le=MAX_WATCH_MINUTES)
labels: list[str] = [] labels: list[str] = []
zones: list[str] = [] zones: list[str] = []
@@ -306,7 +308,7 @@ async def _execute_search_objects_semantic(
visual_distances: dict[str, float] = {} visual_distances: dict[str, float] = {}
description_distances: dict[str, float] = {} description_distances: dict[str, float] = {}
try: try:
rows = context.search_thumbnail(semantic_query) rows = await asyncio.to_thread(context.search_thumbnail, semantic_query)
visual_distances = {row[0]: row[1] for row in rows} visual_distances = {row[0]: row[1] for row in rows}
except Exception: except Exception:
logger.exception( logger.exception(
@@ -314,7 +316,7 @@ async def _execute_search_objects_semantic(
) )
try: try:
rows = context.search_description(semantic_query) rows = await asyncio.to_thread(context.search_description, semantic_query)
description_distances = {row[0]: row[1] for row in rows} description_distances = {row[0]: row[1] for row in rows}
except Exception: except Exception:
logger.exception( logger.exception(
@@ -448,7 +450,7 @@ async def _execute_find_similar_objects(
try: try:
if similarity_mode in ("visual", "fused"): if similarity_mode in ("visual", "fused"):
rows = context.search_thumbnail(anchor) rows = await asyncio.to_thread(context.search_thumbnail, anchor)
visual_distances = {row[0]: row[1] for row in rows} visual_distances = {row[0]: row[1] for row in rows}
if similarity_mode in ("semantic", "fused"): if similarity_mode in ("semantic", "fused"):
@@ -457,7 +459,7 @@ async def _execute_find_similar_objects(
or anchor.sub_label or anchor.sub_label
or anchor.label or anchor.label
) )
rows = context.search_description(query_text) rows = await asyncio.to_thread(context.search_description, query_text)
description_distances = {row[0]: row[1] for row in rows} description_distances = {row[0]: row[1] for row in rows}
except Exception: except Exception:
logger.exception("Similarity search failed") logger.exception("Similarity search failed")
@@ -1030,12 +1032,17 @@ async def _execute_start_camera_watch(
camera = arguments.get("camera", "").strip() camera = arguments.get("camera", "").strip()
condition = arguments.get("condition", "").strip() condition = arguments.get("condition", "").strip()
max_duration_minutes = int(arguments.get("max_duration_minutes", 60)) max_duration_minutes = int(arguments.get("max_duration_minutes", 60))
max_duration_minutes = max(1, min(MAX_WATCH_MINUTES, max_duration_minutes))
labels = arguments.get("labels") or [] labels = arguments.get("labels") or []
zones = arguments.get("zones") or [] zones = arguments.get("zones") or []
if not camera or not condition: if not camera or not condition:
return {"error": "camera and condition are required."} return {"error": "camera and condition are required."}
for value in (labels, zones):
if not isinstance(value, list) or not all(isinstance(v, str) for v in value):
return {"error": "labels and zones must be lists of strings."}
config = request.app.frigate_config config = request.app.frigate_config
if camera not in config.cameras: if camera not in config.cameras:
return {"error": f"Camera '{camera}' not found."} return {"error": f"Camera '{camera}' not found."}
@@ -1274,6 +1281,14 @@ def _pending_tool_calls_from_tail(
return parse_tool_calls_from_message(tail) return parse_tool_calls_from_message(tail)
def _with_server_ids(tool_calls: list[dict[str, Any]]) -> list[dict[str, Any]]:
"""Give each model tool call a unique id.
Approvals are keyed by id, and some providers reuse ids across calls.
"""
return [{**tc, "id": uuid.uuid4().hex[:9]} for tc in tool_calls]
def _tool_calls_awaiting_approval( def _tool_calls_awaiting_approval(
pending_tool_calls: list[dict[str, Any]], pending_tool_calls: list[dict[str, Any]],
body: ChatCompletionRequest, body: ChatCompletionRequest,
@@ -1599,6 +1614,7 @@ async def chat_completion(
return return
requested = msg.get("tool_calls") requested = msg.get("tool_calls")
if requested: if requested:
requested = _with_server_ids(requested)
stream_iterations += 1 stream_iterations += 1
conversation.append( conversation.append(
build_assistant_message_for_conversation( build_assistant_message_for_conversation(
@@ -1684,13 +1700,15 @@ async def chat_completion(
status_code=500, status_code=500,
) )
pending_tool_calls = response.get("tool_calls")
if pending_tool_calls:
pending_tool_calls = _with_server_ids(pending_tool_calls)
conversation.append( conversation.append(
build_assistant_message_for_conversation( build_assistant_message_for_conversation(
response.get("content"), response.get("tool_calls") response.get("content"), pending_tool_calls
) )
) )
pending_tool_calls = response.get("tool_calls")
if not pending_tool_calls: if not pending_tool_calls:
logger.debug( logger.debug(
f"Chat completion finished with final answer (iterations: {tool_iterations})" f"Chat completion finished with final answer (iterations: {tool_iterations})"
+13 -8
View File
@@ -216,8 +216,12 @@ def train_face(request: Request, name: str, body: dict = None):
status_code=404, status_code=404,
) )
snapshot = get_event_snapshot(event) attributes = (event.data or {}).get("attributes") or []
face_box = event.data["attributes"][0]["box"] snapshot = get_event_snapshot(event) if attributes else None
success = False
if snapshot is not None:
face_box = attributes[0]["box"]
detect_config: DetectConfig = request.app.frigate_config.cameras[ detect_config: DetectConfig = request.app.frigate_config.cameras[
event.camera event.camera
].detect ].detect
@@ -228,14 +232,12 @@ def train_face(request: Request, name: str, body: dict = None):
x2 = x1 + int(face_box[2] * detect_config.width) - 4 x2 = x1 + int(face_box[2] * detect_config.width) - 4
y2 = y1 + int(face_box[3] * detect_config.height) - 4 y2 = y1 + int(face_box[3] * detect_config.height) - 4
face = snapshot[y1:y2, x1:x2] face = snapshot[y1:y2, x1:x2]
success = True
if face.size > 0: if face.size > 0:
try: try:
cv2.imwrite(os.path.join(new_file_folder, new_name), face) success = cv2.imwrite(os.path.join(new_file_folder, new_name), face)
success = True except cv2.error:
except Exception: logger.exception("Failed to save face image for %s", event_id)
pass
if not success: if not success:
return JSONResponse( return JSONResponse(
@@ -1273,7 +1275,10 @@ async def generate_state_examples(request: Request, body: GenerateStateExamplesB
if camera_name in request.app.frigate_config.cameras if camera_name in request.app.frigate_config.cameras
} }
collect_state_classification_examples(model_name, cameras_normalized) async with example_collection_lock:
await asyncio.to_thread(
collect_state_classification_examples, model_name, cameras_normalized
)
return JSONResponse( return JSONResponse(
content={"success": True, "message": "Example generation completed"}, content={"success": True, "message": "Example generation completed"},
+3
View File
@@ -41,6 +41,9 @@ def swap_runtime_config(app: FastAPI, config: FrigateConfig) -> None:
""" """
app.frigate_config = config app.frigate_config = config
if app.replay_manager is not None:
app.replay_manager.update_config(config)
if app.config_holder is not None: if app.config_holder is not None:
app.config_holder.set(config) app.config_holder.set(config)
@@ -29,7 +29,6 @@ class EventsQueryParams(BaseModel):
), ),
deprecated=True, deprecated=True,
) )
favorites: int | None = None
min_score: float | None = None min_score: float | None = None
max_score: float | None = None max_score: float | None = None
min_speed: float | None = None min_speed: float | None = None
@@ -9,8 +9,8 @@ class MediaRecordingsSummaryQueryParams(BaseModel):
class MediaRecordingsAvailabilityQueryParams(BaseModel): class MediaRecordingsAvailabilityQueryParams(BaseModel):
cameras: str = "all" cameras: str = "all"
before: float | SkipJsonSchema[None] = None before: float | SkipJsonSchema[None] = Field(default=None, allow_inf_nan=False)
after: float | SkipJsonSchema[None] = None after: float | SkipJsonSchema[None] = Field(default=None, allow_inf_nan=False)
scale: int = Field(default=30, ge=1) scale: int = Field(default=30, ge=1)
@@ -15,7 +15,6 @@ class EventResponse(BaseModel):
thumbnail: str | None thumbnail: str | None
has_clip: bool has_clip: bool
has_snapshot: bool has_snapshot: bool
retain_indefinitely: bool
plus_id: str | None plus_id: str | None
model_hash: str | None model_hash: str | None
detector_type: str | None detector_type: str | None
+46 -93
View File
@@ -53,11 +53,13 @@ from frigate.api.defs.response.event_response import (
) )
from frigate.api.defs.response.generic_response import GenericResponse from frigate.api.defs.response.generic_response import GenericResponse
from frigate.api.defs.tags import Tags from frigate.api.defs.tags import Tags
from frigate.api.plus_util import plus_rate_limited_response
from frigate.comms.event_metadata_updater import EventMetadataTypeEnum from frigate.comms.event_metadata_updater import EventMetadataTypeEnum
from frigate.config.classification import ObjectClassificationType from frigate.config.classification import ObjectClassificationType
from frigate.const import CLIPS_DIR from frigate.const import CLIPS_DIR
from frigate.embeddings import EmbeddingsContext from frigate.embeddings import EmbeddingsContext
from frigate.models import Event, ReviewSegment, Timeline, Trigger from frigate.models import Event, ReviewSegment, Timeline, Trigger
from frigate.plus import PlusRateLimitError
from frigate.track.object_processing import TrackedObject from frigate.track.object_processing import TrackedObject
from frigate.util.file import get_event_thumbnail_bytes, load_event_snapshot_image from frigate.util.file import get_event_thumbnail_bytes, load_event_snapshot_image
from frigate.util.path import get_trigger_thumbnail_path, safe_join from frigate.util.path import get_trigger_thumbnail_path, safe_join
@@ -67,6 +69,9 @@ logger = logging.getLogger(__name__)
router = APIRouter(tags=[Tags.events]) router = APIRouter(tags=[Tags.events])
# event.data key holding a Frigate+ image id until its annotation is uploaded
PLUS_PENDING_ID_KEY = "plus_pending_id"
def _build_attribute_filter_clause(attributes: str): def _build_attribute_filter_clause(attributes: str):
filtered_attributes = [ filtered_attributes = [
@@ -137,7 +142,6 @@ def events(
has_snapshot = params.has_snapshot has_snapshot = params.has_snapshot
in_progress = params.in_progress in_progress = params.in_progress
include_thumbnails = params.include_thumbnails include_thumbnails = params.include_thumbnails
favorites = params.favorites
min_score = params.min_score min_score = params.min_score
max_score = params.max_score max_score = params.max_score
min_speed = params.min_speed min_speed = params.min_speed
@@ -162,7 +166,6 @@ def events(
Event.has_clip, Event.has_clip,
Event.has_snapshot, Event.has_snapshot,
Event.plus_id, Event.plus_id,
Event.retain_indefinitely,
Event.sub_label, Event.sub_label,
Event.top_score, Event.top_score,
Event.false_positive, Event.false_positive,
@@ -199,18 +202,14 @@ def events(
sub_label_clauses.append(Event.sub_label.is_null()) sub_label_clauses.append(Event.sub_label.is_null())
for label in filtered_sub_labels: for label in filtered_sub_labels:
lowered = label.lower() # SQLite LOWER() only folds ASCII, so lower both sides in SQL to
sub_label_clauses.append( # keep non-ASCII names matching exactly
fn.LOWER(Event.sub_label.cast("text")) == lowered stored = fn.LOWER(Event.sub_label.cast("text"))
) # include exact matches (case-insensitive) sub_label_clauses.append(stored == fn.LOWER(label))
# include this label when part of a list (LIKE is case-insensitive in sqlite for ASCII) # include this label when part of a list
sub_label_clauses.append( sub_label_clauses.append(stored % fn.LOWER(f"*{label},*"))
fn.LOWER(Event.sub_label.cast("text")) % f"*{lowered},*" sub_label_clauses.append(stored % fn.LOWER(f"*, {label}*"))
)
sub_label_clauses.append(
fn.LOWER(Event.sub_label.cast("text")) % f"*, {lowered}*"
)
sub_label_clause = reduce(operator.or_, sub_label_clauses) sub_label_clause = reduce(operator.or_, sub_label_clauses)
clauses.append(sub_label_clause) clauses.append(sub_label_clause)
@@ -311,9 +310,6 @@ def events(
if include_thumbnails: if include_thumbnails:
selected_columns.append(Event.thumbnail) selected_columns.append(Event.thumbnail)
if favorites:
clauses.append(Event.retain_indefinitely == favorites)
if max_score is not None: if max_score is not None:
clauses.append(Event.data["score"] <= max_score) clauses.append(Event.data["score"] <= max_score)
@@ -414,7 +410,6 @@ def events_explore(
Event.has_clip, Event.has_clip,
Event.has_snapshot, Event.has_snapshot,
Event.plus_id, Event.plus_id,
Event.retain_indefinitely,
Event.top_score, Event.top_score,
Event.false_positive, Event.false_positive,
Event.box, Event.box,
@@ -455,7 +450,6 @@ def events_explore(
"has_clip": event.has_clip, "has_clip": event.has_clip,
"has_snapshot": event.has_snapshot, "has_snapshot": event.has_snapshot,
"plus_id": event.plus_id, "plus_id": event.plus_id,
"retain_indefinitely": event.retain_indefinitely,
"sub_label": event.sub_label, "sub_label": event.sub_label,
"top_score": event.top_score, "top_score": event.top_score,
"false_positive": event.false_positive, "false_positive": event.false_positive,
@@ -633,18 +627,14 @@ def events_search(
sub_label_clauses.append(Event.sub_label.is_null()) sub_label_clauses.append(Event.sub_label.is_null())
for label in filtered_sub_labels: for label in filtered_sub_labels:
lowered = label.lower() # SQLite LOWER() only folds ASCII, so lower both sides in SQL to
sub_label_clauses.append( # keep non-ASCII names matching exactly
fn.LOWER(Event.sub_label.cast("text")) == lowered stored = fn.LOWER(Event.sub_label.cast("text"))
) # include exact matches (case-insensitive) sub_label_clauses.append(stored == fn.LOWER(label))
# include this label when part of a list (LIKE is case-insensitive in sqlite for ASCII) # include this label when part of a list
sub_label_clauses.append( sub_label_clauses.append(stored % fn.LOWER(f"*{label},*"))
fn.LOWER(Event.sub_label.cast("text")) % f"*{lowered},*" sub_label_clauses.append(stored % fn.LOWER(f"*, {label}*"))
)
sub_label_clauses.append(
fn.LOWER(Event.sub_label.cast("text")) % f"*, {lowered}*"
)
event_filters.append(reduce(operator.or_, sub_label_clauses)) event_filters.append(reduce(operator.or_, sub_label_clauses))
@@ -1034,34 +1024,6 @@ async def event(event_id: str, request: Request):
return JSONResponse(content="Event not found", status_code=404) return JSONResponse(content="Event not found", status_code=404)
@router.post(
"/events/{event_id}/retain",
response_model=GenericResponse,
dependencies=[Depends(require_role(["admin"]))],
summary="Set event retain indefinitely.",
description="""Sets an event to retain indefinitely.
Returns a success message or an error if the event is not found.
NOTE: This is a legacy endpoint and is not supported in the frontend.
""",
)
def set_retain(event_id: str):
try:
event = Event.get(Event.id == event_id)
except DoesNotExist:
return JSONResponse(
content=({"success": False, "message": "Event " + event_id + " not found"}),
status_code=404,
)
event.retain_indefinitely = True
event.save()
return JSONResponse(
content=({"success": True, "message": "Event " + event_id + " retained"}),
status_code=200,
)
@router.post( @router.post(
"/events/{event_id}/plus", "/events/{event_id}/plus",
response_model=EventUploadPlusResponse, response_model=EventUploadPlusResponse,
@@ -1120,13 +1082,21 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
content=({"success": False, "message": message}), status_code=400 content=({"success": False, "message": message}), status_code=400
) )
# an image uploaded by an earlier attempt whose annotation failed, so a
# retry finishes that submission instead of uploading the image again
plus_id = event.data.get(PLUS_PENDING_ID_KEY)
if plus_id is None:
try: try:
image, is_clean_snapshot = load_event_snapshot_image(event, clean_only=True) image, is_clean_snapshot = load_event_snapshot_image(event, clean_only=True)
except Exception: except Exception:
logger.error(f"Unable to load clean snapshot for event: {event.id}") logger.error(f"Unable to load clean snapshot for event: {event.id}")
return JSONResponse( return JSONResponse(
content=( content=(
{"success": False, "message": "Unable to load clean snapshot for event"} {
"success": False,
"message": "Unable to load clean snapshot for event",
}
), ),
status_code=400, status_code=400,
) )
@@ -1147,6 +1117,8 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
plus_id = await asyncio.to_thread( plus_id = await asyncio.to_thread(
request.app.frigate_config.plus_api.upload_image, image, event.camera request.app.frigate_config.plus_api.upload_image, image, event.camera
) )
except PlusRateLimitError as err:
return plus_rate_limited_response(err)
except Exception as ex: except Exception as ex:
logger.exception(ex) logger.exception(ex)
return JSONResponse( return JSONResponse(
@@ -1154,8 +1126,10 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
status_code=400, status_code=400,
) )
# store image id in the database if include_annotation is not None:
event.plus_id = plus_id # the image isn't marked submitted until its annotation is, or a
# failed annotation could never be retried
event.data[PLUS_PENDING_ID_KEY] = plus_id
event.save() event.save()
if include_annotation is not None: if include_annotation is not None:
@@ -1164,10 +1138,12 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
try: try:
await asyncio.to_thread( await asyncio.to_thread(
request.app.frigate_config.plus_api.add_annotation, request.app.frigate_config.plus_api.add_annotation,
event.plus_id, plus_id,
box, box,
event.label, event.label,
) )
except PlusRateLimitError as err:
return plus_rate_limited_response(err)
except ValueError: except ValueError:
message = "Error uploading annotation, unsupported label provided." message = "Error uploading annotation, unsupported label provided."
logger.error(message) logger.error(message)
@@ -1182,6 +1158,11 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
status_code=400, status_code=400,
) )
# store image id in the database
event.plus_id = plus_id
event.data.pop(PLUS_PENDING_ID_KEY, None)
event.save()
return JSONResponse( return JSONResponse(
content=({"success": True, "plus_id": plus_id}), status_code=200 content=({"success": True, "plus_id": plus_id}), status_code=200
) )
@@ -1264,6 +1245,8 @@ async def false_positive(request: Request, event_id: str):
event.model_type, event.model_type,
event.detector_type, event.detector_type,
) )
except PlusRateLimitError as err:
return plus_rate_limited_response(err)
except ValueError: except ValueError:
message = "Error uploading false positive, unsupported label provided." message = "Error uploading false positive, unsupported label provided."
logger.error(message) logger.error(message)
@@ -1286,35 +1269,6 @@ async def false_positive(request: Request, event_id: str):
) )
@router.delete(
"/events/{event_id}/retain",
response_model=GenericResponse,
dependencies=[Depends(require_role(["admin"]))],
summary="Stop event from being retained indefinitely",
description="""Stops an event from being retained indefinitely.
Returns a success message or an error if the event is not found.
NOTE: This is a legacy endpoint and is not supported in the frontend.
""",
)
async def delete_retain(event_id: str, request: Request):
try:
event = Event.get(Event.id == event_id)
await require_camera_access(event.camera, request=request)
except DoesNotExist:
return JSONResponse(
content=({"success": False, "message": "Event " + event_id + " not found"}),
status_code=404,
)
event.retain_indefinitely = False
event.save()
return JSONResponse(
content=({"success": True, "message": "Event " + event_id + " un-retained"}),
status_code=200,
)
@router.post( @router.post(
"/events/{event_id}/sub_label", "/events/{event_id}/sub_label",
response_model=GenericResponse, response_model=GenericResponse,
@@ -1569,9 +1523,8 @@ async def set_description(
if len(new_description) > 0: if len(new_description) > 0:
# If semantic search is enabled, update the index # If semantic search is enabled, update the index
if request.app.frigate_config.semantic_search.enabled: if request.app.frigate_config.semantic_search.enabled:
context.update_description( await asyncio.to_thread(
event_id, context.update_description, event_id, new_description
new_description,
) )
else: else:
# embeddings are always cleaned up so they don't outlive their description # embeddings are always cleaned up so they don't outlive their description
+1 -1
View File
@@ -88,7 +88,7 @@ def create_fastapi_app(
logger.info("FastAPI started") logger.info("FastAPI started")
asyncio.create_task( asyncio.create_task(
debug_replay_auto_stop_watchdog( debug_replay_auto_stop_watchdog(
replay_manager, frigate_config, config_publisher replay_manager, lambda: app.frigate_config, config_publisher
) )
) )
yield yield
+39 -12
View File
@@ -36,6 +36,7 @@ from frigate.api.defs.query.media_query_parameters import (
MediaMjpegFeedQueryParams, MediaMjpegFeedQueryParams,
) )
from frigate.api.defs.tags import Tags from frigate.api.defs.tags import Tags
from frigate.api.plus_util import plus_rate_limited_response
from frigate.camera.state import CameraState from frigate.camera.state import CameraState
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.config.camera.snapshots import SnapshotsConfig from frigate.config.camera.snapshots import SnapshotsConfig
@@ -47,7 +48,11 @@ from frigate.const import (
STREAM_TYPE_SUB, STREAM_TYPE_SUB,
) )
from frigate.models import Event, Previews, Recordings, Regions, ReviewSegment from frigate.models import Event, Previews, Recordings, Regions, ReviewSegment
from frigate.output.preview import get_most_recent_preview_frame from frigate.output.preview import (
get_most_recent_preview_frame,
is_camera_preview_frame,
)
from frigate.plus import PlusRateLimitError
from frigate.track.object_processing import TrackedObjectProcessor from frigate.track.object_processing import TrackedObjectProcessor
from frigate.util.ffmpeg import terminate_ffmpeg_stream from frigate.util.ffmpeg import terminate_ffmpeg_stream
from frigate.util.file import ( from frigate.util.file import (
@@ -56,7 +61,11 @@ from frigate.util.file import (
get_event_thumbnail_bytes, get_event_thumbnail_bytes,
load_event_snapshot_image, load_event_snapshot_image,
) )
from frigate.util.image import get_image_from_recording, get_image_quality_params from frigate.util.image import (
get_image_from_recording,
get_image_quality_params,
read_image,
)
from frigate.util.object import create_empty_regions_grid from frigate.util.object import create_empty_regions_grid
from frigate.util.recording_coverage import ( from frigate.util.recording_coverage import (
build_spans, build_spans,
@@ -109,7 +118,19 @@ def _resolve_cache_age(max_cache_age: int) -> int:
return max_cache_age.default return max_cache_age.default
@router.get("/{camera_name}", dependencies=[Depends(require_camera_access)]) @router.get(
"/{camera_name}",
dependencies=[Depends(require_camera_access)],
description=(
"An MJPEG stream of the camera's latest processed frame, intended for debugging only. "
"Every frame of every open stream is color converted, annotated, resized, and JPEG "
"encoded in Frigate's main process, which adds load to the system and can slow down "
"Frigate's processing. It is strictly not recommended to view this stream "
"continuously, such as on a dashboard. For live viewing, use a go2rtc restream "
"instead. The frame rate and resolution can be raised with the fps and height "
"parameters, for example ?fps=10&height=1080, at the cost of additional load."
),
)
async def mjpeg_feed( async def mjpeg_feed(
request: Request, request: Request,
camera_name: str, camera_name: str,
@@ -154,10 +175,13 @@ def imagestream(
time.sleep(1 / fps) time.sleep(1 / fps)
frame = detected_frames_processor.get_current_frame(camera_name, draw_options) frame = detected_frames_processor.get_current_frame(camera_name, draw_options)
if frame is None: if frame is None:
frame = np.zeros((height, int(height * 16 / 9), 3), np.uint8) frame = np.zeros((360, 640, 3), np.uint8)
width = int(height * frame.shape[1] / frame.shape[0]) frame_height = min(height, frame.shape[0])
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_LINEAR) width = int(frame_height * frame.shape[1] / frame.shape[0])
frame = cv2.resize(
frame, dsize=(width, frame_height), interpolation=cv2.INTER_LINEAR
)
ret, jpg = cv2.imencode(".jpg", frame, [int(cv2.IMWRITE_JPEG_QUALITY), 70]) ret, jpg = cv2.imencode(".jpg", frame, [int(cv2.IMWRITE_JPEG_QUALITY), 70])
yield ( yield (
@@ -239,7 +263,7 @@ async def latest_frame(
if preview_path: if preview_path:
logger.debug(f"Using most recent preview frame for {camera_name}") logger.debug(f"Using most recent preview frame for {camera_name}")
frame = cv2.imread(preview_path, cv2.IMREAD_UNCHANGED) frame = read_image(preview_path, cv2.IMREAD_UNCHANGED)
if frame is not None: if frame is not None:
is_offline = True is_offline = True
@@ -266,7 +290,7 @@ async def latest_frame(
status_code=500, status_code=500,
) )
height = int(params.height or str(frame.shape[0])) height = min(params.height or frame.shape[0], frame.shape[0])
width = int(height * frame.shape[1] / frame.shape[0]) width = int(height * frame.shape[1] / frame.shape[0])
if height < 1 or width < 1: if height < 1 or width < 1:
@@ -308,7 +332,7 @@ async def latest_frame(
frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420) frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
height = int(params.height or str(frame.shape[0])) height = min(params.height or frame.shape[0], frame.shape[0])
width = int(height * frame.shape[1] / frame.shape[0]) width = int(height * frame.shape[1] / frame.shape[0])
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_AREA) frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_AREA)
@@ -416,7 +440,7 @@ async def get_snapshot_from_recording(
@router.post( @router.post(
"/{camera_name}/plus/{frame_time}", dependencies=[Depends(require_camera_access)] "/{camera_name}/plus/{frame_time}", dependencies=[Depends(require_role(["admin"]))]
) )
async def submit_recording_snapshot_to_plus( async def submit_recording_snapshot_to_plus(
request: Request, camera_name: str, frame_time: str request: Request, camera_name: str, frame_time: str
@@ -461,9 +485,12 @@ async def submit_recording_snapshot_to_plus(
) )
nd = cv2.imdecode(np.frombuffer(image_data, dtype=np.int8), cv2.IMREAD_COLOR) nd = cv2.imdecode(np.frombuffer(image_data, dtype=np.int8), cv2.IMREAD_COLOR)
try:
await asyncio.to_thread( await asyncio.to_thread(
request.app.frigate_config.plus_api.upload_image, nd, camera_name request.app.frigate_config.plus_api.upload_image, nd, camera_name
) )
except PlusRateLimitError as err:
return plus_rate_limited_response(err)
return JSONResponse( return JSONResponse(
content={ content={
@@ -1591,7 +1618,7 @@ async def preview_gif(
camera_files = [ camera_files = [
entry.name entry.name
for entry in os.scandir(preview_dir) for entry in os.scandir(preview_dir)
if entry.name.startswith(file_start) if is_camera_preview_frame(entry.name, camera_name)
] ]
camera_files.sort() camera_files.sort()
@@ -1782,7 +1809,7 @@ async def preview_mp4(
camera_files = [ camera_files = [
entry.name entry.name
for entry in os.scandir(preview_dir) for entry in os.scandir(preview_dir)
if entry.name.startswith(file_start) if is_camera_preview_frame(entry.name, camera_name)
] ]
camera_files.sort() camera_files.sort()
+23 -9
View File
@@ -17,10 +17,10 @@ import re
from enum import Enum from enum import Enum
from urllib.parse import unquote from urllib.parse import unquote
from peewee import DoesNotExist from peewee import DoesNotExist, Field
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.const import EXPORT_DIR from frigate.const import CLIPS_DIR, EXPORT_DIR, SUB_CACHE_TAG
from frigate.models import Export, User from frigate.models import Export, User
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -137,11 +137,12 @@ def _resolve_recording(
# /recordings/{date} → neutral # /recordings/{date} → neutral
# /recordings/{date}/{hour} → multi-camera listing # /recordings/{date}/{hour} → multi-camera listing
# /recordings/{date}/{hour}/{cam}/... → camera # /recordings/{date}/{hour}/{cam}/... → camera
# /recordings/{date}/{hour}/{cam}@sub/... → camera (sub stream)
if len(parts) <= 2: if len(parts) <= 2:
return MediaAuthResolution.LISTING_NEUTRAL, None return MediaAuthResolution.LISTING_NEUTRAL, None
if len(parts) == 3: if len(parts) == 3:
return MediaAuthResolution.LISTING_MULTI_CAMERA, None return MediaAuthResolution.LISTING_MULTI_CAMERA, None
return MediaAuthResolution.CAMERA, parts[3] return MediaAuthResolution.CAMERA, parts[3].removesuffix(SUB_CACHE_TAG)
def _resolve_clip( def _resolve_clip(
@@ -150,7 +151,9 @@ def _resolve_clip(
# /clips → multi-camera listing # /clips → multi-camera listing
# /clips/thumbs/{cam}/... → camera # /clips/thumbs/{cam}/... → camera
# /clips/previews/{cam}/... → camera # /clips/previews/{cam}/... → camera
# /clips/triggers/{cam}/... → camera
# /clips/review/thumb-{cam}-{review_id}.webp → camera (parsed) # /clips/review/thumb-{cam}-{review_id}.webp → camera (parsed)
# /clips/export/{export_id}.{ext} → camera (DB lookup)
# /clips/faces/... → admin-only # /clips/faces/... → admin-only
# /clips/genai-requests/... → admin-only # /clips/genai-requests/... → admin-only
# /clips/preview_restart_cache/... → admin-only # /clips/preview_restart_cache/... → admin-only
@@ -162,7 +165,7 @@ def _resolve_clip(
second = parts[1] second = parts[1]
if second in ("thumbs", "previews"): if second in ("thumbs", "previews", "triggers"):
if len(parts) == 2: if len(parts) == 2:
return MediaAuthResolution.LISTING_MULTI_CAMERA, None return MediaAuthResolution.LISTING_MULTI_CAMERA, None
return MediaAuthResolution.CAMERA, parts[2] return MediaAuthResolution.CAMERA, parts[2]
@@ -175,6 +178,11 @@ def _resolve_clip(
return MediaAuthResolution.CAMERA, camera return MediaAuthResolution.CAMERA, camera
return MediaAuthResolution.UNRESOLVED_MEDIA, None return MediaAuthResolution.UNRESOLVED_MEDIA, None
if second == "export" and len(parts) == 3:
return _export_camera(
Export.thumb_path, os.path.join(CLIPS_DIR, "export", parts[2])
)
if second in ("faces", "genai-requests", "preview_restart_cache"): if second in ("faces", "genai-requests", "preview_restart_cache"):
return MediaAuthResolution.ADMIN_ONLY, None return MediaAuthResolution.ADMIN_ONLY, None
@@ -234,15 +242,19 @@ def _resolve_export(
if len(parts) != 2: if len(parts) != 2:
return MediaAuthResolution.UNRESOLVED_MEDIA, None return MediaAuthResolution.UNRESOLVED_MEDIA, None
filename = parts[1] return _export_camera(Export.video_path, os.path.join(EXPORT_DIR, parts[1]))
full_path = os.path.join(EXPORT_DIR, filename)
def _export_camera(
field: Field, full_path: str
) -> tuple[MediaAuthResolution, str | None]:
try: try:
export = Export.get(Export.video_path == full_path) export = Export.get(field == full_path)
return MediaAuthResolution.CAMERA, export.camera return MediaAuthResolution.CAMERA, export.camera
except DoesNotExist: except DoesNotExist:
return MediaAuthResolution.UNRESOLVED_MEDIA, None return MediaAuthResolution.UNRESOLVED_MEDIA, None
except Exception as e: except Exception as e:
logger.warning("Export DB lookup failed for %s: %s", filename, e) logger.warning("Export DB lookup failed for %s: %s", full_path, e)
return MediaAuthResolution.UNRESOLVED_MEDIA, None return MediaAuthResolution.UNRESOLVED_MEDIA, None
@@ -301,6 +313,9 @@ def deny_response_for_media_uri(
if not role or role == "admin": if not role or role == "admin":
return None return None
if resolution == MediaAuthResolution.ADMIN_ONLY:
return 403
if not is_role_restricted(role, frigate_config): if not is_role_restricted(role, frigate_config):
return None return None
@@ -309,7 +324,6 @@ def deny_response_for_media_uri(
if resolution in ( if resolution in (
MediaAuthResolution.LISTING_MULTI_CAMERA, MediaAuthResolution.LISTING_MULTI_CAMERA,
MediaAuthResolution.ADMIN_ONLY,
MediaAuthResolution.UNRESOLVED_MEDIA, MediaAuthResolution.UNRESOLVED_MEDIA,
): ):
return 403 return 403
+31
View File
@@ -0,0 +1,31 @@
"""Shared responses for endpoints that call Frigate+."""
from fastapi.responses import JSONResponse
from frigate.plus import PlusRateLimitError
def plus_rate_limited_response(err: PlusRateLimitError) -> JSONResponse:
"""Tell the client Frigate+ is rate limiting requests and how long to wait.
Args:
err: The rate limit raised by the Frigate+ client
Returns:
A 429 response with the wait in retry_after (and the Retry-After
header) when Frigate+ provided one
"""
headers = None
if err.retry_after is not None:
headers = {"Retry-After": str(err.retry_after)}
return JSONResponse(
content={
"success": False,
"message": "Frigate+ is rate limiting requests, try again later",
"retry_after": err.retry_after,
},
status_code=429,
headers=headers,
)
+2 -1
View File
@@ -22,6 +22,7 @@ from frigate.api.defs.response.preview_response import (
from frigate.api.defs.tags import Tags from frigate.api.defs.tags import Tags
from frigate.const import BASE_DIR, CACHE_DIR, PREVIEW_FRAME_TYPE from frigate.const import BASE_DIR, CACHE_DIR, PREVIEW_FRAME_TYPE
from frigate.models import Previews from frigate.models import Previews
from frigate.output.preview import is_camera_preview_frame
from frigate.util.time import get_normalized_tz_name from frigate.util.time import get_normalized_tz_name
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -187,7 +188,7 @@ def get_preview_frames_from_cache(camera_name: str, start_ts: float, end_ts: flo
left = bisect.bisect_left(files, start_file) left = bisect.bisect_left(files, start_file)
right = bisect.bisect_right(files, end_file) right = bisect.bisect_right(files, end_file)
selected_previews = [ selected_previews = [
file for file in files[left:right] if file.startswith(file_start) file for file in files[left:right] if is_camera_preview_frame(file, camera_name)
] ]
return JSONResponse( return JSONResponse(
+29 -35
View File
@@ -2,6 +2,7 @@
import datetime as dt import datetime as dt
import logging import logging
import math
from datetime import datetime, timedelta from datetime import datetime, timedelta
from functools import reduce from functools import reduce
from pathlib import Path from pathlib import Path
@@ -443,45 +444,38 @@ async def no_recordings(
else: else:
covered.append((rec_start, rec_end)) covered.append((rec_start, rec_end))
# Iterate through time segments and check if each has any recording # A scale-sized bucket counts as empty when it fits inside a gap between
no_recording_segments = [] # covered intervals. Walking the gaps keeps the work proportional to the
current = after # recordings found rather than to the requested span.
current_gap_start = None bucket_count = math.ceil((before - after) / scale)
idx = 0 gaps: list[list[float]] = []
covered_count = len(covered) free_start = -math.inf
while current < before: for rec_start, rec_end in covered + [(math.inf, math.inf)]:
segment_end = min(current + scale, before) first = 0 if free_start <= after else math.ceil((free_start - after) / scale)
# Advance past covered intervals that end before this segment begins; if rec_start >= before:
# they cannot overlap this or any later segment. last = bucket_count - 1
while idx < covered_count and covered[idx][1] <= current:
idx += 1
# A covered interval overlaps the segment when it starts before the
# segment ends (its end is already known to be > current).
has_recording = idx < covered_count and covered[idx][0] < segment_end
if not has_recording:
# This segment has no recordings
if current_gap_start is None:
current_gap_start = current # Start a new gap
else: else:
# This segment has recordings last = min(math.floor((rec_start - after) / scale), bucket_count) - 1
if current_gap_start is not None:
# End the current gap and append it
no_recording_segments.append(
{"start_time": int(current_gap_start), "end_time": int(current)}
)
current_gap_start = None
current = segment_end if first <= last:
gap_start = after + first * scale
gap_end = before if last == bucket_count - 1 else after + (last + 1) * scale
# Append the last gap if it exists if gaps and gaps[-1][1] == gap_start:
if current_gap_start is not None: gaps[-1][1] = gap_end
no_recording_segments.append( else:
{"start_time": int(current_gap_start), "end_time": int(before)} gaps.append([gap_start, gap_end])
)
free_start = rec_end
if free_start >= before:
break
no_recording_segments = [
{"start_time": int(gap_start), "end_time": int(gap_end)}
for gap_start, gap_end in gaps
]
return JSONResponse(content=no_recording_segments) return JSONResponse(content=no_recording_segments)
@@ -495,7 +489,7 @@ async def no_recordings(
Recordings can be filtered by cameras and kept based on motion, objects, or audio attributes. Recordings can be filtered by cameras and kept based on motion, objects, or audio attributes.
""", """,
) )
async def delete_recordings( def delete_recordings(
start: float = PathParam(..., description="Start timestamp (unix)"), start: float = PathParam(..., description="Start timestamp (unix)"),
end: float = PathParam(..., description="End timestamp (unix)"), end: float = PathParam(..., description="End timestamp (unix)"),
params: RecordingsDeleteQueryParams = Depends(), params: RecordingsDeleteQueryParams = Depends(),
+22 -8
View File
@@ -1,5 +1,6 @@
"""Review apis.""" """Review apis."""
import asyncio
import datetime import datetime
import logging import logging
from functools import reduce from functools import reduce
@@ -82,12 +83,19 @@ async def review(
reviewed = params.reviewed reviewed = params.reviewed
limit = params.limit limit = params.limit
severity = params.severity severity = params.severity
before = params.before or datetime.datetime.now().timestamp() before = (
after = ( params.before
params.after if params.before is not None
or (datetime.datetime.now() - datetime.timedelta(hours=24)).timestamp() else datetime.datetime.now().timestamp()
) )
if params.after is not None:
after = params.after
elif params.before is not None:
after = 0
else:
after = (datetime.datetime.now() - datetime.timedelta(hours=24)).timestamp()
clauses = [ clauses = [
(ReviewSegment.start_time < before) (ReviewSegment.start_time < before)
& ((ReviewSegment.end_time.is_null(True)) | (ReviewSegment.end_time > after)) & ((ReviewSegment.end_time.is_null(True)) | (ReviewSegment.end_time > after))
@@ -705,12 +713,18 @@ def motion_activity(
response_model=ReviewSegmentResponse, response_model=ReviewSegmentResponse,
dependencies=[Depends(allow_any_authenticated())], dependencies=[Depends(allow_any_authenticated())],
) )
async def get_review_from_event(request: Request, event_id: str): async def get_review_from_event(
event_id: str,
allowed_cameras: list[str] = Depends(get_allowed_cameras_for_filter),
):
try: try:
review = ReviewSegment.get( review = ReviewSegment.get(
ReviewSegment.data["detections"].cast("text") % f'*"{event_id}"*' (ReviewSegment.camera << allowed_cameras)
& (
fn.instr(ReviewSegment.data["detections"].cast("text"), f'"{event_id}"')
> 0
)
) )
await require_camera_access(review.camera, request=request)
return JSONResponse(model_to_dict(review)) return JSONResponse(model_to_dict(review))
except DoesNotExist: except DoesNotExist:
return JSONResponse( return JSONResponse(
@@ -790,7 +804,7 @@ async def regenerate_review_description(request: Request, review_id: str):
) )
context: EmbeddingsContext = request.app.embeddings context: EmbeddingsContext = request.app.embeddings
context.regenerate_review_description(review_id) await asyncio.to_thread(context.regenerate_review_description, review_id)
return JSONResponse( return JSONResponse(
content={ content={
+32 -21
View File
@@ -4,6 +4,7 @@ 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
@@ -76,7 +77,7 @@ from frigate.models import (
from frigate.notices import install_registry from frigate.notices import install_registry
from frigate.notices.registry import NoticeRegistry from frigate.notices.registry import NoticeRegistry
from frigate.object_detection.base import ObjectDetectProcess from frigate.object_detection.base import ObjectDetectProcess
from frigate.object_detection.util import detection_frame_size from frigate.object_detection.util import create_detection_input_shm
from frigate.output.output import OutputProcess from frigate.output.output import OutputProcess
from frigate.ptz.autotrack import PtzAutoTracker from frigate.ptz.autotrack import PtzAutoTracker
from frigate.ptz.onvif import OnvifController from frigate.ptz.onvif import OnvifController
@@ -91,7 +92,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 from frigate.util.ownership import chown_to_runtime, find_unwritable_database_path
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
@@ -197,8 +198,32 @@ 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(self.config.database.path) migrate_db = SqliteDatabase(db_path)
# Run migrations # Run migrations
del logging.getLogger("peewee_migrate").handlers[:] del logging.getLogger("peewee_migrate").handlers[:]
@@ -206,10 +231,8 @@ 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...")
shutil.copyfile( exit_if_unwritable((backup_path,))
self.config.database.path, shutil.copyfile(db_path, backup_path)
self.config.database.path.replace("frigate.db", "backup.db"),
)
router.run() router.run()
@@ -235,12 +258,7 @@ 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 ( for db_file in db_files:
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)
@@ -399,14 +417,7 @@ class FrigateApp:
model = self.config.model_for_camera(name) model = self.config.model_for_camera(name)
model_cameras[model.scene].append(name) model_cameras[model.scene].append(name)
try: shm_in = create_detection_input_shm(name, self.config.models)
shm_in = UntrackedSharedMemory(
name=name,
create=True,
size=detection_frame_size(model),
)
except FileExistsError:
shm_in = UntrackedSharedMemory(name=name)
try: try:
shm_out = UntrackedSharedMemory( shm_out = UntrackedSharedMemory(
+2
View File
@@ -11,6 +11,7 @@ class CameraMetrics:
detection_frame: ValueProxy[float] detection_frame: ValueProxy[float]
process_fps: ValueProxy[float] process_fps: ValueProxy[float]
skipped_fps: ValueProxy[float] skipped_fps: ValueProxy[float]
dropped_fps: ValueProxy[float]
read_start: ValueProxy[float] read_start: ValueProxy[float]
audio_rms: ValueProxy[float] audio_rms: ValueProxy[float]
audio_dBFS: ValueProxy[float] audio_dBFS: ValueProxy[float]
@@ -29,6 +30,7 @@ class CameraMetrics:
self.detection_frame = manager.Value("d", 0) self.detection_frame = manager.Value("d", 0)
self.process_fps = manager.Value("d", 0) self.process_fps = manager.Value("d", 0)
self.skipped_fps = manager.Value("d", 0) self.skipped_fps = manager.Value("d", 0)
self.dropped_fps = manager.Value("d", 0)
self.read_start = manager.Value("d", 0) self.read_start = manager.Value("d", 0)
self.audio_rms = manager.Value("d", 0) self.audio_rms = manager.Value("d", 0)
self.audio_dBFS = manager.Value("d", 0) self.audio_dBFS = manager.Value("d", 0)
+3 -6
View File
@@ -16,7 +16,7 @@ from frigate.config.camera.updater import (
) )
from frigate.const import REPLAY_CAMERA_PREFIX from frigate.const import REPLAY_CAMERA_PREFIX
from frigate.models import Regions from frigate.models import Regions
from frigate.object_detection.util import detection_frame_size from frigate.object_detection.util import create_detection_input_shm
from frigate.util.builtin import empty_and_close_queue from frigate.util.builtin import empty_and_close_queue
from frigate.util.image import SharedMemoryFrameManager, UntrackedSharedMemory from frigate.util.image import SharedMemoryFrameManager, UntrackedSharedMemory
from frigate.util.object import get_camera_regions_grid from frigate.util.object import get_camera_regions_grid
@@ -127,13 +127,10 @@ class CameraMaintainer(threading.Thread):
max(model.width, model.height), max(model.width, model.height),
) )
create_detection_input_shm(name, self.config.models)
try: try:
UntrackedSharedMemory(name=f"out-{name}", create=True, size=20 * 6 * 4) UntrackedSharedMemory(name=f"out-{name}", create=True, size=20 * 6 * 4)
UntrackedSharedMemory(
name=name,
create=True,
size=detection_frame_size(model),
)
except FileExistsError: except FileExistsError:
pass pass
+4 -2
View File
@@ -24,6 +24,7 @@ from frigate.util.image import (
draw_timestamp, draw_timestamp,
is_better_thumbnail, is_better_thumbnail,
is_label_printable, is_label_printable,
write_image,
) )
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -296,7 +297,8 @@ class CameraState:
return frame_copy return frame_copy
def finished(self, obj_id: str) -> None: def finished(self, obj_id: str) -> None:
del self.tracked_objects[obj_id] # state rebuilt after a resolution or scene change no longer has the object
self.tracked_objects.pop(obj_id, None)
def on(self, event_type: str, callback: Callable[..., Any]) -> None: def on(self, event_type: str, callback: Callable[..., Any]) -> None:
self.callbacks[event_type].append(callback) self.callbacks[event_type].append(callback)
@@ -646,7 +648,7 @@ class CameraState:
thumb = cv2.resize(img_frame, dsize=(width, 175), interpolation=cv2.INTER_AREA) thumb = cv2.resize(img_frame, dsize=(width, 175), interpolation=cv2.INTER_AREA)
thumb_path = os.path.join(THUMB_DIR, self.name) thumb_path = os.path.join(THUMB_DIR, self.name)
os.makedirs(thumb_path, exist_ok=True) os.makedirs(thumb_path, exist_ok=True)
cv2.imwrite(os.path.join(thumb_path, f"{event_id}.webp"), thumb) write_image(os.path.join(thumb_path, f"{event_id}.webp"), thumb)
def shutdown(self) -> None: def shutdown(self) -> None:
for obj in self.tracked_objects.values(): for obj in self.tracked_objects.values():
+3 -1
View File
@@ -3,6 +3,8 @@
from enum import Enum from enum import Enum
from typing import Any from typing import Any
from frigate.const import FAST_QUEUE_TIMEOUT
from .zmq_proxy import Publisher, Subscriber from .zmq_proxy import Publisher, Subscriber
@@ -33,7 +35,7 @@ class DetectionSubscriber(Subscriber):
super().__init__(topic) super().__init__(topic)
def check_for_update( def check_for_update(
self, timeout: float | None = None self, timeout: float | None = FAST_QUEUE_TIMEOUT
) -> tuple[str, Any] | tuple[None, None] | None: ) -> tuple[str, Any] | tuple[None, None] | None:
return super().check_for_update(timeout) return super().check_for_update(timeout)
+26 -9
View File
@@ -180,6 +180,8 @@ class WebPushClient(Communicator):
self.refresh: int = 0 self.refresh: int = 0
self.web_pushers: dict[str, list[WebPusher]] = {} self.web_pushers: dict[str, list[WebPusher]] = {}
self.expired_subs: dict[str, list[str]] = {} self.expired_subs: dict[str, list[str]] = {}
self.expired_subs_lock = threading.Lock()
self.cleanup_lock = threading.Lock()
self.suspended_cameras: dict[str, int] = { self.suspended_cameras: dict[str, int] = {
c.name: 0 # type: ignore[misc] c.name: 0 # type: ignore[misc]
for c in self.config.cameras.values() for c in self.config.cameras.values()
@@ -260,15 +262,23 @@ class WebPushClient(Communicator):
self.claim_headers[endpoint] = self.vapid.sign(claim) self.claim_headers[endpoint] = self.vapid.sign(claim)
def cleanup_registrations(self) -> None: def cleanup_registrations(self) -> None:
# delete any expired subs # concurrent cleanups would each restore what the other removed
if len(self.expired_subs) > 0: with self.cleanup_lock:
for user, expired in self.expired_subs.items(): with self.expired_subs_lock:
expired_subs, self.expired_subs = self.expired_subs, {}
for user, expired in expired_subs.items():
user_subs = [] user_subs = []
# get all subscriptions, removing ones that are expired # get all subscriptions, removing ones that are expired
stored_user: User = User.get_by_id(user) stored_user: User | None = User.get_or_none(User.username == user)
# the user was deleted after the endpoint expired
if stored_user is None:
continue
for token in stored_user.notification_tokens: for token in stored_user.notification_tokens:
if token["endpoint"] in expired: if isinstance(token, dict) and token.get("endpoint") in expired:
continue continue
user_subs.append(token) user_subs.append(token)
@@ -284,8 +294,6 @@ class WebPushClient(Communicator):
f"Cleaned up {len(expired)} notification subscriptions for {user}" f"Cleaned up {len(expired)} notification subscriptions for {user}"
) )
self.expired_subs = {}
def suspend_notifications(self, camera: str, minutes: int) -> None: def suspend_notifications(self, camera: str, minutes: int) -> None:
"""Suspend notifications for a specific camera.""" """Suspend notifications for a specific camera."""
suspend_until = int( suspend_until = int(
@@ -460,6 +468,7 @@ class WebPushClient(Communicator):
) )
if resp.status_code in (404, 410): if resp.status_code in (404, 410):
with self.expired_subs_lock:
self.expired_subs.setdefault(notification.user, []).append( self.expired_subs.setdefault(notification.user, []).append(
endpoint endpoint
) )
@@ -581,6 +590,7 @@ class WebPushClient(Communicator):
sorted_objects.add(obj) sorted_objects.add(obj)
sorted_objects.update(payload["after"]["data"]["sub_labels"]) sorted_objects.update(payload["after"]["data"]["sub_labels"])
sorted_objects.update(payload["after"]["data"]["audio"])
image = f"{payload['after']['thumb_path'].replace(BASE_DIR, '')}" image = f"{payload['after']['thumb_path'].replace(BASE_DIR, '')}"
ended = state == "end" or state == "genai" ended = state == "end" or state == "genai"
@@ -617,7 +627,14 @@ class WebPushClient(Communicator):
else: else:
formatted_zone_names.append(titlecase(zone_name.replace("_", " "))) formatted_zone_names.append(titlecase(zone_name.replace("_", " ")))
title = f"{titlecase(', '.join(sorted_objects).replace('_', ' '))}{' was' if state == 'end' else ''} detected in {', '.join(formatted_zone_names)}" object_names = titlecase(
", ".join(sorted(sorted_objects)).replace("_", " ")
)
title = f"{object_names}{' was' if state == 'end' else ''} detected"
if formatted_zone_names:
title += f" in {', '.join(formatted_zone_names)}"
message = f"Detected on {camera_name}" message = f"Detected on {camera_name}"
if ended: if ended:
@@ -677,7 +694,7 @@ class WebPushClient(Communicator):
title = f"{name.replace('_', ' ')} triggered on {camera_name}" title = f"{name.replace('_', ' ')} triggered on {camera_name}"
message = f"{titlecase(trigger_type)} trigger fired for {camera_name} with score {score:.2f}" message = f"{titlecase(trigger_type)} trigger fired for {camera_name} with score {score:.2f}"
image = f"clips/triggers/{camera}/{event_id}.webp" image = f"api/events/{event_id}/thumbnail.webp"
direct_url = f"/explore?event_id={event_id}" direct_url = f"/explore?event_id={event_id}"
ttl = 0 ttl = 0
+7 -12
View File
@@ -40,6 +40,7 @@ from frigate.const import (
) )
from frigate.models import User from frigate.models import User
from frigate.output.ws_auth import ws_has_camera_access from frigate.output.ws_auth import ws_has_camera_access
from frigate.util.builtin import scope_stats_for_non_admin
from frigate.util.origin import origin_allowed from frigate.util.origin import origin_allowed
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -210,7 +211,7 @@ _WS_RESHAPE_JOB_STATE_TOPICS = frozenset(
# Topics whose payload mixes global aggregates with a ``cameras`` sub-dict # Topics whose payload mixes global aggregates with a ``cameras`` sub-dict
# keyed by camera name. Aggregates and detector data stay; per-camera entries # keyed by camera name. Aggregates and detector data stay; per-camera entries
# are filtered. # are filtered and process cmdlines are stripped for non-admins.
_WS_RESHAPE_STATS_TOPICS = frozenset( _WS_RESHAPE_STATS_TOPICS = frozenset(
{ {
"stats", "stats",
@@ -455,20 +456,14 @@ def _materialize_for_ws(
return _wrap_envelope(topic, filtered_jobs) return _wrap_envelope(topic, filtered_jobs)
if kind == "reshape_stats": if kind == "reshape_stats":
if _ws_is_unrestricted(ws, config): if "admin" in _ws_valid_roles(ws, config):
return full_message return full_message
if not isinstance(parsed_payload, dict): if not isinstance(parsed_payload, dict):
return None return None
allowed = _ws_allowed_cameras(ws, config) return _wrap_envelope(
cameras_block = parsed_payload.get("cameras") topic,
if isinstance(cameras_block, dict): scope_stats_for_non_admin(parsed_payload, _ws_allowed_cameras(ws, config)),
filtered_cameras = { )
name: data for name, data in cameras_block.items() if name in allowed
}
reshaped = dict(parsed_payload)
reshaped["cameras"] = filtered_cameras
return _wrap_envelope(topic, reshaped)
return full_message
return None return None
+6 -5
View File
@@ -88,16 +88,17 @@ class AuthConfig(FrigateBaseModel):
f"Invalid role name '{role}'. Must be alphanumeric with underscores." f"Invalid role name '{role}'. Must be alphanumeric with underscores."
) )
# 'none' is the deny sentinel for proxy.default_role, where it is matched # Proxy role headers match role names case-insensitively, so reserved
# case-insensitively, so every casing of it has to be reserved here # names are reserved in every casing and names must differ beyond case
used_reserved = sorted( used_reserved = sorted(r for r in v if r.lower() in ("admin", "viewer", "none"))
r for r in v if r in ("admin", "viewer") or r.lower() == "none"
)
if used_reserved: if used_reserved:
raise ValueError( raise ValueError(
f"Reserved role name(s) {', '.join(used_reserved)} cannot be used as custom roles." f"Reserved role name(s) {', '.join(used_reserved)} cannot be used as custom roles."
) )
if len({r.lower() for r in v}) != len(v):
raise ValueError("Role names must be unique regardless of letter case.")
# Ensure no role has an empty camera list # Ensure no role has an empty camera list
for role, allowed_cameras in v.items(): for role, allowed_cameras in v.items():
if not allowed_cameras: if not allowed_cameras:
+11
View File
@@ -1,5 +1,6 @@
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
@@ -208,6 +209,12 @@ 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:
@@ -249,6 +256,10 @@ 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:
+25 -4
View File
@@ -4,6 +4,7 @@ import io
import json import json
import logging import logging
import os import os
from collections.abc import Mapping
from typing import Any, Self from typing import Any, Self
import numpy as np import numpy as np
@@ -34,7 +35,7 @@ from frigate.util.config import (
get_relative_coordinates, get_relative_coordinates,
migrate_frigate_config, migrate_frigate_config,
) )
from frigate.util.env import EnvVars, reload_sources from frigate.util.env import EnvVars, candidate_env_vars, reload_sources
from frigate.util.image import create_mask from frigate.util.image import create_mask
from frigate.util.live_streams import ( from frigate.util.live_streams import (
default_transcode_source, default_transcode_source,
@@ -1041,6 +1042,15 @@ class FrigateConfig(FrigateBaseModel):
# set notifications state # set notifications state
self.notifications.enabled_in_config = self.notifications.enabled self.notifications.enabled_in_config = self.notifications.enabled
default_role = (self.proxy.default_role or "").lower()
if default_role != "none" and default_role not in {
r.lower() for r in self.auth.roles
}:
logger.warning(
"proxy.default_role '%s' is not a configured role, so proxy users without a matching role are denied",
self.proxy.default_role,
)
# validate genai: each role (chat, descriptions, embeddings, transcribe) at most once # validate genai: each role (chat, descriptions, embeddings, transcribe) at most once
role_to_name: dict[GenAIRoleEnum, str] = {} role_to_name: dict[GenAIRoleEnum, str] = {}
for name, genai_cfg in self.genai.items(): for name, genai_cfg in self.genai.items():
@@ -1203,6 +1213,11 @@ 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":
@@ -1557,6 +1572,12 @@ class FrigateConfig(FrigateBaseModel):
def parse_object( def parse_object(
cls, obj: Any, *, plus_api: PlusApi | None = None, install: bool = False cls, obj: Any, *, plus_api: PlusApi | None = None, install: bool = False
): ):
return cls.model_validate( context = {"plus_api": plus_api, "install": install}
obj, context={"plus_api": plus_api, "install": install}
) if install:
return cls.model_validate(obj, context=context)
# a candidate config resolves placeholders against its own block
env_vars = obj.get("environment_vars") if isinstance(obj, Mapping) else None
with candidate_env_vars(env_vars):
return cls.model_validate(obj, context=context)
+10
View File
@@ -84,3 +84,13 @@ class MqttConfig(FrigateBaseModel):
if (self.user is None) != (self.password is None): if (self.user is None) != (self.password is None):
raise ValueError("Password must be provided with username.") raise ValueError("Password must be provided with username.")
return self return self
@model_validator(mode="after")
def tls_insecure_requires_tls(self) -> Self:
"""Reject TLS verification settings without TLS when MQTT is enabled."""
if self.enabled and self.tls_insecure is not None and self.tls_ca_certs is None:
raise ValueError(
"tls_insecure requires tls_ca_certs. Remove tls_insecure for plaintext "
"MQTT, or set tls_ca_certs to a CA certificate path to enable TLS."
)
return self
+3 -4
View File
@@ -55,10 +55,9 @@ class ProxyConfig(FrigateBaseModel):
@field_validator("default_role", mode="before") @field_validator("default_role", mode="before")
@classmethod @classmethod
def normalize_deny_sentinel(cls, v): def normalize_deny_sentinel(cls, v):
# Fail closed on capitalization: an unnormalized "None" would miss the # Fail closed: "none" in any casing and a null default both deny.
# sentinel and fall back to viewer, granting the access it was meant to # Normalizing null keeps the value through /config, which drops nulls
# deny. Other role names stay case-sensitive. if v is None or (isinstance(v, str) and v.strip().lower() == "none"):
if isinstance(v, str) and v.strip().lower() == "none":
return "none" return "none"
return v return v
@@ -35,6 +35,7 @@ from frigate.data_processing.types import PostProcessDataEnum
from frigate.genai import GenAIClient from frigate.genai import GenAIClient
from frigate.genai.manager import GenAIClientManager from frigate.genai.manager import GenAIClientManager
from frigate.models import Event, Recordings, ReviewSegment from frigate.models import Event, Recordings, ReviewSegment
from frigate.output.preview import is_camera_preview_frame
from frigate.util.builtin import EventsPerSecond, InferenceSpeed from frigate.util.builtin import EventsPerSecond, InferenceSpeed
from frigate.util.image import get_image_from_recording from frigate.util.image import get_image_from_recording
from frigate.util.recording_coverage import recording_overlap from frigate.util.recording_coverage import recording_overlap
@@ -68,6 +69,9 @@ class ReviewDescriptionProcessor(PostProcessorApi):
self.review_desc_dps = EventsPerSecond() self.review_desc_dps = EventsPerSecond()
self.review_desc_dps.start() self.review_desc_dps.start()
# one review's ffmpeg extraction at a time, as on the maintainer loop
self._frame_extraction_lock = threading.Lock()
def calculate_frame_count( def calculate_frame_count(
self, self,
camera: str, camera: str,
@@ -179,53 +183,72 @@ class ReviewDescriptionProcessor(PostProcessorApi):
): ):
return return
image_source = camera_config.review.genai.image_source threading.Thread(
frame_mode = camera_config.review.genai.frame_mode target=self._describe_finished_review,
name=f"review_description_{id}",
daemon=True,
args=(
camera_config,
final_data,
camera_config.review.genai.image_source,
),
).start()
def _describe_finished_review(
self,
camera_config: CameraConfig,
final_data: dict[str, Any],
image_source: ImageSourceEnum,
preview_fallback: bool = True,
named_objects: list[tuple[str, str]] | None = None,
) -> None:
"""Gather frames for a finished review item and start its description.
Runs off the maintainer loop since recording frames shell out to ffmpeg
once per frame.
"""
camera = final_data["camera"]
id = final_data["id"]
genai_config = camera_config.review.genai
frames: list[tuple[bytes, float]] = []
if image_source == ImageSourceEnum.recordings: if image_source == ImageSourceEnum.recordings:
buffer_extension = get_recording_buffer_extension( buffer_extension = get_recording_buffer_extension(
final_data["end_time"] - final_data["start_time"] final_data["end_time"] - final_data["start_time"]
) )
final_data["start_time"] -= buffer_extension with self._frame_extraction_lock:
final_data["end_time"] += buffer_extension
frames = self.get_recording_frames( frames = self.get_recording_frames(
camera, camera,
final_data["start_time"], final_data["start_time"] - buffer_extension,
final_data["end_time"], final_data["end_time"] + buffer_extension,
height=480, # Use 480p for good balance between quality and token usage height=480, # Use 480p for good balance between quality and token usage
frame_mode=frame_mode, frame_mode=genai_config.frame_mode,
)
if frames:
if genai_config.debug_save_thumbnails:
self.save_debug_recording_frames(id, frames)
elif not preview_fallback:
logger.error("No recording frames are available for review item %s", id)
return
else:
logger.warning(
"No recording frames found for %s, falling back to preview frames",
camera,
) )
if not frames: if not frames:
# Fallback to preview frames if no recordings available
logger.warning(
f"No recording frames found for {camera}, falling back to preview frames"
)
frames = self.get_preview_frames_as_bytes( frames = self.get_preview_frames_as_bytes(
camera, camera,
final_data["start_time"], final_data["start_time"],
final_data["end_time"], final_data["end_time"],
final_data["thumb_path"], final_data["thumb_path"],
id, id,
camera_config.review.genai.debug_save_thumbnails, genai_config.debug_save_thumbnails,
frame_mode, genai_config.frame_mode,
)
elif camera_config.review.genai.debug_save_thumbnails:
self.save_debug_recording_frames(id, frames)
else:
# Use preview frames
frames = self.get_preview_frames_as_bytes(
camera,
final_data["start_time"],
final_data["end_time"],
final_data["thumb_path"],
id,
camera_config.review.genai.debug_save_thumbnails,
frame_mode,
) )
self.start_analysis(camera_config, final_data, frames) self.start_analysis(camera_config, final_data, frames, named_objects)
def handle_request(self, topic: str, request_data: dict[str, Any]) -> str | None: def handle_request(self, topic: str, request_data: dict[str, Any]) -> str | None:
if topic == EmbeddingsRequestEnum.regenerate_review_description.value: if topic == EmbeddingsRequestEnum.regenerate_review_description.value:
@@ -419,31 +442,12 @@ class ReviewDescriptionProcessor(PostProcessorApi):
logger.error("Review item %s has not ended yet", review_id) logger.error("Review item %s has not ended yet", review_id)
return return
buffer_extension = get_recording_buffer_extension( self._describe_finished_review(
final_data["end_time"] - final_data["start_time"]
)
frames = self.get_recording_frames(
str(review.camera),
final_data["start_time"] - buffer_extension,
final_data["end_time"] + buffer_extension,
height=480,
frame_mode=camera_config.review.genai.frame_mode,
)
if not frames:
logger.error(
"No recording frames are available for review item %s", review_id
)
return
if camera_config.review.genai.debug_save_thumbnails:
self.save_debug_recording_frames(review_id, frames)
self.start_analysis(
camera_config, camera_config,
final_data, final_data,
frames, ImageSourceEnum.recordings,
get_named_objects( preview_fallback=False,
named_objects=get_named_objects(
final_data["data"].get("detections") or [], final_data["data"].get("detections") or [],
self.config.all_attributes, self.config.all_attributes,
), ),
@@ -525,7 +529,7 @@ class ReviewDescriptionProcessor(PostProcessorApi):
camera_files = [ camera_files = [
entry.name entry.name
for entry in os.scandir(preview_dir) for entry in os.scandir(preview_dir)
if entry.name.startswith(file_start) if is_camera_preview_frame(entry.name, camera)
] ]
camera_files.sort() camera_files.sort()
@@ -17,8 +17,9 @@ from frigate.config.classification import CustomClassificationConfig
from frigate.const import CLIPS_DIR, MODEL_CACHE_DIR from frigate.const import CLIPS_DIR, MODEL_CACHE_DIR
from frigate.log import suppress_stderr_during from frigate.log import suppress_stderr_during
from frigate.util.builtin import EventsPerSecond, InferenceSpeed, load_labels from frigate.util.builtin import EventsPerSecond, InferenceSpeed, load_labels
from frigate.util.classification import resize_classification_image
from frigate.util.file import trim_oldest_files from frigate.util.file import trim_oldest_files
from frigate.util.image import calculate_region from frigate.util.image import calculate_region, write_image
from frigate.util.object import box_overlaps from frigate.util.object import box_overlaps
from ..types import DataProcessorMetrics from ..types import DataProcessorMetrics
@@ -275,7 +276,7 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
cropped_frame = rgb[y1:y2, x1:x2] cropped_frame = rgb[y1:y2, x1:x2]
try: try:
resized_frame = cv2.resize(cropped_frame, (224, 224)) resized_frame = resize_classification_image(cropped_frame)
except Exception: except Exception:
logger.warning("Failed to resize image for state classification") logger.warning("Failed to resize image for state classification")
return return
@@ -583,7 +584,7 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
crop = rgb[y:y2, x:x2] crop = rgb[y:y2, x:x2]
try: try:
resized_crop = cv2.resize(crop, (224, 224)) resized_crop = resize_classification_image(crop)
except Exception: except Exception:
logger.warning("Failed to resize image for object classification") logger.warning("Failed to resize image for object classification")
return return
@@ -747,5 +748,5 @@ def write_classification_attempt(
file = os.path.join(folder, f"{event_id}-{timestamp}-{label}-{score}.webp") file = os.path.join(folder, f"{event_id}-{timestamp}-{label}-{score}.webp")
os.makedirs(folder, exist_ok=True) os.makedirs(folder, exist_ok=True)
cv2.imwrite(file, frame) write_image(file, frame)
trim_oldest_files(folder, max_files) trim_oldest_files(folder, max_files)
+2 -2
View File
@@ -28,7 +28,7 @@ from frigate.data_processing.common.face.recognizer import (
from frigate.types import TrackedObjectUpdateTypesEnum from frigate.types import TrackedObjectUpdateTypesEnum
from frigate.util.builtin import EventsPerSecond, InferenceSpeed from frigate.util.builtin import EventsPerSecond, InferenceSpeed
from frigate.util.file import trim_oldest_files from frigate.util.file import trim_oldest_files
from frigate.util.image import area from frigate.util.image import area, write_image
from frigate.util.path import safe_join, sanitize_path_component from frigate.util.path import safe_join, sanitize_path_component
from ..types import DataProcessorMetrics from ..types import DataProcessorMetrics
@@ -488,5 +488,5 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
folder, f"{event_id}-{timestamp}-{sub_label}-{score}.webp" folder, f"{event_id}-{timestamp}-{sub_label}-{score}.webp"
) )
os.makedirs(folder, exist_ok=True) os.makedirs(folder, exist_ok=True)
cv2.imwrite(file, frame) write_image(file, frame)
trim_oldest_files(folder, self.config.face_recognition.save_attempts) trim_oldest_files(folder, self.config.face_recognition.save_attempts)
+28 -11
View File
@@ -11,10 +11,11 @@ import os
import shutil import shutil
import threading import threading
import time import time
from collections.abc import Callable
from ruamel.yaml import YAML from ruamel.yaml import YAML
from frigate.config import FrigateConfig from frigate.config import CameraConfig, FrigateConfig
from frigate.config.camera.updater import ( from frigate.config.camera.updater import (
CameraConfigUpdateEnum, CameraConfigUpdateEnum,
CameraConfigUpdatePublisher, CameraConfigUpdatePublisher,
@@ -61,6 +62,7 @@ class DebugReplayManager:
self.start_ts: float | None = None self.start_ts: float | None = None
self.end_ts: float | None = None self.end_ts: float | None = None
self.session_started_at: float | None = None self.session_started_at: float | None = None
self._published_camera: CameraConfig | None = None
self._job_state_publisher = JobStatePublisher() self._job_state_publisher = JobStatePublisher()
@property @property
@@ -109,6 +111,13 @@ class DebugReplayManager:
self.start_ts = None self.start_ts = None
self.end_ts = None self.end_ts = None
self.session_started_at = None self.session_started_at = None
self._published_camera = None
def update_config(self, config: FrigateConfig) -> None:
"""Carry the published replay camera into a newly swapped-in config."""
with self._lock:
if self._published_camera is not None and self.replay_camera_name:
config.cameras[self.replay_camera_name] = self._published_camera
def publish_camera( def publish_camera(
self, self,
@@ -117,10 +126,11 @@ class DebugReplayManager:
clip_path: str, clip_path: str,
frigate_config: FrigateConfig, frigate_config: FrigateConfig,
config_publisher: CameraConfigUpdatePublisher, config_publisher: CameraConfigUpdatePublisher,
) -> None: ) -> bool:
"""Build the in-memory replay camera config and publish the add event. """Build the in-memory replay camera config and publish the add event.
Called by the job runner during the starting_camera phase. Called by the job runner during the starting_camera phase. Returns
False without publishing if the session was stopped meanwhile.
""" """
source_config = frigate_config.cameras[source_camera] source_config = frigate_config.cameras[source_camera]
camera_dict = self._build_camera_config_dict( camera_dict = self._build_camera_config_dict(
@@ -140,13 +150,22 @@ class DebugReplayManager:
new_config = FrigateConfig.parse_object(config_data) new_config = FrigateConfig.parse_object(config_data)
except Exception as e: except Exception as e:
raise RuntimeError(f"Failed to validate replay camera config: {e}") from e raise RuntimeError(f"Failed to validate replay camera config: {e}") from e
frigate_config.cameras[replay_name] = new_config.cameras[replay_name]
camera_config = new_config.cameras[replay_name]
with self._lock:
if self.replay_camera_name != replay_name:
return False
frigate_config.cameras[replay_name] = camera_config
self._published_camera = camera_config
config_publisher.publish_update( config_publisher.publish_update(
CameraConfigUpdateTopic(CameraConfigUpdateEnum.add, replay_name), CameraConfigUpdateTopic(CameraConfigUpdateEnum.add, replay_name),
new_config.cameras[replay_name], camera_config,
) )
return True
def stop( def stop(
self, self,
frigate_config: FrigateConfig, frigate_config: FrigateConfig,
@@ -167,12 +186,10 @@ class DebugReplayManager:
replay_name = self.replay_camera_name replay_name = self.replay_camera_name
source_camera = self.source_camera source_camera = self.source_camera
# Only publish remove if the camera was actually added to the live if replay_name is not None and self._published_camera is not None:
# config (i.e. the runner reached the starting_camera phase).
if replay_name is not None and replay_name in frigate_config.cameras:
config_publisher.publish_update( config_publisher.publish_update(
CameraConfigUpdateTopic(CameraConfigUpdateEnum.remove, replay_name), CameraConfigUpdateTopic(CameraConfigUpdateEnum.remove, replay_name),
frigate_config.cameras[replay_name], self._published_camera,
) )
frigate_config.cameras.pop(replay_name, None) frigate_config.cameras.pop(replay_name, None)
@@ -362,7 +379,7 @@ def cleanup_replay_cameras() -> None:
async def debug_replay_auto_stop_watchdog( async def debug_replay_auto_stop_watchdog(
manager: DebugReplayManager, manager: DebugReplayManager,
frigate_config: FrigateConfig, get_config: Callable[[], FrigateConfig],
config_publisher: CameraConfigUpdatePublisher, config_publisher: CameraConfigUpdatePublisher,
) -> None: ) -> None:
"""Auto-stop debug replay sessions that exceed MAX_SESSION_DURATION_SECONDS. """Auto-stop debug replay sessions that exceed MAX_SESSION_DURATION_SECONDS.
@@ -384,7 +401,7 @@ async def debug_replay_auto_stop_watchdog(
replay_name = manager.replay_camera_name replay_name = manager.replay_camera_name
await asyncio.to_thread( await asyncio.to_thread(
manager.stop, manager.stop,
frigate_config=frigate_config, frigate_config=get_config(),
config_publisher=config_publisher, config_publisher=config_publisher,
) )
logger.info( logger.info(
+2
View File
@@ -153,6 +153,8 @@ def get_ort_session_options(
sess_options = ort.SessionOptions() sess_options = ort.SessionOptions()
if cpu: if cpu:
# ORT reads the CPU arena flag from session options, not provider options.
sess_options.enable_cpu_mem_arena = False
# idle intra-op threads otherwise spin for ~1s after every run, keeping # idle intra-op threads otherwise spin for ~1s after every run, keeping
# most cores busy while an enrichment runs even once a second # most cores busy while an enrichment runs even once a second
sess_options.add_session_config_entry("session.intra_op.allow_spinning", "0") sess_options.add_session_config_entry("session.intra_op.allow_spinning", "0")
+23 -1
View File
@@ -10,7 +10,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.fields import PrivateAttr from pydantic.fields import PrivateAttr
from frigate.const import DEFAULT_ATTRIBUTE_LABEL_MAP, MODEL_CACHE_DIR from frigate.const import DEFAULT_ATTRIBUTE_LABEL_MAP, MODEL_CACHE_DIR
from frigate.plus import PlusApi, load_plus_model_info from frigate.plus import PlusApi, PlusRateLimitError, load_plus_model_info
from frigate.util.builtin import generate_color_palette, load_labels from frigate.util.builtin import generate_color_palette, load_labels
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -52,6 +52,16 @@ DEFAULT_SCENE = "default"
SCENE_PATTERN = r"^[A-Za-z0-9_-]+$" SCENE_PATTERN = r"^[A-Za-z0-9_-]+$"
def _rate_limited_message(model_id: str, err: PlusRateLimitError) -> str:
"""Explain a rate limited Frigate+ model download, with the wait if known."""
message = f"Frigate+ is rate limiting requests, unable to download model {model_id}"
if err.retry_after is not None:
return f"{message}. Try again in {err.retry_after} seconds"
return f"{message}. Try again later"
class ModelConfig(BaseModel): class ModelConfig(BaseModel):
scene: str = Field( scene: str = Field(
default=DEFAULT_SCENE, default=DEFAULT_SCENE,
@@ -193,6 +203,16 @@ class ModelConfig(BaseModel):
raise ValueError( raise ValueError(
f"Unable to connect to Frigate+ to download model {model_id}" f"Unable to connect to Frigate+ to download model {model_id}"
) from e ) from e
except PlusRateLimitError as e:
raise ValueError(_rate_limited_message(model_id, e)) from e
# an error body written here would be mistaken for the model on
# every later start, since only the file's existence is checked
if not r.ok:
raise ValueError(
f"Unable to download model {model_id} from Frigate+ "
f"(HTTP {r.status_code})"
)
with open(self.path, "wb") as f: with open(self.path, "wb") as f:
f.write(r.content) f.write(r.content)
@@ -205,6 +225,8 @@ class ModelConfig(BaseModel):
raise ValueError( raise ValueError(
f"Unable to connect to Frigate+ to download model info for {model_id}" f"Unable to connect to Frigate+ to download model info for {model_id}"
) from e ) from e
except PlusRateLimitError as e:
raise ValueError(_rate_limited_message(model_id, e)) from e
with open(model_info_path, "w") as f: with open(model_info_path, "w") as f:
json.dump(model_info, f) json.dump(model_info, f)
+59 -22
View File
@@ -16,14 +16,20 @@ from pydantic import ConfigDict, Field, field_validator
from frigate.detectors.detection_api import DetectionApi from frigate.detectors.detection_api import DetectionApi
from frigate.detectors.detector_config import BaseDetectorConfig, ModelTypeEnum from frigate.detectors.detector_config import BaseDetectorConfig, ModelTypeEnum
from frigate.util.model import post_process_yolo, post_process_yolox from frigate.util.model import post_process_yolo, post_process_yolox
from frigate.util.runtime_deps import Artifact, ArtifactKind, RuntimeManifest from frigate.util.runtime_deps import (
ArchiveDest,
ArchiveMapping,
Artifact,
ArtifactKind,
RuntimeManifest,
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
DETECTOR_KEY = "deepx" DETECTOR_KEY = "deepx"
# Installed at first start; DEEPX's PyPI wheels match the libdxrt-bin build. # Installed at first start; the wheel ships inside the libdxrt-bin package.
DXRT_VERSION = "3.4.0" DXRT_VERSION = "3.5.0"
# Where the host dxrtd accepts clients; a container cannot reach its abstract # Where the host dxrtd accepts clients; a container cannot reach its abstract
# socket, and a mounted socket file pins a stale inode after a daemon restart. # socket, and a mounted socket file pins a stale inode after a daemon restart.
@@ -70,10 +76,13 @@ PPU_ANCHORS_BY_SCALES = {
), ),
} }
# .dxnn: "DXNN", a 4-byte LE version, then a JSON index padded to # .dxnn v7/v8: "DXNN", a 4-byte LE version, then a JSON index padded to
# DXNN_HEADER_SIZE; every offset in the index counts from there. # DXNN_HEADER_SIZE, offsets relative to it. v9 prefixes the index length.
DXNN_MAGIC = b"DXNN" DXNN_MAGIC = b"DXNN"
DXNN_HEADER_SIZE = 8192 DXNN_HEADER_SIZE = 8192
DXNN_PRELUDE_SIZE = 32
DXNN_V9_VERSION = 9
DXNN_MAX_HEADER_SIZE = 16 * 1024 * 1024
# The graph DX-COM keeps for visualisation, an ONNX ModelProto beside the # The graph DX-COM keeps for visualisation, an ONNX ModelProto beside the
# encrypted model; only its nodes are read, for how the box tensor was built. # encrypted model; only its nodes are read, for how the box tensor was built.
DXNN_GRAPH_SECTION = "vis_npu_models" DXNN_GRAPH_SECTION = "vis_npu_models"
@@ -103,32 +112,45 @@ MULTIPART_CLASSES = 80
MULTIPART_CHANNELS = 3 * (5 + MULTIPART_CLASSES) MULTIPART_CHANNELS = 3 * (5 + MULTIPART_CLASSES)
# PyPI URLs carry a per-file digest, so a version bump rewrites them whole. # The wheel links against the runtime libraries the package ships.
DEEPX_LIBS = ArchiveMapping(
"./usr/local/lib/",
ArchiveDest.lib,
include=("libdxrt.so*", "libonnxruntime.so*"),
)
# The deb carries a wheel per CPython ABI; `member` picks this image's and
# `member_sha256` pins it. Only the wheel and DEEPX_LIBS are kept out of it.
DEEPX_MANIFEST = RuntimeManifest( DEEPX_MANIFEST = RuntimeManifest(
name=DETECTOR_KEY, name=DETECTOR_KEY,
version=DXRT_VERSION, version=DXRT_VERSION,
artifacts=( artifacts=(
Artifact( Artifact(
url=( url=(
"https://files.pythonhosted.org/packages/de/45/" "https://github.com/DEEPX-AI/dx_rt/raw/refs/tags/v3.5.0/"
"1ca593e1c4ed868618658e07adeffc1fb44b92655d1ba48a6c76942616ee/" "release/3.5.0/libdxrt-bin_3.5.0_arm64.deb"
"dx_engine-3.4.0-cp311-cp311-manylinux_2_27_aarch64.whl"
), ),
sha256="ec4188e0a598a164bc04312482f70159be1a3d888284dcf52746054138101ec7", sha256="f7c942ddfa325f435de3ab9a42b32b322f97dacff7f3468a37e32a6386a03681",
kind=ArtifactKind.wheel, kind=ArtifactKind.deb,
machines=("aarch64",), machines=("aarch64",),
mappings=(DEEPX_LIBS,),
member="dx_engine-3.5.0-cp311-cp311-*.whl",
member_sha256="276e1860af91ab3f937047fe8c4f59c169b4a5ed191f1c1cb606f89045c6967a",
), ),
Artifact( Artifact(
url=( url=(
"https://files.pythonhosted.org/packages/b0/32/" "https://github.com/DEEPX-AI/dx_rt/raw/refs/tags/v3.5.0/"
"d52b33d5b85f7d8565e3e2d153f19db6d506cd5504339f31c6553eae06c6/" "release/3.5.0/libdxrt-bin_3.5.0_amd64.deb"
"dx_engine-3.4.0-cp311-cp311-manylinux_2_27_x86_64.whl"
), ),
sha256="161fde8428fc8aea95c560d878bc68e8d1c657c18a0eb04840de4bd212f3477f", sha256="c1993416e43059fb4751b2fd093d4232ab2ae8e67a5ec4156c79889e66260f64",
kind=ArtifactKind.wheel, kind=ArtifactKind.deb,
machines=("x86_64",), machines=("x86_64",),
mappings=(DEEPX_LIBS,),
member="dx_engine-3.5.0-cp311-cp311-*.whl",
member_sha256="ec5b80970271ac6d236fa4bc3277e425d6d8bcb89a977f7c236ac0431dd60558",
), ),
), ),
preload=("libonnxruntime.so.1", "libdxrt.so"),
import_check="dx_engine", import_check="dx_engine",
) )
@@ -408,17 +430,32 @@ def read_ppu_layout(path: str) -> PpuLayout | None:
is none to read.""" is none to read."""
try: try:
with open(path, "rb") as model: with open(path, "rb") as model:
header = model.read(DXNN_HEADER_SIZE) prelude = model.read(DXNN_PRELUDE_SIZE)
if header[:4] != DXNN_MAGIC: if prelude[:4] != DXNN_MAGIC:
return None return None
index = json.JSONDecoder().raw_decode( version = struct.unpack_from("<I", prelude, 4)[0]
header[8:].decode("utf-8", "replace")
)[0] if version >= DXNN_V9_VERSION:
header_length = struct.unpack_from("<Q", prelude, 8)[0]
if header_length > DXNN_MAX_HEADER_SIZE:
return None
raw_index = model.read(header_length)
data_offset = DXNN_PRELUDE_SIZE + header_length
else:
model.seek(8)
raw_index = model.read(DXNN_HEADER_SIZE - 8)
data_offset = DXNN_HEADER_SIZE
decoder = json.JSONDecoder()
index = decoder.raw_decode(raw_index.decode("utf-8", "replace"))[0]
data = index["data"] data = index["data"]
def section(entry: dict) -> bytes: def section(entry: dict) -> bytes:
model.seek(DXNN_HEADER_SIZE + int(entry["offset"])) model.seek(data_offset + int(entry["offset"]))
return model.read(int(entry["size"])) return model.read(int(entry["size"]))
anchor_based = None anchor_based = None
+4
View File
@@ -68,6 +68,10 @@ class GenAIEmbedding:
f"Invalid embedding_type '{embedding_type}'. Must be 'text' or 'vision'." f"Invalid embedding_type '{embedding_type}'. Must be 'text' or 'vision'."
) )
# Callers index the result, so an empty provider response must raise
if not embeddings:
raise ValueError(f"Empty {embedding_type} embedding response from provider")
result = [] result = []
for emb in embeddings: for emb in embeddings:
arr = np.asarray(emb, dtype=np.float32) arr = np.asarray(emb, dtype=np.float32)
+26 -50
View File
@@ -2,14 +2,11 @@
import datetime import datetime
import logging import logging
import os
import threading import threading
from multiprocessing.synchronize import Event as MpEvent from multiprocessing.synchronize import Event as MpEvent
from pathlib import Path
from typing import Any from typing import Any
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.const import CLIPS_DIR
from frigate.db.sqlitevecq import SqliteVecQueueDatabase from frigate.db.sqlitevecq import SqliteVecQueueDatabase
from frigate.models import Event, Timeline from frigate.models import Event, Timeline
from frigate.util.file import delete_event_snapshot, delete_event_thumbnail from frigate.util.file import delete_event_snapshot, delete_event_thumbnail
@@ -92,7 +89,6 @@ class EventCleanup(threading.Thread):
Event.camera.not_in(self.camera_keys), Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely == False,
Event.has_snapshot == True, Event.has_snapshot == True,
) )
.namedtuples() .namedtuples()
@@ -114,7 +110,6 @@ class EventCleanup(threading.Thread):
Event.camera.not_in(self.camera_keys), Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely == False,
Event.has_snapshot == True, Event.has_snapshot == True,
) )
@@ -143,7 +138,7 @@ class EventCleanup(threading.Thread):
events_to_update = [] events_to_update = []
## Expire events from cameras based on the camera config ## Expire events from cameras based on the camera config
for name, camera in self.config.cameras.items(): for name, camera in list(self.config.cameras.items()):
retain_config = camera.snapshots.retain retain_config = camera.snapshots.retain
# get distinct objects in database for this camera # get distinct objects in database for this camera
@@ -170,7 +165,6 @@ class EventCleanup(threading.Thread):
Event.camera == name, Event.camera == name,
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely == False,
Event.has_snapshot == True, Event.has_snapshot == True,
) )
.namedtuples() .namedtuples()
@@ -205,54 +199,17 @@ class EventCleanup(threading.Thread):
self.config.record.effective_alert_days, self.config.record.effective_alert_days,
self.config.record.effective_detection_days, self.config.record.effective_detection_days,
) )
file_extension = None # mp4 clips are no longer stored in /clips
update_params = {"has_clip": False} update_params = {"has_clip": False}
# get expiration time for this label
expire_after = ( expire_after = (
datetime.datetime.now() - datetime.timedelta(days=expire_days) datetime.datetime.now() - datetime.timedelta(days=expire_days)
).timestamp() ).timestamp()
# grab all events after specific time
expired_events: list[Event] = list(
Event.select(
Event.id,
Event.camera,
)
.where(
Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after,
Event.retain_indefinitely == False,
)
.namedtuples()
.iterator()
)
logger.debug(f"{len(expired_events)} events can be expired")
# delete the media from disk
for expired in expired_events:
media_name = f"{expired.camera}-{expired.id}"
media_path = Path(f"{os.path.join(CLIPS_DIR, media_name)}.{file_extension}")
try:
media_path.unlink(missing_ok=True)
if file_extension == "jpg":
media_path = Path( # type: ignore[unreachable]
f"{os.path.join(CLIPS_DIR, media_name)}-clean.webp"
)
media_path.unlink(missing_ok=True)
# Also delete clean.png (legacy) for backward compatibility
media_path = Path(
f"{os.path.join(CLIPS_DIR, media_name)}-clean.png"
)
media_path.unlink(missing_ok=True)
except OSError as e:
logger.warning(f"Unable to delete event images: {e}")
# update the clips attribute for the db entry # update the clips attribute for the db entry
query = Event.select(Event.id).where( query = Event.select(Event.id).where(
Event.camera.not_in(self.camera_keys), Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after, Event.start_time < expire_after,
Event.retain_indefinitely == False, Event.has_clip == True,
) )
events_to_update = [] events_to_update = []
@@ -280,7 +237,7 @@ class EventCleanup(threading.Thread):
now = datetime.datetime.now() now = datetime.datetime.now()
## Expire events from cameras based on the camera config ## Expire events from cameras based on the camera config
for name, camera in self.config.cameras.items(): for name, camera in list(self.config.cameras.items()):
# effective days cover the sub window, keeping tracked objects # effective days cover the sub window, keeping tracked objects
# in Explore while sub recordings and review items still exist # in Explore while sub recordings and review items still exist
alert_expire_date = ( alert_expire_date = (
@@ -297,7 +254,7 @@ class EventCleanup(threading.Thread):
) )
.where( .where(
Event.camera == name, Event.camera == name,
Event.retain_indefinitely == False, Event.has_clip == True,
( (
( (
(Event.data["max_severity"] != "detection") (Event.data["max_severity"] != "detection")
@@ -335,6 +292,24 @@ class EventCleanup(threading.Thread):
# only expire events every 5 minutes # only expire events every 5 minutes
while not self.stop_event.wait(300): while not self.stop_event.wait(300):
try:
self.expire_events()
except Exception:
logger.exception("Event cleanup failed, retrying next cycle")
logger.info("Exiting event cleanup...")
def refresh_camera_keys(self) -> None:
"""Track cameras added or removed at runtime."""
camera_keys = list(self.config.cameras)
if set(camera_keys) != set(self.camera_keys):
self.camera_keys = camera_keys
self.removed_camera_labels = None
def expire_events(self) -> None:
"""Run one cleanup cycle: expire clips and snapshots, then drop dead events."""
self.refresh_camera_keys()
events_with_expired_clips = self.expire_clips() events_with_expired_clips = self.expire_clips()
# delete timeline entries for events that have expired recordings # delete timeline entries for events that have expired recordings
@@ -357,7 +332,10 @@ class EventCleanup(threading.Thread):
events_to_delete: list[Event] = [e for e in events] events_to_delete: list[Event] = [e for e in events]
for e in events_to_delete: for e in events_to_delete:
delete_event_thumbnail(e) if not delete_event_thumbnail(e):
logger.warning(
f"Unable to delete event thumbnail for {e.camera}: {e.id}"
)
logger.debug(f"Found {len(events_to_delete)} events that can be expired") logger.debug(f"Found {len(events_to_delete)} events that can be expired")
if len(events_to_delete) > 0: if len(events_to_delete) > 0:
@@ -373,5 +351,3 @@ class EventCleanup(threading.Thread):
self.db.delete_embeddings_description(event_ids=chunk) self.db.delete_embeddings_description(event_ids=chunk)
self.db.delete_embeddings_thumbnail(event_ids=chunk) self.db.delete_embeddings_thumbnail(event_ids=chunk)
logger.debug(f"Deleted {len(chunk)} embeddings") logger.debug(f"Deleted {len(chunk)} embeddings")
logger.info("Exiting event cleanup...")
+1
View File
@@ -42,6 +42,7 @@ def should_update_db(prev_event: dict[str, Any], current_event: dict[str, Any])
or prev_event["recognized_license_plate"] or prev_event["recognized_license_plate"]
!= current_event["recognized_license_plate"] != current_event["recognized_license_plate"]
or prev_event["path_data"] != current_event["path_data"] or prev_event["path_data"] != current_event["path_data"]
or prev_event["max_severity"] != current_event["max_severity"]
): ):
return True return True
return False return False
+148 -2
View File
@@ -9,6 +9,7 @@ import time
from collections.abc import AsyncGenerator from collections.abc import AsyncGenerator
from typing import Any from typing import Any
import numpy as np
from google import genai from google import genai
from google.genai import errors, types from google.genai import errors, types
from google.genai.types import FunctionCallingConfigMode from google.genai.types import FunctionCallingConfigMode
@@ -16,7 +17,7 @@ from PIL import Image
from frigate.config import GenAIProviderEnum from frigate.config import GenAIProviderEnum
from frigate.genai import GenAIClient, register_genai_provider from frigate.genai import GenAIClient, register_genai_provider
from frigate.genai.utils import interleave_images from frigate.genai.utils import interleave_images, to_jpeg
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -29,6 +30,9 @@ GEMINI_MAX_INLINE_BYTES = 15 * 1024 * 1024
COUNT_TOKENS_TIMEOUT_MS = 5000 COUNT_TOKENS_TIMEOUT_MS = 5000
COUNT_TOKENS_RETRY_INTERVAL = 300 COUNT_TOKENS_RETRY_INTERVAL = 300
# sqlite-vec stores thumbnail and description embeddings as FLOAT[768].
GEMINI_EMBEDDING_DIM = 768
def _decode_thought_signature(value: Any) -> bytes | None: def _decode_thought_signature(value: Any) -> bytes | None:
"""Decode a base64-encoded thought_signature carried across conversation turns.""" """Decode a base64-encoded thought_signature carried across conversation turns."""
@@ -63,6 +67,17 @@ def _decode_data_uri(url: str) -> tuple[str, bytes] | None:
return None return None
def _tool_names_by_id(messages: list[dict[str, Any]]) -> dict[str, str]:
"""Map each assistant tool call id to its function name."""
return {
tc["id"]: (tc.get("function") or {}).get("name") or ""
for msg in messages
if msg.get("role") == "assistant"
for tc in msg.get("tool_calls") or []
if tc.get("id")
}
def _parts_from_content(content: Any) -> list[types.Part]: def _parts_from_content(content: Any) -> list[types.Part]:
"""Convert OpenAI-style message content (str or multimodal list) to Gemini parts.""" """Convert OpenAI-style message content (str or multimodal list) to Gemini parts."""
if isinstance(content, list): if isinstance(content, list):
@@ -103,11 +118,13 @@ class GeminiClient(GenAIClient):
provider: genai.Client provider: genai.Client
_image_token_cache: dict[tuple[int, int], int] _image_token_cache: dict[tuple[int, int], int]
_image_token_retry_at: float _image_token_retry_at: float
_capabilities_cache: dict[str, dict[str, bool]] | None = None
def _init_provider(self) -> genai.Client: def _init_provider(self) -> genai.Client:
"""Initialize the client.""" """Initialize the client."""
self._image_token_cache = {} self._image_token_cache = {}
self._image_token_retry_at = 0.0 self._image_token_retry_at = 0.0
self._capabilities_cache = None
# Merge provider_options into HttpOptions # Merge provider_options into HttpOptions
http_options_dict: dict[str, Any] = { http_options_dict: dict[str, Any] = {
@@ -232,13 +249,41 @@ class GeminiClient(GenAIClient):
return transcript or None return transcript or None
@staticmethod
def _capabilities_from_models(models: Any) -> dict[str, dict[str, bool]]:
"""Build a per-model capability map from Gemini's models.list() entries."""
capabilities: dict[str, dict[str, bool]] = {}
for m in models:
name = getattr(m, "name", None) or ""
if not name:
continue
actions = getattr(m, "supported_actions", None) or []
flags = {"supports_embeddings": "embedContent" in actions}
capabilities[name] = flags
capabilities[name.removeprefix("models/")] = flags
return capabilities
def list_models(self) -> list[str]: def list_models(self) -> list[str]:
"""Return available model names from Gemini.""" """Return available model names from Gemini."""
try: try:
return sorted(m.name or "" for m in self.provider.models.list()) models = list(self.provider.models.list())
except Exception as e: except Exception as e:
logger.warning("Failed to list Gemini models: %s", e) logger.warning("Failed to list Gemini models: %s", e)
return [] return []
self._capabilities_cache = self._capabilities_from_models(models)
return sorted(m.name or "" for m in models)
def list_model_capabilities(self) -> dict[str, dict[str, bool]]:
"""Report per-model capabilities from Gemini's model list."""
if self._capabilities_cache is not None:
return self._capabilities_cache
try:
models = list(self.provider.models.list())
except Exception as e:
logger.debug("Failed to query Gemini model capabilities: %s", e)
return {}
self._capabilities_cache = self._capabilities_from_models(models)
return self._capabilities_cache
def get_context_size(self) -> int: def get_context_size(self) -> int:
"""Get the context window size for Gemini.""" """Get the context window size for Gemini."""
@@ -310,6 +355,103 @@ class GeminiClient(GenAIClient):
return total return total
@property
def supports_embeddings(self) -> bool:
"""Whether Gemini reports embedContent support for the configured model."""
capabilities = self.list_model_capabilities().get(self._embedding_model_name())
return bool(capabilities and capabilities.get("supports_embeddings"))
def _embedding_model_name(self) -> str:
"""Model id for embed_content, without a ``models/`` prefix."""
return self.genai_config.model.removeprefix("models/")
def _vector_from_embed(self, result: Any) -> np.ndarray:
"""Read the single embedding vector from an embed_content response."""
embeddings = getattr(result, "embeddings", None) or []
values = embeddings[0].values if embeddings else None
if not values:
raise ValueError("Gemini embeddings response had no vector")
return np.asarray(values, dtype=np.float32)
def _embed_one(self, model: str, contents: Any) -> np.ndarray:
"""One embed_content call. API failures become ValueError.
``_embed_thumbnail`` only catches ValueError. Returning an empty
list makes the caller index ``[0]`` and can stop the embeddings
process.
"""
try:
result = self.provider.models.embed_content(
model=model,
contents=contents,
config=types.EmbedContentConfig(
output_dimensionality=GEMINI_EMBEDDING_DIM
),
)
except Exception as e:
logger.warning("Gemini embeddings request failed: %s", e)
raise ValueError("Gemini embeddings request failed") from e
return self._vector_from_embed(result)
def embed(
self,
texts: list[str] | None = None,
images: list[bytes] | None = None,
) -> list[np.ndarray]:
"""Embed each text or image on its own.
gemini-embedding-2 returns one vector per request. Several parts
in one contents list are aggregated into that single vector, so
each description, search query, and thumbnail is its own call.
Stored descriptions and search queries share this text path, so
both get the search-query prefix and stay in one format. A text
that already starts with ``task:`` is sent unchanged. Images are
not prefixed. The API accepts PNG and JPEG only, and Frigate
stores thumbnails as WebP, so each image is transcoded first.
Requested length is 768, matching the semantic search tables.
Args:
texts: Strings to embed.
images: Encoded images, typically WebP thumbnails.
Returns:
One float32 vector per input, length 768.
Raises:
ValueError: An image cannot be converted, the response has
no vector, or the request fails.
"""
texts = texts or []
images = images or []
if not texts and not images:
return []
model = self._embedding_model_name()
vectors: list[np.ndarray] = []
for text in texts:
content = (
text
if text.startswith("task:")
else f"task: search result | query: {text}"
)
vectors.append(self._embed_one(model, content))
for image in images:
jpeg = to_jpeg(image)
if jpeg is None:
raise ValueError("thumbnail could not be converted to JPEG")
vectors.append(
self._embed_one(
model,
[types.Part.from_bytes(data=jpeg, mime_type="image/jpeg")],
)
)
return vectors
def chat_with_tools( def chat_with_tools(
self, self,
messages: list[dict[str, Any]], messages: list[dict[str, Any]],
@@ -327,6 +469,7 @@ class GeminiClient(GenAIClient):
try: try:
# Convert messages to Gemini format # Convert messages to Gemini format
gemini_messages: list[types.Content] = [] gemini_messages: list[types.Content] = []
tool_names = _tool_names_by_id(messages)
for msg in messages: for msg in messages:
role = msg.get("role", "user") role = msg.get("role", "user")
content = msg.get("content", "") content = msg.get("content", "")
@@ -389,6 +532,7 @@ class GeminiClient(GenAIClient):
parts=[ parts=[
types.Part.from_function_response( types.Part.from_function_response(
name=msg.get("name") name=msg.get("name")
or tool_names.get(msg.get("tool_call_id") or "")
or msg.get("tool_call_id") or msg.get("tool_call_id")
or "", or "",
response=response_payload, response=response_payload,
@@ -583,6 +727,7 @@ class GeminiClient(GenAIClient):
try: try:
# Convert messages to Gemini format # Convert messages to Gemini format
gemini_messages: list[types.Content] = [] gemini_messages: list[types.Content] = []
tool_names = _tool_names_by_id(messages)
for msg in messages: for msg in messages:
role = msg.get("role", "user") role = msg.get("role", "user")
content = msg.get("content", "") content = msg.get("content", "")
@@ -645,6 +790,7 @@ class GeminiClient(GenAIClient):
parts=[ parts=[
types.Part.from_function_response( types.Part.from_function_response(
name=msg.get("name") name=msg.get("name")
or tool_names.get(msg.get("tool_call_id") or "")
or msg.get("tool_call_id") or msg.get("tool_call_id")
or "", or "",
response=response_payload, response=response_payload,
+9 -12
View File
@@ -110,6 +110,13 @@ class LlamaCppClient(GenAIClient):
"""POST with the configured auth headers injected.""" """POST with the configured auth headers injected."""
return requests.post(url, headers=self._auth_headers(), **kwargs) return requests.post(url, headers=self._auth_headers(), **kwargs)
def _server_url(self) -> str | None:
"""Return the configured base_url without a trailing slash or /v1."""
if not self.genai_config.base_url:
return None
return self.genai_config.base_url.rstrip("/").removesuffix("/v1")
def _fetch_llama_props(self, base_url: str, model: str) -> dict[str, Any]: def _fetch_llama_props(self, base_url: str, model: str) -> dict[str, Any]:
"""Fetch /props from a llama.cpp server, with llama-swap fallback. """Fetch /props from a llama.cpp server, with llama-swap fallback.
@@ -143,16 +150,10 @@ class LlamaCppClient(GenAIClient):
self._supports_tools = False self._supports_tools = False
self._supports_reasoning = False self._supports_reasoning = False
base_url = ( base_url = self._server_url()
self.genai_config.base_url.rstrip("/")
if self.genai_config.base_url
else None
)
if base_url is None: if base_url is None:
return None return None
else:
base_url = base_url.replace("/v1", "") # Strip /v1 if included in base_url
if not self.validate_model: if not self.validate_model:
# Probe path # Probe path
@@ -506,11 +507,7 @@ class LlamaCppClient(GenAIClient):
def _fetch_models_data(self) -> list[dict[str, Any]]: def _fetch_models_data(self) -> list[dict[str, Any]]:
"""Return the raw /v1/models entries, or an empty list if unreachable.""" """Return the raw /v1/models entries, or an empty list if unreachable."""
base_url = self.provider or ( base_url = self.provider or self._server_url()
self.genai_config.base_url.rstrip("/")
if self.genai_config.base_url
else None
)
if base_url is None: if base_url is None:
return [] return []
+5 -16
View File
@@ -8,7 +8,7 @@ from collections.abc import AsyncGenerator
from typing import Any from typing import Any
import numpy as np import numpy as np
from httpx import RemoteProtocolError, TimeoutException from httpx import HTTPError
from ollama import AsyncClient as OllamaAsyncClient from ollama import AsyncClient as OllamaAsyncClient
from ollama import Client as ApiClient from ollama import Client as ApiClient
from ollama import ResponseError from ollama import ResponseError
@@ -282,12 +282,7 @@ class OllamaClient(GenAIClient):
try: try:
response = self.provider.chat(**request_params) response = self.provider.chat(**request_params)
except ( except (HTTPError, ResponseError, ConnectionError) as e:
TimeoutException,
ResponseError,
RemoteProtocolError,
ConnectionError,
) as e:
logger.warning("Ollama returned an error: %s", str(e)) logger.warning("Ollama returned an error: %s", str(e))
return None return None
@@ -406,13 +401,7 @@ class OllamaClient(GenAIClient):
# image items have to bypass it and post the JSON directly. # image items have to bypass it and post the JSON directly.
response = self.provider._request_raw("POST", "/api/embed", json=payload) response = self.provider._request_raw("POST", "/api/embed", json=payload)
body = response.json() body = response.json()
except ( except (HTTPError, ResponseError, ConnectionError, ValueError) as e:
TimeoutException,
ResponseError,
RemoteProtocolError,
ConnectionError,
ValueError,
) as e:
logger.warning("Ollama embeddings error: %s", str(e)) logger.warning("Ollama embeddings error: %s", str(e))
return [] return []
@@ -553,7 +542,7 @@ class OllamaClient(GenAIClient):
) )
response = self.provider.chat(**request_params) response = self.provider.chat(**request_params)
return self._message_from_response(response) return self._message_from_response(response)
except (TimeoutException, ResponseError, ConnectionError) as e: except (HTTPError, ResponseError, ConnectionError) as e:
logger.warning("Ollama returned an error: %s", str(e)) logger.warning("Ollama returned an error: %s", str(e))
return { return {
"content": None, "content": None,
@@ -685,7 +674,7 @@ class OllamaClient(GenAIClient):
"finish_reason": "stop", "finish_reason": "stop",
}, },
) )
except (TimeoutException, ResponseError, ConnectionError) as e: except (HTTPError, ResponseError, ConnectionError) as e:
logger.warning("Ollama streaming error: %s", str(e)) logger.warning("Ollama streaming error: %s", str(e))
yield ( yield (
"message", "message",
+25 -2
View File
@@ -39,6 +39,28 @@ def _stats_from_openai_usage(usage: Any) -> dict[str, Any] | None:
return stats or None return stats or None
def _context_size_from_model(model: Any) -> int | None:
"""Read the context window from an OpenAI-compatible /models entry.
vLLM reports ``max_model_len``. OpenRouter reports ``context_length`` as the
largest window any of its providers offers, and ``top_provider.context_length``
for the provider it routes to first. The latter can be smaller, so it is
preferred to avoid sending more than the serving provider accepts.
"""
top_provider = getattr(model, "top_provider", None)
candidates = (
getattr(model, "max_model_len", None),
top_provider.get("context_length") if isinstance(top_provider, dict) else None,
getattr(model, "context_length", None),
)
for value in candidates:
if isinstance(value, int) and value > 0:
return value
return None
@register_genai_provider(GenAIProviderEnum.openai) @register_genai_provider(GenAIProviderEnum.openai)
class OpenAIClient(GenAIClient): class OpenAIClient(GenAIClient):
"""Generative AI client for Frigate using OpenAI.""" """Generative AI client for Frigate using OpenAI."""
@@ -225,8 +247,9 @@ class OpenAIClient(GenAIClient):
models = self.provider.models.list() models = self.provider.models.list()
for model in models.data: for model in models.data:
if model.id == self.genai_config.model: if model.id == self.genai_config.model:
if hasattr(model, "max_model_len") and model.max_model_len: context_size = _context_size_from_model(model)
self.context_size = model.max_model_len if context_size:
self.context_size = context_size
logger.debug( logger.debug(
f"Retrieved context size {self.context_size} for model {self.genai_config.model}" f"Retrieved context size {self.context_size} for model {self.genai_config.model}"
) )
+26 -7
View File
@@ -187,16 +187,35 @@ def build_review_description_response_format(concerns: list[str]) -> dict[str, A
Strips the `time` field (populated server-side) and drops Strips the `time` field (populated server-side) and drops
`other_concerns` when no concerns are configured. `other_concerns` when no concerns are configured.
Every remaining property must be listed in `required` because strict
providers (OpenAI) reject a schema with any optional property.
""" """
schema = ReviewMetadata.model_json_schema() schema = ReviewMetadata.model_json_schema()
schema.get("properties", {}).pop("time", None) properties = schema.setdefault("properties", {})
required = schema.setdefault("required", [])
properties.pop("time", None)
if "time" in schema.get("required", []): if "time" in required:
schema["required"].remove("time") required.remove("time")
if not concerns:
schema.get("properties", {}).pop("other_concerns", None) if concerns:
if "other_concerns" in schema.get("required", []): # The model field is nullable with a default so stored metadata
schema["required"].remove("other_concerns") # without concerns still parses. For generation, require a plain list
# instead; the model returns an empty list when no concern applies.
properties["other_concerns"] = {
"type": "array",
"items": {"type": "string"},
"description": properties["other_concerns"]["description"],
}
if "other_concerns" not in required:
required.append("other_concerns")
else:
properties.pop("other_concerns", None)
if "other_concerns" in required:
required.remove("other_concerns")
return { return {
"type": "json_schema", "type": "json_schema",
+31 -28
View File
@@ -16,18 +16,21 @@ from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Optional, cast from typing import TYPE_CHECKING, Any, Optional, cast
from peewee import ModelSelect
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.config.camera.updater import CameraConfigUpdatePublisher from frigate.config.camera.updater import CameraConfigUpdatePublisher
from frigate.const import REPLAY_CAMERA_PREFIX, REPLAY_DIR from frigate.const import (
REPLAY_CAMERA_PREFIX,
REPLAY_DIR,
STREAM_TYPE_MAIN,
STREAM_TYPE_SUB,
)
from frigate.jobs.export import JobStatePublisher from frigate.jobs.export import JobStatePublisher
from frigate.jobs.job import Job from frigate.jobs.job import Job
from frigate.jobs.manager import job_is_running, set_current_job from frigate.jobs.manager import job_is_running, set_current_job
from frigate.models import Export, Recordings from frigate.models import Export
from frigate.types import JobStatusTypesEnum from frigate.types import JobStatusTypesEnum
from frigate.util.ffmpeg import run_ffmpeg_with_progress from frigate.util.ffmpeg import run_ffmpeg_with_progress
from frigate.util.recording_coverage import recording_overlap from frigate.util.recording_coverage import resolve_coverage
if TYPE_CHECKING: if TYPE_CHECKING:
from frigate.debug_replay import DebugReplayManager from frigate.debug_replay import DebugReplayManager
@@ -94,24 +97,6 @@ class DebugReplayJob(Job):
} }
def query_recordings(source_camera: str, start_ts: float, end_ts: float) -> ModelSelect:
"""Return the Recordings query for the time range.
Module-level so tests can patch it without instantiating a runner.
"""
query = (
Recordings.select(
Recordings.path,
Recordings.start_time,
Recordings.end_time,
)
.where(recording_overlap(start_ts, end_ts))
.where(Recordings.camera == source_camera)
.order_by(Recordings.start_time.asc())
)
return cast(ModelSelect, query)
class NoRecordingsError(ValueError): class NoRecordingsError(ValueError):
"""Raised when no recordings exist in the requested time range.""" """Raised when no recordings exist in the requested time range."""
@@ -156,7 +141,8 @@ class RecordingDebugReplaySource(DebugReplaySource):
Feeds ffmpeg the internal VOD endpoint so segments with mismatched Feeds ffmpeg the internal VOD endpoint so segments with mismatched
SPS/PPS (e.g. across day/night transitions) stitch cleanly via HLS SPS/PPS (e.g. across day/night transitions) stitch cleanly via HLS
discontinuities. discontinuities. The playlist is pinned to one stream because the
stream-copied clip cannot change codec or resolution mid-file.
""" """
def __init__( def __init__(
@@ -170,6 +156,7 @@ class RecordingDebugReplaySource(DebugReplaySource):
self._start_ts = start_ts self._start_ts = start_ts
self._end_ts = end_ts self._end_ts = end_ts
self._internal_port = internal_port self._internal_port = internal_port
self._stream_type = STREAM_TYPE_MAIN
@property @property
def source_camera(self) -> str: def source_camera(self) -> str:
@@ -187,7 +174,19 @@ class RecordingDebugReplaySource(DebugReplaySource):
if self._end_ts <= self._start_ts: if self._end_ts <= self._start_ts:
raise ValueError("End time must be after start time") raise ValueError("End time must be after start time")
if not query_recordings(self._camera, self._start_ts, self._end_ts).count(): # the VOD resolver decides what the pinned playlist serves, so it
# also decides the stream; a row merely touching the range has no
# interval and must not win
intervals = resolve_coverage(self._camera, self._start_ts, self._end_ts)
if any(interval.main for interval in intervals):
self._stream_type = STREAM_TYPE_MAIN
return
if any(interval.sub for interval in intervals):
self._stream_type = STREAM_TYPE_SUB
return
raise NoRecordingsError( raise NoRecordingsError(
f"No recordings found for camera '{self._camera}' in the specified time range" f"No recordings found for camera '{self._camera}' in the specified time range"
) )
@@ -195,7 +194,8 @@ class RecordingDebugReplaySource(DebugReplaySource):
def ffmpeg_input_args(self, working_dir: str) -> list[str]: def ffmpeg_input_args(self, working_dir: str) -> list[str]:
playlist_url = ( playlist_url = (
f"http://127.0.0.1:{self._internal_port}/vod/{self._camera}" f"http://127.0.0.1:{self._internal_port}/vod/{self._camera}"
f"/start/{self._start_ts}/end/{self._end_ts}/index.m3u8" f"/{self._stream_type}/start/{self._start_ts}/end/{self._end_ts}"
"/index.m3u8"
) )
return [ return [
"-protocol_whitelist", "-protocol_whitelist",
@@ -376,13 +376,16 @@ class DebugReplayJobRunner(threading.Thread):
self._finalize_cancelled(clip_path) self._finalize_cancelled(clip_path)
return return
self.replay_manager.publish_camera( if not self.replay_manager.publish_camera(
source_camera=self.job.source_camera, source_camera=self.job.source_camera,
replay_name=replay_name, replay_name=replay_name,
clip_path=clip_path, clip_path=clip_path,
frigate_config=self.frigate_config, frigate_config=self.frigate_config,
config_publisher=self.config_publisher, config_publisher=self.config_publisher,
) ):
self._finalize_cancelled(clip_path)
return
self.replay_manager.mark_session_ready(clip_path) self.replay_manager.mark_session_ready(clip_path)
self.job.status = JobStatusTypesEnum.success self.job.status = JobStatusTypesEnum.success
+3
View File
@@ -487,6 +487,9 @@ def get_export_job_manager(config: FrigateConfig) -> ExportJobManager:
with _job_manager_lock: with _job_manager_lock:
if _job_manager is None: if _job_manager is None:
_job_manager = ExportJobManager(config, _get_max_concurrent(config)) _job_manager = ExportJobManager(config, _get_max_concurrent(config))
# callers pass the live config, which a save replaces
_job_manager.config = config
_job_manager.ensure_started() _job_manager.ensure_started()
return _job_manager return _job_manager
+46 -49
View File
@@ -6,8 +6,10 @@ import threading
import time import time
from collections.abc import Callable, Generator, Iterable from collections.abc import Callable, Generator, Iterable
from concurrent.futures import Future, ThreadPoolExecutor, as_completed from concurrent.futures import Future, ThreadPoolExecutor, as_completed
from contextlib import closing
from dataclasses import asdict, dataclass, field from dataclasses import asdict, dataclass, field
from datetime import datetime from datetime import datetime
from itertools import islice
from typing import Any from typing import Any
import cv2 import cv2
@@ -611,24 +613,49 @@ class MotionSearchRunner(threading.Thread):
def _detect_with_progress( def _detect_with_progress(
self, self,
indexed_frames: list[tuple[int, np.ndarray]], frames: Iterable[np.ndarray],
timestamp_fn: Callable[[int], float], timestamp_fn: Callable[[int], float],
) -> list[MotionSearchResult]: ) -> tuple[list[MotionSearchResult], int]:
"""Run detection while firing throttled progress as frames are scanned.""" """Run detection while firing throttled progress as frames are scanned.
Returns ``(results, frame_count)``.
"""
frame_count = 0
def _gen() -> Generator[tuple[int, np.ndarray], None, None]: def _gen() -> Generator[tuple[int, np.ndarray], None, None]:
for i, frame in indexed_frames: nonlocal frame_count
for i, frame in enumerate(frames):
frame_count = i + 1
if not self._should_stop(): if not self._should_stop():
self._emit_progress(timestamp_fn(i)) self._emit_progress(timestamp_fn(i))
yield i, frame yield i, frame
return detect_motion_scaled( results = detect_motion_scaled(
_gen(), _gen(),
self.scaled_mask, self.scaled_mask,
self.job.threshold, self.job.threshold,
self.job.min_area, self.job.min_area,
timestamp_fn, timestamp_fn,
) )
return results, frame_count
def _decode_vod(
self, vod_url: str, keyframes: bool
) -> Generator[np.ndarray, None, None]:
return iter_vod_frames(
self.ffmpeg_path,
vod_url,
self.scaled[0],
self.scaled[1],
self.channels,
self.decode_args,
self.crop,
self.scaled,
True,
self._should_stop,
skip_nonkey=keyframes,
fps_rate=None if keyframes else self.fps_rate,
)
def _process_run( def _process_run(
self, run: list[Recordings] self, run: list[Recordings]
@@ -639,7 +666,8 @@ class MotionSearchRunner(threading.Thread):
are all decoded anyway) paired with its probed PTS; if the decoded and are all decoded anyway) paired with its probed PTS; if the decoded and
probed counts disagree (the decoder ignored ``-skip_frame nokey`` or the probed counts disagree (the decoder ignored ``-skip_frame nokey`` or the
stream is corrupt) this run re-runs in the fixed-cadence fallback. stream is corrupt) this run re-runs in the fixed-cadence fallback.
Returns ``(results, frame_count)``. Frames stream through detection, so a run never holds more than the
current and previous frame. Returns ``(results, frame_count)``.
""" """
run_start: float = run[0].start_time # type: ignore[assignment] run_start: float = run[0].start_time # type: ignore[assignment]
run_end: float = run[-1].end_time # type: ignore[assignment] run_end: float = run[-1].end_time # type: ignore[assignment]
@@ -650,35 +678,21 @@ class MotionSearchRunner(threading.Thread):
kf_pts = probe_vod_keyframe_pts( kf_pts = probe_vod_keyframe_pts(
self.ffprobe_path, vod_url, self._should_stop self.ffprobe_path, vod_url, self._should_stop
) )
frames = list(
iter_vod_frames( if kf_pts:
self.ffmpeg_path,
vod_url,
self.scaled[0],
self.scaled[1],
self.channels,
self.decode_args,
self.crop,
self.scaled,
True,
self._should_stop,
skip_nonkey=True,
fps_rate=None,
)
)
if kf_pts and len(frames) == len(kf_pts):
abs_times = [stream_time_to_absolute(time_map, p) for p in kf_pts] abs_times = [stream_time_to_absolute(time_map, p) for p in kf_pts]
indexed = list(enumerate(frames))
def _ts_kf(i: int) -> float: with closing(self._decode_vod(vod_url, keyframes=True)) as frames:
return abs_times[i] results, frame_count = self._detect_with_progress(
islice(frames, len(abs_times)), abs_times.__getitem__
)
extra_frames = next(frames, None) is not None
results = self._detect_with_progress(indexed, _ts_kf) if frame_count == len(abs_times) and not extra_frames:
return results, len(frames) return results, frame_count
logger.debug( logger.debug(
"Keyframe count mismatch (%d decoded vs %d probed), using cadence", "Keyframe decode did not match %d probed keyframes, using cadence",
len(frames),
len(kf_pts), len(kf_pts),
) )
@@ -688,29 +702,12 @@ class MotionSearchRunner(threading.Thread):
self, vod_url: str, time_map: list[tuple[float, float, float]] self, vod_url: str, time_map: list[tuple[float, float, float]]
) -> tuple[list[MotionSearchResult], int]: ) -> tuple[list[MotionSearchResult], int]:
"""Fixed-cadence fallback: fps-filtered VOD decode, evenly spaced times.""" """Fixed-cadence fallback: fps-filtered VOD decode, evenly spaced times."""
frames = list(
iter_vod_frames(
self.ffmpeg_path,
vod_url,
self.scaled[0],
self.scaled[1],
self.channels,
self.decode_args,
self.crop,
self.scaled,
True,
self._should_stop,
skip_nonkey=False,
fps_rate=self.fps_rate,
)
)
indexed = list(enumerate(frames))
def _ts_fps(i: int) -> float: def _ts_fps(i: int) -> float:
return stream_time_to_absolute(time_map, i / self.fps_rate) return stream_time_to_absolute(time_map, i / self.fps_rate)
results = self._detect_with_progress(indexed, _ts_fps) with closing(self._decode_vod(vod_url, keyframes=False)) as frames:
return results, len(frames) return self._detect_with_progress(frames, _ts_fps)
def _merge_run( def _merge_run(
self, self,
+16 -6
View File
@@ -28,6 +28,8 @@ _MAX_INTERVAL = 300
# Minimum seconds between VLM iterations when woken by detections (no zone filter) # Minimum seconds between VLM iterations when woken by detections (no zone filter)
_DETECTION_COOLDOWN_WITHOUT_ZONE = 10 _DETECTION_COOLDOWN_WITHOUT_ZONE = 10
MAX_WATCH_MINUTES = 1440
# Max user/assistant turn pairs to keep in conversation history # Max user/assistant turn pairs to keep in conversation history
_MAX_HISTORY = 10 _MAX_HISTORY = 10
@@ -75,15 +77,17 @@ class VLMWatchRunner(threading.Thread):
self.conversation: list[dict[str, Any]] = [] self.conversation: list[dict[str, Any]] = []
def run(self) -> None: def run(self) -> None:
try:
self.job.status = JobStatusTypesEnum.running self.job.status = JobStatusTypesEnum.running
self.job.start_time = time.time() self.job.start_time = time.time()
self._broadcast_status() self._broadcast_status()
self.conversation = [{"role": "system", "content": self._build_system_prompt()}] self.conversation = [
{"role": "system", "content": self._build_system_prompt()}
]
# monotonic so a wall clock step can't end the job early or let it overrun # monotonic so a wall clock step can't end the job early or let it overrun
max_end_time = time.monotonic() + self.job.max_duration_minutes * 60 max_end_time = time.monotonic() + self.job.max_duration_minutes * 60
try:
while not self.cancel_event.is_set(): while not self.cancel_event.is_set():
if time.monotonic() > max_end_time: if time.monotonic() > max_end_time:
logger.debug( logger.debug(
@@ -204,7 +208,13 @@ class VLMWatchRunner(threading.Thread):
) )
reasoning = str(parsed.get("reasoning", "")) reasoning = str(parsed.get("reasoning", ""))
notification_message = str(parsed.get("notification_message", "")) notification_message = str(parsed.get("notification_message", ""))
except (json.JSONDecodeError, ValueError, TypeError) as e: except (
json.JSONDecodeError,
ValueError,
TypeError,
AttributeError,
OverflowError,
) as e:
logger.warning( logger.warning(
"VLM watch job %s: failed to parse VLM response: %s", self.job.id, e "VLM watch job %s: failed to parse VLM response: %s", self.job.id, e
) )
@@ -403,9 +413,6 @@ def start_vlm_watch_job(
username=username, username=username,
) )
cancel_ev = threading.Event() cancel_ev = threading.Event()
_current_job = job
_cancel_event = cancel_ev
runner = VLMWatchRunner( runner = VLMWatchRunner(
job=job, job=job,
config=config, config=config,
@@ -414,6 +421,9 @@ def start_vlm_watch_job(
genai_manager=genai_manager, genai_manager=genai_manager,
dispatcher=dispatcher, dispatcher=dispatcher,
) )
_current_job = job
_cancel_event = cancel_ev
runner.start() runner.start()
logger.debug( logger.debug(

Some files were not shown because too many files have changed in this diff Show More