mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-30 20:06:51 +03:00
Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e08f7b821 | ||
|
|
49e0ad93c2 | ||
|
|
12dd242151 | ||
|
|
a573ea49bf | ||
|
|
9f918362e9 | ||
|
|
e3fa701893 | ||
|
|
168cbea9ea | ||
|
|
c0cf08ab4a | ||
|
|
6f80bcd19f | ||
|
|
d02a1156b7 | ||
|
|
c17538aff9 | ||
|
|
dd7e9f1bc5 | ||
|
|
48aaafba3c | ||
|
|
f1028d0c36 | ||
|
|
70d629bf93 | ||
|
|
c406a93d3d | ||
|
|
a8eca68438 | ||
|
|
81b53b7835 | ||
|
|
c2e739b4bc | ||
|
|
62d4e87e5d | ||
|
|
775ce22204 | ||
|
|
6f24f5a595 | ||
|
|
65af0b1351 | ||
|
|
fcd05ec7bc | ||
|
|
5f6043aa92 | ||
|
|
da4037eb52 | ||
|
|
f3c09ae169 | ||
|
|
f6596ac7b0 |
@@ -82,6 +82,7 @@ frontdoor
|
|||||||
fstype
|
fstype
|
||||||
fullchain
|
fullchain
|
||||||
fullscreen
|
fullscreen
|
||||||
|
gatekeep
|
||||||
genai
|
genai
|
||||||
generativeai
|
generativeai
|
||||||
genpts
|
genpts
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ body:
|
|||||||
|
|
||||||
Before submitting, read the [beta documentation][docs].
|
Before submitting, read the [beta documentation][docs].
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[docs]: https://docs-dev.frigate.video/
|
[docs]: https://docs-dev.frigate.video/
|
||||||
[discussions]: https://github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://github.com/blakeblackshear/frigate/discussions
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ body:
|
|||||||
|
|
||||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ body:
|
|||||||
|
|
||||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ body:
|
|||||||
|
|
||||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ body:
|
|||||||
|
|
||||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ body:
|
|||||||
|
|
||||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -10,9 +10,12 @@ body:
|
|||||||
|
|
||||||
**If you are looking for support, start a new discussion and use a support category.**
|
**If you are looking for support, start a new discussion and use a support category.**
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -12,11 +12,14 @@ body:
|
|||||||
|
|
||||||
**If you are unsure if your issue is actually a bug or not, please submit a support request first.**
|
**If you are unsure if your issue is actually a bug or not, please submit a support request first.**
|
||||||
|
|
||||||
|
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
|
||||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||||
[prs]: https://www.github.com/blakeblackshear/frigate/pulls
|
[prs]: https://www.github.com/blakeblackshear/frigate/pulls
|
||||||
[docs]: https://docs.frigate.video
|
[docs]: https://docs.frigate.video
|
||||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||||
[ai]: https://docs.frigate.video
|
[ai]: https://docs.frigate.video
|
||||||
|
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: Checklist
|
label: Checklist
|
||||||
|
|||||||
@@ -7,6 +7,13 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
By posting here you agree to follow our AI policy:
|
||||||
|
https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||||
|
|
||||||
|
Requests that appear to be written by an AI on your behalf may be closed without a response.
|
||||||
|
-->
|
||||||
|
|
||||||
**Describe what you are trying to accomplish and why in non technical terms**
|
**Describe what you are trying to accomplish and why in non technical terms**
|
||||||
I want to be able to ... so that I can ...
|
I want to be able to ... so that I can ...
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
_Please read the [contributing guidelines](https://github.com/blakeblackshear/frigate/blob/dev/CONTRIBUTING.md) before submitting a PR._
|
_Please read the [contributing guidelines](https://github.com/blakeblackshear/frigate/blob/dev/CONTRIBUTING.md) and the [AI policy](https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md) before submitting a PR. Every PR must be read and submitted by a person, and PRs that appear to be unreviewed AI output will be closed without review._
|
||||||
|
|
||||||
## Proposed change
|
## Proposed change
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ config/*
|
|||||||
models
|
models
|
||||||
*.mp4
|
*.mp4
|
||||||
*.db
|
*.db
|
||||||
|
*.db-*
|
||||||
*.csv
|
*.csv
|
||||||
frigate/version.py
|
frigate/version.py
|
||||||
web/build
|
web/build
|
||||||
|
|||||||
+126
@@ -0,0 +1,126 @@
|
|||||||
|
# Frigate AI Policy
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
- **Use AI tools if they help you.** We do too. This is about what you post, not which tools you use to write it.
|
||||||
|
- **A person has to read it and send it.** Don't wire a bot or an agent up to post on your behalf.
|
||||||
|
- **Write your posts yourself.** Your own words, the template filled in, and you answering maintainers rather than your assistant.
|
||||||
|
- **Don't paste an AI's guess at the cause as though it were a diagnosis.** Tell us what you actually observed.
|
||||||
|
- **Read your code before you submit it.** Disclose that AI was used, and be ready to explain every line.
|
||||||
|
- **If we misjudge something you wrote, just say so.** We'll take you at your word.
|
||||||
|
|
||||||
|
The rest of this document explains each of these, and why.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
AI tools are a reality of modern development and we're not opposed to their use. You are responsible for anything you submit, however it was produced, and we are responsible for anything we merge and release. We hold a high bar for both.
|
||||||
|
|
||||||
|
This policy applies everywhere this project is discussed: issues, discussions, pull requests, code reviews, and commit comments.
|
||||||
|
|
||||||
|
## Why this exists
|
||||||
|
|
||||||
|
Frigate is built and supported by a small group of maintainers and a community of volunteers who read every post and review every pull request. Nobody here is paid to do it, and time spent reading a post is time not spent fixing bugs or building features.
|
||||||
|
|
||||||
|
We're not opposed to AI tools. We use them too. But content generated by an AI and submitted without review costs a real person real time, and usually gives them less to work with than a few honest sentences would have. That is the problem this policy addresses.
|
||||||
|
|
||||||
|
## A person has to be in the loop
|
||||||
|
|
||||||
|
Every issue, discussion, comment, and pull request here must be read and submitted by a person. Using an AI tool to help you write is fine. Wiring one up to post on your behalf is not.
|
||||||
|
|
||||||
|
Specifically, do not:
|
||||||
|
|
||||||
|
- Connect a bot or agent to GitHub that opens issues, discussions, or pull requests without you reading them first
|
||||||
|
- Post output from a tool you have not read
|
||||||
|
- Use tooling to file bulk or drive-by contributions across the repository
|
||||||
|
|
||||||
|
We will close anything we believe was posted without a person reading it, and we may mark it as spam. Posts that skip the templates are the most common sign of this.
|
||||||
|
|
||||||
|
## Issues, discussions, and comments
|
||||||
|
|
||||||
|
We do not mind if you use AI tools to help you write. Do not have tools post unreviewed content on your behalf. We may hide any comment we believe to be unreviewed AI output.
|
||||||
|
|
||||||
|
Keep posts to what is needed to communicate your point. A long, confidently written, AI-padded post is harder to help with than a short direct one, not easier, and it is usually obvious.
|
||||||
|
|
||||||
|
**Describe your actual problem in your own words.** Tell us what you did, what you expected, and what actually happened. That is the information we need, and only you have it.
|
||||||
|
|
||||||
|
**Do not paste an AI's guess at the cause as though it were a diagnosis.** It is frequently wrong in ways that send everyone down the wrong path, and it buries the details that would have led to the real answer. We would rather see what you observed than what a model inferred.
|
||||||
|
|
||||||
|
**Fill in the template completely.** The templates ask for logs, config, version, and hardware because those are the things needed to help you. An AI cannot supply them for you, and a post missing them cannot be acted on.
|
||||||
|
|
||||||
|
**Answer maintainers yourself.** If we ask you a question, we are asking _you_, not your AI assistant. These are the spaces where we build trust and understanding with the community, and that only works if we're talking to each other. Using AI to fix your grammar or clarity is fine, but the substance has to be yours.
|
||||||
|
|
||||||
|
This applies to pull request descriptions and review replies as much as it does to bug reports and discussions.
|
||||||
|
|
||||||
|
### Quoting AI output
|
||||||
|
|
||||||
|
If you want to include something an AI told you, it must be:
|
||||||
|
|
||||||
|
- In a quote block, using `>`
|
||||||
|
- Disclosed as AI output, saying which tool it came from
|
||||||
|
- Accompanied by your own comment explaining why you think it is relevant
|
||||||
|
|
||||||
|
Keep the excerpt short. Do not paste long transcripts.
|
||||||
|
|
||||||
|
### Non-native English speakers
|
||||||
|
|
||||||
|
AI is genuinely useful for participating in a project that operates in English, and we would rather hear from you through a translation tool than not hear from you at all. Using AI to improve the grammar or clarity of something you wrote yourself is fine.
|
||||||
|
|
||||||
|
If you are translating your posts, make sure the translation says what you meant. Including your original text in a `<details>` block helps us verify the translation if something reads oddly, and keeps the thread readable.
|
||||||
|
|
||||||
|
## Code contributions
|
||||||
|
|
||||||
|
We need to understand your relationship with the code you're submitting. The more AI was involved, the more important it is that you've genuinely reviewed, tested, and understood what it produced.
|
||||||
|
|
||||||
|
Because of the long-term maintenance burden every merged change creates, we require a human in the loop who understands the work the AI produced. Pull requests that appear to be unreviewed AI output will be closed without review.
|
||||||
|
|
||||||
|
### Requirements when AI is used
|
||||||
|
|
||||||
|
If AI is used to generate any portion of the code, contributors must adhere to the following requirements:
|
||||||
|
|
||||||
|
1. **Explicitly disclose the manner in which AI was employed.** The PR template asks for this. Be honest, this won't automatically disqualify your PR. We'd rather have an honest disclosure than find out later. Trust matters more than method.
|
||||||
|
2. **Perform a comprehensive manual review prior to submitting the pull request.** Don't submit code you haven't read carefully and tested locally.
|
||||||
|
3. **Be prepared to explain every line of code you submitted when asked about it by a maintainer.** If you can't explain why something works the way it does, you're not ready to submit it.
|
||||||
|
4. **Check for an existing pull request addressing the same change.** If one exists, comment there and work with its author instead of opening a duplicate.
|
||||||
|
5. **It is strictly prohibited to use AI to write your posts for you** (bug reports, feature requests, pull request descriptions, GitHub discussions, responding to humans, etc.). We need to hear from _you_, not your AI assistant. These are the spaces where we build trust and understanding with contributors, and that only works if we're talking to each other.
|
||||||
|
|
||||||
|
### Established contributors
|
||||||
|
|
||||||
|
Contributors with a long history of thoughtful, quality contributions to Frigate have earned trust through that track record. The level of scrutiny we apply to AI usage naturally reflects that trust. This isn't a formal exemption, it's just how trust works. If you've been around, we know how you think and how you work. If you're new, we're still getting to know you, and clear disclosure helps build that relationship.
|
||||||
|
|
||||||
|
### What this means in practice
|
||||||
|
|
||||||
|
We're not trying to gatekeep how you write code. Use whatever tools make you productive. But there's a difference between using AI as a tool to implement something you understand and handing a feature request to an AI and submitting whatever comes back. The former is fine. The latter creates maintenance risk for the project.
|
||||||
|
|
||||||
|
Some honest context: when we review a PR, we're not just evaluating whether the code works today. We're evaluating whether we can maintain it, debug it, and extend it long-term, often without the original author's involvement. Code that the author doesn't deeply understand is code that nobody understands, and that's a liability.
|
||||||
|
|
||||||
|
One more thing worth saying directly: most maintainers already have access to the same AI tools you do. A PR that's entirely AI-generated, where the author can't explain the design, debug issues independently, or engage substantively in design discussions, doesn't offer something we couldn't produce ourselves. What makes a contribution genuinely valuable is the human judgment and domain understanding behind it, as well as the engagement during review that shapes it into something we can confidently take on long-term.
|
||||||
|
|
||||||
|
## Our use of AI
|
||||||
|
|
||||||
|
The Frigate documentation site has an "Ask AI" search that answers questions from the docs, and we may use AI tooling to help with triage and project management. Like any automated tooling, it is not always right.
|
||||||
|
|
||||||
|
If an AI tool leaves a comment on your contribution, treat it the way you would any other comment. If you think it is wrong, say so, and a brief explanation is enough. Maintainers always have the final say.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Contributions and posts that do not follow this policy will be closed. Depending on the situation, maintainers may also:
|
||||||
|
|
||||||
|
- Hide or delete comments that appear to be unreviewed AI output
|
||||||
|
- Mark automated content as spam
|
||||||
|
- Close an issue, discussion, or pull request without further review
|
||||||
|
- Lock a conversation
|
||||||
|
- Temporarily or permanently block an account from participating in the project
|
||||||
|
|
||||||
|
Repeated violations may result in being blocked from contributing to Frigate.
|
||||||
|
|
||||||
|
### When we get it wrong
|
||||||
|
|
||||||
|
There is no reliable way to detect this, and we're not going to pretend otherwise. Whether something reads as unreviewed AI output is a judgment call, usually made quickly, by a volunteer with limited time and no way to know for certain. These calls are subjective and we won't always get them right.
|
||||||
|
|
||||||
|
If it happens to you, just say so. A short reply telling us you wrote it yourself is enough, and we'll take you at your word and pick the conversation back up. We would much rather occasionally reopen something we misjudged than treat everyone who posts here as a suspect.
|
||||||
|
|
||||||
|
We'd ask for some understanding in return. These calls get made quickly because the volume is real, and time spent second-guessing them is time not spent helping the person in the next thread.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
Portions of this policy are adapted from the [Open Home Foundation AI Policy](https://developers.home-assistant.io/docs/ai_policy/).
|
||||||
+9
-19
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
Thank you for your interest in contributing to Frigate. This document covers the expectations and guidelines for contributions. Please read it before submitting a pull request.
|
Thank you for your interest in contributing to Frigate. This document covers the expectations and guidelines for contributions. Please read it before submitting a pull request.
|
||||||
|
|
||||||
|
All participation in this project, including pull requests, issues, and discussions, is covered by our [AI policy](AI_POLICY.md).
|
||||||
|
|
||||||
## Before you start
|
## Before you start
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
@@ -21,28 +23,16 @@ Before writing code for a new feature:
|
|||||||
|
|
||||||
## AI usage policy
|
## AI usage policy
|
||||||
|
|
||||||
AI tools are a reality of modern development and we're not opposed to their use. But we need to understand your relationship with the code you're submitting. The more AI was involved, the more important it is that you've genuinely reviewed, tested, and understood what it produced.
|
AI tools are a reality of modern development and we're not opposed to their use. But we need to understand your relationship with the code you're submitting, and we need to hear from you rather than from your AI assistant.
|
||||||
|
|
||||||
### Requirements when AI is used
|
**Read the [AI policy](AI_POLICY.md) before you open a pull request.** It is short, and it applies to everything you post here. The parts that most often catch people out:
|
||||||
|
|
||||||
If AI is used to generate any portion of the code, contributors must adhere to the following requirements:
|
- A person has to be in the loop. Don't wire a bot or agent up to open pull requests, issues, or discussions on your behalf.
|
||||||
|
- Disclose how AI was used. The PR template asks for this. Be honest, it won't automatically disqualify your PR.
|
||||||
|
- Review and test everything you submit, and be prepared to explain every line when asked.
|
||||||
|
- Don't use AI to write your PR description or your replies to maintainers.
|
||||||
|
|
||||||
1. **Explicitly disclose the manner in which AI was employed.** The PR template asks for this. Be honest — this won't automatically disqualify your PR. We'd rather have an honest disclosure than find out later. Trust matters more than method.
|
Pull requests that appear to be unreviewed AI output will be closed without review.
|
||||||
2. **Perform a comprehensive manual review prior to submitting the pull request.** Don't submit code you haven't read carefully and tested locally.
|
|
||||||
3. **Be prepared to explain every line of code they submitted when asked about it by a maintainer.** If you can't explain why something works the way it does, you're not ready to submit it.
|
|
||||||
4. **It is strictly prohibited to use AI to write your posts for you** (bug reports, feature requests, pull request descriptions, GitHub discussions, responding to humans, etc.). We need to hear from _you_, not your AI assistant. These are the spaces where we build trust and understanding with contributors, and that only works if we're talking to each other.
|
|
||||||
|
|
||||||
### Established contributors
|
|
||||||
|
|
||||||
Contributors with a long history of thoughtful, quality contributions to Frigate have earned trust through that track record. The level of scrutiny we apply to AI usage naturally reflects that trust. This isn't a formal exemption — it's just how trust works. If you've been around, we know how you think and how you work. If you're new, we're still getting to know you, and clear disclosure helps build that relationship.
|
|
||||||
|
|
||||||
### What this means in practice
|
|
||||||
|
|
||||||
We're not trying to gatekeep how you write code. Use whatever tools make you productive. But there's a difference between using AI as a tool to implement something you understand and handing a feature request to an AI and submitting whatever comes back. The former is fine. The latter creates maintenance risk for the project.
|
|
||||||
|
|
||||||
Some honest context: when we review a PR, we're not just evaluating whether the code works today. We're evaluating whether we can maintain it, debug it, and extend it long-term — often without the original author's involvement. Code that the author doesn't deeply understand is code that nobody understands, and that's a liability.
|
|
||||||
|
|
||||||
One more thing worth saying directly: most maintainers already have access to the same AI tools you do. A PR that's entirely AI-generated — where the author can't explain the design, debug issues independently, or engage substantively in design discussions — doesn't offer something we couldn't produce ourselves. What makes a contribution genuinely valuable is the human judgment and domain understanding behind it, as well as the engagement during review that shapes it into something we can confidently take on long-term.
|
|
||||||
|
|
||||||
## Pull request guidelines
|
## Pull request guidelines
|
||||||
|
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ RUN --mount=type=bind,source=docker/main/install_tempio.sh,target=/deps/install_
|
|||||||
FROM base_host AS ov-converter
|
FROM base_host AS ov-converter
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
# Install OpenVino Runtime and Dev library
|
# Install OpenVINO for model conversion
|
||||||
COPY docker/main/requirements-ov.txt /requirements-ov.txt
|
COPY docker/main/requirements-ov.txt /requirements-ov.txt
|
||||||
RUN apt-get -qq update \
|
RUN apt-get -qq update \
|
||||||
&& apt-get -qq install -y wget python3 python3-dev python3-distutils gcc pkg-config libhdf5-dev \
|
&& apt-get -qq install -y wget python3 python3-distutils \
|
||||||
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
&& sed -i 's/args.append("setuptools")/args.append("setuptools==77.0.3")/' get-pip.py \
|
&& sed -i 's/args.append("setuptools")/args.append("setuptools==77.0.3")/' get-pip.py \
|
||||||
&& python3 get-pip.py "pip" \
|
&& python3 get-pip.py "pip" \
|
||||||
|
|||||||
@@ -1,11 +1,42 @@
|
|||||||
import openvino as ov
|
"""Convert the default SSDLite MobileNet v2 model to OpenVINO IR.
|
||||||
from openvino.tools import mo
|
|
||||||
|
|
||||||
ov_model = mo.convert_model(
|
Replaces the legacy openvino-dev Model Optimizer conversion. The TensorFlow
|
||||||
|
frontend converts the Object Detection API frozen graph natively; the four TF
|
||||||
|
outputs are then repacked into the single [1, 1, 100, 7] DetectionOutput-style
|
||||||
|
tensor that Frigate's OpenVINO detector expects, and the input is flipped to
|
||||||
|
BGR to match the legacy reverse_input_channels behavior.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import openvino as ov
|
||||||
|
from openvino import opset8 as ops
|
||||||
|
from openvino.preprocess import PrePostProcessor
|
||||||
|
|
||||||
|
model = ov.convert_model(
|
||||||
"/models/ssdlite_mobilenet_v2_coco_2018_05_09/frozen_inference_graph.pb",
|
"/models/ssdlite_mobilenet_v2_coco_2018_05_09/frozen_inference_graph.pb",
|
||||||
compress_to_fp16=True,
|
input=[("image_tensor:0", [1, 300, 300, 3])],
|
||||||
transformations_config="/usr/local/lib/python3.11/dist-packages/openvino/tools/mo/front/tf/ssd_v2_support.json",
|
|
||||||
tensorflow_object_detection_api_pipeline_config="/models/ssdlite_mobilenet_v2_coco_2018_05_09/pipeline.config",
|
|
||||||
reverse_input_channels=True,
|
|
||||||
)
|
)
|
||||||
ov.save_model(ov_model, "/models/ssdlite_mobilenet_v2.xml")
|
|
||||||
|
# rows of (image_id, class_id, score, xmin, ymin, xmax, ymax)
|
||||||
|
boxes = model.output("detection_boxes:0").get_node().input_value(0)
|
||||||
|
classes = model.output("detection_classes:0").get_node().input_value(0)
|
||||||
|
scores = model.output("detection_scores:0").get_node().input_value(0)
|
||||||
|
|
||||||
|
# (ymin,xmin,ymax,xmax) -> (xmin,ymin,xmax,ymax)
|
||||||
|
boxes = ops.gather(boxes, [1, 0, 3, 2], 2)
|
||||||
|
classes = ops.unsqueeze(classes, 2)
|
||||||
|
scores = ops.unsqueeze(scores, 2)
|
||||||
|
image_id = ops.multiply(scores, np.float32(0.0))
|
||||||
|
|
||||||
|
detections = ops.concat([image_id, classes, scores, boxes], 2)
|
||||||
|
detections = ops.unsqueeze(detections, 1)
|
||||||
|
detections.output(0).get_tensor().set_names({"detection_out"})
|
||||||
|
|
||||||
|
model = ov.Model([detections], model.get_parameters(), "ssdlite_mobilenet_v2")
|
||||||
|
|
||||||
|
ppp = PrePostProcessor(model)
|
||||||
|
ppp.input().tensor().set_layout(ov.Layout("NHWC"))
|
||||||
|
ppp.input().preprocess().reverse_channels()
|
||||||
|
model = ppp.build()
|
||||||
|
|
||||||
|
ov.save_model(model, "/models/ssdlite_mobilenet_v2.xml", compress_to_fp16=True)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
SQLITE_VEC_VERSION="0.1.3"
|
SQLITE_VEC_VERSION="0.1.9"
|
||||||
|
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
numpy
|
numpy
|
||||||
tensorflow
|
openvino >= 2026.2.0
|
||||||
openvino-dev>=2024.0.0
|
|
||||||
|
|||||||
@@ -274,6 +274,13 @@ http {
|
|||||||
include proxy.conf;
|
include proxy.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /api/logout {
|
||||||
|
auth_request off;
|
||||||
|
rewrite ^/api(/.*)$ $1 break;
|
||||||
|
proxy_pass http://frigate_api;
|
||||||
|
include proxy.conf;
|
||||||
|
}
|
||||||
|
|
||||||
# Allow unauthenticated access to the first_time_login endpoint
|
# Allow unauthenticated access to the first_time_login endpoint
|
||||||
# so the login page can load help text before authentication.
|
# so the login page can load help text before authentication.
|
||||||
location /api/auth/first_time_login {
|
location /api/auth/first_time_login {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ It is not recommended to copy this full configuration file. Only specify values
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
Sections marked `# NOTE: Can be overridden at the camera level` can be set globally and then adjusted per camera. See [Global and Camera-Level Configuration](../config_overrides.md) for how that works.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mqtt:
|
mqtt:
|
||||||
# Optional: Enable mqtt server (default: shown below)
|
# Optional: Enable mqtt server (default: shown below)
|
||||||
@@ -171,13 +173,14 @@ model:
|
|||||||
# Valid values are rgb, bgr, or yuv. (default: shown below)
|
# Valid values are rgb, bgr, or yuv. (default: shown below)
|
||||||
input_pixel_format: rgb
|
input_pixel_format: rgb
|
||||||
# Required: Object detection model input tensor format
|
# Required: Object detection model input tensor format
|
||||||
# Valid values are nhwc or nchw (default: shown below)
|
# Valid values are nhwc, nchw, hwnc, or hwcn (default: shown below)
|
||||||
input_tensor: nhwc
|
input_tensor: nhwc
|
||||||
# Optional: Data type of the model input tensor
|
# Optional: Data type of the model input tensor
|
||||||
# Valid values are float, float_denorm, or int (default: shown below)
|
# Valid values are float, float_denorm, or int (default: shown below)
|
||||||
input_dtype: int
|
input_dtype: int
|
||||||
# Required: Object detection model type, currently only used with the OpenVINO detector
|
# Required: Object detection model architecture, used by detectors that support more
|
||||||
# Valid values are ssd, yolox, yolonas (default: shown below)
|
# than one model type (openvino, onnx, rknn, memryx, axengine, synaptics, and others)
|
||||||
|
# Valid values are ssd, yolox, yolonas, yolo-generic, rfdetr, dfine (default: shown below)
|
||||||
model_type: ssd
|
model_type: ssd
|
||||||
# Required: Label name modifications. These are merged into the standard labelmap.
|
# Required: Label name modifications. These are merged into the standard labelmap.
|
||||||
labelmap:
|
labelmap:
|
||||||
@@ -339,7 +342,7 @@ detect:
|
|||||||
# especially when using separate streams for detect and record.
|
# especially when using separate streams for detect and record.
|
||||||
# Use this setting to make the timeline bounding boxes more closely align
|
# Use this setting to make the timeline bounding boxes more closely align
|
||||||
# with the recording. The value can be positive or negative.
|
# with the recording. The value can be positive or negative.
|
||||||
# TIP: Imagine there is an tracked object clip with a person walking from left to right.
|
# TIP: Imagine there is a tracked object clip with a person walking from left to right.
|
||||||
# If the tracked object lifecycle bounding box is consistently to the left of the person
|
# If the tracked object lifecycle bounding box is consistently to the left of the person
|
||||||
# then the value should be decreased. Similarly, if a person is walking from
|
# then the value should be decreased. Similarly, if a person is walking from
|
||||||
# left to right and the bounding box is consistently ahead of the person
|
# left to right and the bounding box is consistently ahead of the person
|
||||||
@@ -468,8 +471,8 @@ review:
|
|||||||
detections: False
|
detections: False
|
||||||
# Optional: Activity Context Prompt to give context to the GenAI what activity is and is not suspicious.
|
# Optional: Activity Context Prompt to give context to the GenAI what activity is and is not suspicious.
|
||||||
# It is important to be direct and detailed. See documentation for the default prompt structure.
|
# It is important to be direct and detailed. See documentation for the default prompt structure.
|
||||||
activity_context_prompt: """Define what is and is not suspicious
|
activity_context_prompt: |
|
||||||
"""
|
Define what is and is not suspicious
|
||||||
# Optional: Image source for GenAI (default: preview)
|
# Optional: Image source for GenAI (default: preview)
|
||||||
# Options: "preview" (uses cached preview frames at ~180p) or "recordings" (extracts frames from recordings at 480p)
|
# Options: "preview" (uses cached preview frames at ~180p) or "recordings" (extracts frames from recordings at 480p)
|
||||||
# Using "recordings" provides better image quality but uses more tokens per image.
|
# Using "recordings" provides better image quality but uses more tokens per image.
|
||||||
@@ -813,7 +816,8 @@ classification:
|
|||||||
cameras:
|
cameras:
|
||||||
camera_name:
|
camera_name:
|
||||||
# Required: Crop of image frame on this camera to run classification on
|
# Required: Crop of image frame on this camera to run classification on
|
||||||
crop: [0, 180, 220, 400]
|
# [x1, y1, x2, y2] as decimals between 0 and 1, relative to the detect resolution
|
||||||
|
crop: [0.0, 0.25, 0.3, 0.85]
|
||||||
# Optional: If classification should be run when motion is detected in the crop (default: shown below)
|
# Optional: If classification should be run when motion is detected in the crop (default: shown below)
|
||||||
motion: False
|
motion: False
|
||||||
# Optional: Interval to run classification on in seconds (default: shown below)
|
# Optional: Interval to run classification on in seconds (default: shown below)
|
||||||
|
|||||||
@@ -67,15 +67,21 @@ This section can be used to set environment variables for those unable to modify
|
|||||||
|
|
||||||
Variables prefixed with `FRIGATE_` can be referenced in config fields that support environment variable substitution (such as MQTT host and credentials, camera stream URLs, and ONVIF host and credentials) using the `{FRIGATE_VARIABLE_NAME}` syntax.
|
Variables prefixed with `FRIGATE_` can be referenced in config fields that support environment variable substitution (such as MQTT host and credentials, camera stream URLs, and ONVIF host and credentials) using the `{FRIGATE_VARIABLE_NAME}` syntax.
|
||||||
|
|
||||||
|
:::note
|
||||||
|
|
||||||
|
The `go2rtc` section is an exception. go2rtc runs as a separate process, so its stream definitions can only be substituted with variables that exist in the container's environment (set via Docker `-e`, the `environment:` section of `docker-compose.yml`, or Docker secrets). Variables defined in the `environment_vars` block above are not available to go2rtc streams. Home Assistant app users, who cannot set container environment variables, must instead put credentials directly in their go2rtc stream URLs.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
<ConfigTabs>
|
<ConfigTabs>
|
||||||
<TabItem value="ui">
|
<TabItem value="ui">
|
||||||
|
|
||||||
Navigate to <NavPath path="Settings > System > Environment variables" /> to add or edit environment variables.
|
Navigate to <NavPath path="Settings > System > Environment variables" /> to add or edit environment variables.
|
||||||
|
|
||||||
| Field | Description |
|
| Field | Description |
|
||||||
| --------- | --------------------------------------------------------- |
|
| ----------------- | --------------------------------------------------------- |
|
||||||
| **Key** | The environment variable name (e.g., `FRIGATE_MQTT_USER`) |
|
| **Variable name** | The environment variable name (e.g., `FRIGATE_MQTT_USER`) |
|
||||||
| **Value** | The value for the variable |
|
| **Value** | The value for the variable |
|
||||||
|
|
||||||
Variables defined here can be referenced elsewhere in your configuration using the `{FRIGATE_VARIABLE_NAME}` syntax.
|
Variables defined here can be referenced elsewhere in your configuration using the `{FRIGATE_VARIABLE_NAME}` syntax.
|
||||||
|
|
||||||
@@ -329,7 +335,7 @@ For example:
|
|||||||
```
|
```
|
||||||
services:
|
services:
|
||||||
frigate:
|
frigate:
|
||||||
image: blakeblackshear/frigate:latest
|
image: ghcr.io/blakeblackshear/frigate:stable
|
||||||
environment:
|
environment:
|
||||||
- FRIGATE_BASE_PATH=/frigate
|
- FRIGATE_BASE_PATH=/frigate
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ cameras:
|
|||||||
|
|
||||||
### Configuring Minimum Volume
|
### Configuring Minimum Volume
|
||||||
|
|
||||||
The audio detector uses volume levels in the same way that motion in a camera feed is used for object detection. This means that Frigate will not run audio detection unless the audio volume is above the configured level in order to reduce resource usage. Audio levels can vary widely between camera models so it is important to run tests to see what volume levels are. The [Debug view](/usage/live#the-single-camera-view) in the Frigate UI has an Audio tab for cameras that have the `audio` role assigned where a graph and the current levels are is displayed. The `min_volume` parameter should be set to the minimum the `RMS` level required to run audio detection.
|
The audio detector uses volume levels in the same way that motion in a camera feed is used for object detection. This means that Frigate will not run audio detection unless the audio volume is above the configured level in order to reduce resource usage. Audio levels can vary widely between camera models so it is important to run tests to see what volume levels are. The [Debug view](/usage/live#the-single-camera-view) in the Frigate UI has an Audio tab for cameras that have the `audio` role assigned where a graph and the current levels are displayed. The `min_volume` parameter should be set to the minimum the `RMS` level required to run audio detection.
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ If you have CUDA hardware, you can experiment with the `large` `whisper` model o
|
|||||||
|
|
||||||
#### Transcription and translation of `speech` audio events
|
#### Transcription and translation of `speech` audio events
|
||||||
|
|
||||||
Any `speech` events in Explore can be transcribed and/or translated through the Transcribe button in the Tracked Object Details pane.
|
Any `speech` events in Explore can be transcribed and/or translated through the Transcribe button (the microphone icon) in the Tracked Object Details pane.
|
||||||
|
|
||||||
In order to use transcription and translation for past events, you must enable audio detection and define `speech` as an audio type to listen for. To have `speech` events translated into the language of your choice, set the `language` config parameter with the correct [language code](https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10).
|
In order to use transcription and translation for past events, you must enable audio detection and define `speech` as an audio type to listen for. To have `speech` events translated into the language of your choice, set the `language` config parameter with the correct [language code](https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10).
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ Recorded `speech` events will always use a `whisper` model, regardless of the `m
|
|||||||
|
|
||||||
Because transcription is **serialized (one event at a time)** and speech events can be generated far faster than they can be processed, an auto-transcribe toggle would very quickly create an ever-growing backlog and degrade core functionality. For the amount of engineering and risk involved, it adds **very little practical value** for the majority of deployments, which are often on low-powered, edge hardware.
|
Because transcription is **serialized (one event at a time)** and speech events can be generated far faster than they can be processed, an auto-transcribe toggle would very quickly create an ever-growing backlog and degrade core functionality. For the amount of engineering and risk involved, it adds **very little practical value** for the majority of deployments, which are often on low-powered, edge hardware.
|
||||||
|
|
||||||
If you hear speech that's actually important and worth saving/indexing for the future, **just press the transcribe button in Explore** on that specific `speech` event - that keeps things explicit, reliable, and under your control.
|
If you hear speech that's actually important and worth saving/indexing for the future, **just press the transcribe button (the microphone icon) in Explore** on that specific `speech` event - that keeps things explicit, reliable, and under your control.
|
||||||
|
|
||||||
Other options are being considered for future versions of Frigate to add transcription options that support external `whisper` Docker containers. A single transcription service could then be shared by Frigate and other applications (for example, Home Assistant Voice), and run on more powerful machines when available.
|
Other options are being considered for future versions of Frigate to add transcription options that support external `whisper` Docker containers. A single transcription service could then be shared by Frigate and other applications (for example, Home Assistant Voice), and run on more powerful machines when available.
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,19 @@ In this example:
|
|||||||
|
|
||||||
- Admin precedence: if the `admin` mapping matches, Frigate resolves the session to `admin` to avoid accidental downgrade when a user belongs to multiple groups (for example both `admin` and `viewer` groups).
|
- Admin precedence: if the `admin` mapping matches, Frigate resolves the session to `admin` to avoid accidental downgrade when a user belongs to multiple groups (for example both `admin` and `viewer` groups).
|
||||||
|
|
||||||
|
:::note
|
||||||
|
|
||||||
|
If a user isn't getting the role you expect, enable debug logging to see exactly what headers Frigate is receiving from your proxy:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
logger:
|
||||||
|
default: info
|
||||||
|
logs:
|
||||||
|
frigate.api.auth: debug
|
||||||
|
```
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
#### Port Considerations
|
#### Port Considerations
|
||||||
|
|
||||||
**Authenticated Port (8971)**
|
**Authenticated Port (8971)**
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ title: Camera Autotracking
|
|||||||
import ConfigTabs from "@site/src/components/ConfigTabs";
|
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||||
import TabItem from "@theme/TabItem";
|
import TabItem from "@theme/TabItem";
|
||||||
import NavPath from "@site/src/components/NavPath";
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
import FaqItem from "@site/src/components/FaqItem";
|
||||||
|
|
||||||
An ONVIF-capable, PTZ (pan-tilt-zoom) camera that supports relative movement within the field of view (FOV) can be configured to automatically track moving objects and keep them in the center of the frame.
|
An ONVIF-capable, PTZ (pan-tilt-zoom) camera that supports relative movement within the field of view (FOV) can be configured to automatically track moving objects and keep them in the center of the frame.
|
||||||
|
|
||||||
@@ -187,30 +188,96 @@ In security and surveillance, it's common to use "spotter" cameras in combinatio
|
|||||||
|
|
||||||
## Troubleshooting and FAQ
|
## Troubleshooting and FAQ
|
||||||
|
|
||||||
### The autotracker loses track of my object. Why?
|
### Camera Compatibility
|
||||||
|
|
||||||
|
<FaqItem id="which-ptz-camera-should-i-use-for-autotracking" question="Which PTZ camera should I use for autotracking?">
|
||||||
|
|
||||||
|
See the community-maintained list of [ONVIF PTZ camera recommendations](cameras.md#onvif-ptz-camera-recommendations) for cameras and brands reported to work (and not work) with autotracking. This is not an exhaustive list that is frequently updated, so other cameras not listed may also work well. Frigate's autotracking was developed with a Dahua SD1A404XB-GNR (now sold as the EmpireTech PTZ1A4M-4X-S2), and Dahua / EmpireTech PTZs are the most consistently reported as working well.
|
||||||
|
|
||||||
|
When comparing models:
|
||||||
|
|
||||||
|
- Verify ONVIF support first. See [Checking ONVIF camera support](#checking-onvif-camera-support) above.
|
||||||
|
- Favor a camera with a fast PTZ motor. Cameras with slow motors may fail [calibration](#calibration) and will struggle to keep up with objects that move across the field of view quickly.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="does-autotracking-work-with-reolink-ptz-cameras" question="Does autotracking work with Reolink PTZ cameras?">
|
||||||
|
|
||||||
|
No. Reolink cameras (including the TrackMix series) lack the ONVIF FOV RelativeMove firmware support that Frigate's autotracker requires, so autotracking will not work with any current Reolink PTZ. Their video streams and basic PTZ controls still work in Frigate. If you want object tracking on a Reolink PTZ, you will need to use the tracking feature built into the camera's firmware, which is proprietary and operates independently of Frigate.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="im-seeing-an-error-in-the-logs-that-my-camera-is-still-in-onvif-moving-status-what-does-this-mean" question={"I'm seeing an error in the logs that my camera \"is still in ONVIF 'MOVING' status.\" What does this mean?"}>
|
||||||
|
|
||||||
|
There are two possible known reasons for this (and perhaps others yet unknown): a slow PTZ motor or buggy camera firmware. Frigate uses an ONVIF parameter provided by the camera, `MoveStatus`, to determine when the PTZ's motor is moving or idle. According to some users, Hikvision PTZs (even with the latest firmware), are not updating this value after PTZ movement. Unfortunately there is no workaround to this bug in Hikvision firmware, so autotracking will not function correctly and should be disabled in your config. This may also be the case with other non-Hikvision cameras utilizing Hikvision firmware, such as some Annke models. In rare cases the vendor may provide fixed firmware on request; for example, Annke has supplied firmware that resolves this for the CZ504 (see the [camera recommendations list](cameras.md#onvif-ptz-camera-recommendations)).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="calibration-seems-to-have-completed-but-the-camera-is-not-actually-moving-to-track-my-object-why" question="Calibration seems to have completed, but the camera is not actually moving to track my object. Why?">
|
||||||
|
|
||||||
|
Some cameras have firmware that reports that FOV RelativeMove, the ONVIF command that Frigate uses for autotracking, is supported. However, if the camera does not pan or tilt when an object comes into the required zone, your camera's firmware does not actually support FOV RelativeMove. One such camera is the Uniview IPC672LR-AX4DUPK. It actually moves its zoom motor instead of panning and tilting and does not follow the ONVIF standard whatsoever.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
### Calibration Issues
|
||||||
|
|
||||||
|
<FaqItem id="i-tried-calibrating-my-camera-but-the-logs-show-that-it-is-stuck-at-0-and-frigate-is-not-starting-up" question="I tried calibrating my camera, but the logs show that it is stuck at 0% and Frigate is not starting up.">
|
||||||
|
|
||||||
|
This is often caused by the same reason as the "MOVING" status error above - the `MoveStatus` ONVIF parameter is not changing due to a bug in your camera's firmware. Also, see the note above: Frigate's web UI and all other cameras will be unresponsive while calibration is in progress. This is expected and normal. But if you don't see log entries every few seconds for calibration progress, your camera is not compatible with autotracking.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="frigate-reports-an-error-saying-that-calibration-has-failed-why" question="Frigate reports an error saying that calibration has failed. Why?">
|
||||||
|
|
||||||
|
Calibration measures the amount of time it takes for Frigate to make a series of movements with your PTZ. This error message is recorded in the log if these values are too high for Frigate to support calibrated autotracking. This is often the case when your camera's motor or network connection is too slow or your camera's firmware doesn't report the motor status in a timely manner.
|
||||||
|
|
||||||
|
Some things to try:
|
||||||
|
|
||||||
|
- If your camera's firmware has a PTZ or motor speed setting, set it to the fastest available speed and calibrate again.
|
||||||
|
- Run without calibration: remove the `movement_weights` line from your config, set `calibrate_on_startup` to `False`, and restart.
|
||||||
|
|
||||||
|
If calibration consistently fails, this often means your camera's motor is too slow and autotracking will behave unpredictably or won't be able to keep up with moving objects.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="autotracking-is-erratic-or-moves-the-camera-in-the-wrong-direction" question="Autotracking is erratic, moves the camera in the wrong direction, or zooms past my object. Why?">
|
||||||
|
|
||||||
|
Frigate uses the `movement_weights` measured during calibration to predict how far the camera needs to move to keep an object centered, so inaccurate values produce movements that don't seem to make sense: overshooting, moving the opposite direction, or zooming in on an object's last known position and losing it entirely. This is almost always a calibration issue.
|
||||||
|
|
||||||
|
- Remove the `movement_weights` entry from your config and restart Frigate to run without calibration. If tracking improves, try recalibrating.
|
||||||
|
- Recalibrate several times. The `movement_weights` values should be close to each other after each run. If they vary significantly between runs, your camera may not be reporting its motor status reliably, and you may get better results without calibration.
|
||||||
|
- If you are using zooming, a high `zoom_factor` can cause the camera to zoom in too far and lose the object. Try a lower value.
|
||||||
|
|
||||||
|
Remember to recalibrate whenever you change your `return_preset`, change your camera's detect `fps`, or enable zooming after calibrating with it disabled.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
### Tracking Behavior
|
||||||
|
|
||||||
|
<FaqItem id="the-autotracker-loses-track-of-my-object-why" question="The autotracker loses track of my object. Why?">
|
||||||
|
|
||||||
There are many reasons this could be the case. If you are using experimental zooming, your `zoom_factor` value might be too high, the object might be traveling too quickly, the scene might be too dark, there are not enough details in the scene (for example, a PTZ looking down on a driveway or other monotone background without a sufficient number of hard edges or corners), or the scene is otherwise less than optimal for Frigate to maintain tracking.
|
There are many reasons this could be the case. If you are using experimental zooming, your `zoom_factor` value might be too high, the object might be traveling too quickly, the scene might be too dark, there are not enough details in the scene (for example, a PTZ looking down on a driveway or other monotone background without a sufficient number of hard edges or corners), or the scene is otherwise less than optimal for Frigate to maintain tracking.
|
||||||
|
|
||||||
Your camera's shutter speed may also be set too low so that blurring occurs with motion. Check your camera's firmware to see if you can increase the shutter speed.
|
Your camera's shutter speed may also be set too low so that blurring occurs with motion. Check your camera's firmware to see if you can increase the shutter speed.
|
||||||
|
|
||||||
Watching Frigate's debug view can help to determine a possible cause. The autotracked object will have a thicker colored box around it.
|
Watching Frigate's debug view can help to determine a possible cause. The autotracked object will have a thicker colored box around it. If the camera consistently zooms in on the object and then loses it, see [Autotracking is erratic, moves the camera in the wrong direction, or zooms past my object. Why?](#autotracking-is-erratic-or-moves-the-camera-in-the-wrong-direction) above.
|
||||||
|
|
||||||
### I'm seeing an error in the logs that my camera "is still in ONVIF 'MOVING' status." What does this mean?
|
</FaqItem>
|
||||||
|
|
||||||
There are two possible known reasons for this (and perhaps others yet unknown): a slow PTZ motor or buggy camera firmware. Frigate uses an ONVIF parameter provided by the camera, `MoveStatus`, to determine when the PTZ's motor is moving or idle. According to some users, Hikvision PTZs (even with the latest firmware), are not updating this value after PTZ movement. Unfortunately there is no workaround to this bug in Hikvision firmware, so autotracking will not function correctly and should be disabled in your config. This may also be the case with other non-Hikvision cameras utilizing Hikvision firmware.
|
<FaqItem id="im-seeing-this-error-in-the-logs-autotracker-motion-estimator-couldnt-get-transformations-what-does-this-mean" question={"I'm seeing this error in the logs: \"Autotracker: motion estimator couldn't get transformations\". What does this mean?"}>
|
||||||
|
|
||||||
### I tried calibrating my camera, but the logs show that it is stuck at 0% and Frigate is not starting up.
|
|
||||||
|
|
||||||
This is often caused by the same reason as above - the `MoveStatus` ONVIF parameter is not changing due to a bug in your camera's firmware. Also, see the note above: Frigate's web UI and all other cameras will be unresponsive while calibration is in progress. This is expected and normal. But if you don't see log entries every few seconds for calibration progress, your camera is not compatible with autotracking.
|
|
||||||
|
|
||||||
### I'm seeing this error in the logs: "Autotracker: motion estimator couldn't get transformations". What does this mean?
|
|
||||||
|
|
||||||
To maintain object tracking during PTZ moves, Frigate tracks the motion of your camera based on the details of the frame. If you are seeing this message, it could mean that your `zoom_factor` may be set too high, the scene around your detected object does not have enough details (like hard edges or color variations), or your camera's shutter speed is too slow and motion blur is occurring. Try reducing `zoom_factor`, finding a way to alter the scene around your object, or changing your camera's shutter speed.
|
To maintain object tracking during PTZ moves, Frigate tracks the motion of your camera based on the details of the frame. If you are seeing this message, it could mean that your `zoom_factor` may be set too high, the scene around your detected object does not have enough details (like hard edges or color variations), or your camera's shutter speed is too slow and motion blur is occurring. Try reducing `zoom_factor`, finding a way to alter the scene around your object, or changing your camera's shutter speed.
|
||||||
|
|
||||||
### Calibration seems to have completed, but the camera is not actually moving to track my object. Why?
|
</FaqItem>
|
||||||
|
|
||||||
Some cameras have firmware that reports that FOV RelativeMove, the ONVIF command that Frigate uses for autotracking, is supported. However, if the camera does not pan or tilt when an object comes into the required zone, your camera's firmware does not actually support FOV RelativeMove. One such camera is the Uniview IPC672LR-AX4DUPK. It actually moves its zoom motor instead of panning and tilting and does not follow the ONVIF standard whatsoever.
|
<FaqItem id="why-does-object-detection-pause-briefly-when-the-camera-moves" question="Why does object detection pause briefly when the camera moves?">
|
||||||
|
|
||||||
### Frigate reports an error saying that calibration has failed. Why?
|
When the PTZ moves, the entire frame changes at once. Frigate's motion detection treats sudden scene-wide changes (like a lightning flash, an infrared mode switch, or a camera move) specially and pauses detection momentarily until the scene stabilizes. This is expected and normal, and detection resumes shortly after the camera stops moving. If detection does not resume once the camera is stationary, use the [debug view](/usage/live#the-single-camera-view) to see what is happening.
|
||||||
|
|
||||||
Calibration measures the amount of time it takes for Frigate to make a series of movements with your PTZ. This error message is recorded in the log if these values are too high for Frigate to support calibrated autotracking. This is often the case when your camera's motor or network connection is too slow or your camera's firmware doesn't report the motor status in a timely manner. You can try running without calibration (just remove the `movement_weights` line from your config and restart), but if calibration fails, this often means that autotracking will behave unpredictably.
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="can-i-turn-autotracking-on-and-off-automatically" question="Can I turn autotracking on and off automatically?">
|
||||||
|
|
||||||
|
Yes. Autotracking can be toggled per camera at runtime over MQTT with the [`frigate/<camera_name>/ptz_autotracker/set`](../integrations/mqtt.md#frigatecamera_nameptz_autotrackerset) topic, and the [Home Assistant integration](../integrations/home-assistant.md) exposes a switch for it. This pairs well with the "spotter" camera automations described in [Usage applications](#usage-applications) above, for example only enabling autotracking at night or when nobody is home.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ Reolink has many different camera models with inconsistently supported features
|
|||||||
| 6MP or higher | Latest (ex: Duo3, CX-8##) | http-flv with ffmpeg 8.0, or rtsp | This uses the new http-flv-enhanced over H265 which requires ffmpeg 8.0 (Frigate's default) |
|
| 6MP or higher | Latest (ex: Duo3, CX-8##) | http-flv with ffmpeg 8.0, or rtsp | This uses the new http-flv-enhanced over H265 which requires ffmpeg 8.0 (Frigate's default) |
|
||||||
| 6MP or higher | Older (ex: RLC-8##) | rtsp | |
|
| 6MP or higher | Older (ex: RLC-8##) | rtsp | |
|
||||||
|
|
||||||
Frigate works much better with newer reolink cameras that are setup with the below options:
|
Frigate works much better with newer Reolink cameras that are setup with the below options:
|
||||||
|
|
||||||
If available, recommended settings are:
|
If available, recommended settings are:
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ If available, recommended settings are:
|
|||||||
|
|
||||||
#### Setup via the Add Camera Wizard
|
#### Setup via the Add Camera Wizard
|
||||||
|
|
||||||
The Add Camera Wizard is the recommended way to add a standard Reolink camera. Before starting, make sure HTTP is enabled in the camera's advanced network settings. The wizard uses the camera's HTTP API to determine its resolution and choose the recommended stream type from the table above.
|
The [Add Camera Wizard](cameras.md#adding-a-camera-with-the-add-camera-wizard) is the recommended way to add a standard Reolink camera. Before starting, make sure [HTTP is enabled](https://support.reolink.com/articles/360003452893-How-to-Access-Reolink-Cameras-NVRs-Home-Hub-Locally-via-Web-Browsers/) in the camera's advanced network settings. The wizard uses the camera's HTTP API to determine its resolution and choose the recommended stream type from the table above.
|
||||||
|
|
||||||
1. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />.
|
1. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />.
|
||||||
2. Choose **Manual selection** as the stream detection method and select **Reolink** as the camera brand.
|
2. Choose **Manual selection** as the stream detection method and select **Reolink** as the camera brand.
|
||||||
@@ -192,7 +192,7 @@ Reolink's latest cameras support two way audio via go2rtc and other applications
|
|||||||
|
|
||||||
NOTE: The RTSP stream can not be prefixed with `ffmpeg:`, as go2rtc needs to handle the stream to support two way audio.
|
NOTE: The RTSP stream can not be prefixed with `ffmpeg:`, as go2rtc needs to handle the stream to support two way audio.
|
||||||
|
|
||||||
Ensure HTTP is enabled in the camera's advanced network settings. To use two way talk with Frigate, see the [Live view documentation](/configuration/live#two-way-talk).
|
Ensure [HTTP is enabled](https://support.reolink.com/articles/360003452893-How-to-Access-Reolink-Cameras-NVRs-Home-Hub-Locally-via-Web-Browsers/) in the camera's advanced network settings. To use two way talk with Frigate, see the [Live view documentation](/configuration/live#two-way-talk).
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ go2rtc:
|
|||||||
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password#video=copy#audio=copy#audio=opus"
|
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password#video=copy#audio=copy#audio=opus"
|
||||||
your_reolink_camera_sub:
|
your_reolink_camera_sub:
|
||||||
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=username&password=password"
|
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=username&password=password"
|
||||||
# example for connectin to a Reolink camera that supports two way talk
|
# example for connecting to a Reolink camera that supports two way talk
|
||||||
your_reolink_camera_twt:
|
your_reolink_camera_twt:
|
||||||
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password#video=copy#audio=copy#audio=opus"
|
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password#video=copy#audio=copy#audio=opus"
|
||||||
- "rtsp://username:password@reolink_ip/Preview_01_sub"
|
- "rtsp://username:password@reolink_ip/Preview_01_sub"
|
||||||
@@ -249,7 +249,7 @@ cameras:
|
|||||||
|
|
||||||
:::note
|
:::note
|
||||||
|
|
||||||
Unifi G5s cameras and newer need a Unifi Protect server to enable rtsps stream, it's not posible to enable it in standalone mode.
|
Unifi G5s cameras and newer need a Unifi Protect server to enable rtsps stream, it's not possible to enable it in standalone mode.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,49 @@ import ConfigTabs from "@site/src/components/ConfigTabs";
|
|||||||
import TabItem from "@theme/TabItem";
|
import TabItem from "@theme/TabItem";
|
||||||
import NavPath from "@site/src/components/NavPath";
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
|
||||||
|
## Adding a camera with the Add Camera Wizard
|
||||||
|
|
||||||
|
The Add Camera Wizard is the recommended way to add a camera. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />. The wizard connects to your camera, tests each stream, and writes the camera's configuration for you, including the [go2rtc](go2rtc.md) restream and the live view stream mapping, so a standard setup needs no hand-written YAML.
|
||||||
|
|
||||||
|
### Step 1: Name and connection
|
||||||
|
|
||||||
|
Enter a name for the camera along with its host or IP address and credentials, then choose how the wizard should find the camera's streams:
|
||||||
|
|
||||||
|
- **Probe camera** queries the camera over ONVIF (the ONVIF port is usually 80 or 8080) and asks it for its stream URLs. Some cameras use a separate ONVIF/service account rather than the device admin user, and some require **Use digest authentication** to be enabled.
|
||||||
|
- **Manual selection** builds a stream URL from a template for the camera brand you pick (Dahua/Amcrest/EmpireTech, Hikvision/Uniview/Annke, Ubiquiti, Reolink, Axis, TP-Link, or Foscam). Choose **Other** to enter a custom RTSP URL directly. Non-RTSP stream types must be [configured manually](#setting-up-camera-inputs).
|
||||||
|
|
||||||
|
The name you enter is lowercased and spaces become underscores. If the result still isn't a valid config key, the wizard generates a safe name and stores what you typed as `friendly_name`.
|
||||||
|
|
||||||
|
### Step 2: Probe or snapshot
|
||||||
|
|
||||||
|
In probe mode, the wizard reports what the camera returned (manufacturer, model, firmware, profile count, and whether PTZ, presets, and [autotracking](autotracking.md) are supported) along with the RTSP URLs it discovered. Test each candidate to see its resolution, frame rate, and codecs together with a snapshot, then select the one you want to use.
|
||||||
|
|
||||||
|
In manual mode, the wizard tests the templated URL and shows the same metadata and snapshot.
|
||||||
|
|
||||||
|
If no RTSP URLs are found, the credentials may be wrong or the camera may not support ONVIF. Go back and use manual selection instead.
|
||||||
|
|
||||||
|
### Step 3: Stream configuration
|
||||||
|
|
||||||
|
Assign [roles](#setting-up-camera-inputs) to the stream, and use **Add Another Stream** to add the camera's other streams, for example a substream for `detect` alongside the main stream for `record`. At least one stream must have the `detect` role before you can continue.
|
||||||
|
|
||||||
|
**Reduce connections to camera** routes that input through the go2rtc restream so Frigate and the live view share a single connection to the camera instead of each opening their own. See [restream](restream.md) for more detail.
|
||||||
|
|
||||||
|
### Step 4: Validation and testing
|
||||||
|
|
||||||
|
Connect each stream to get a live preview, an estimated bandwidth figure, and a list of validation results. The wizard checks for the most common misconfigurations, including:
|
||||||
|
|
||||||
|
- A detect resolution that is too high (increased resource usage) or too low for reliable detection, or one it could not probe at all
|
||||||
|
- A stream marked `record` whose audio codec is not AAC, or that has no audio at all
|
||||||
|
- A stream marked `audio` that carries no audio stream
|
||||||
|
- Using a restreamed input for the `record` role
|
||||||
|
- Brand-specific issues, such as an RTSP stream on a Reolink camera that should use http-flv, or a Dahua/Hikvision substream selected for `detect`
|
||||||
|
|
||||||
|
**Use stream compatibility mode** passes the stream through go2rtc's ffmpeg module. Enable it if a stream fails to load after several attempts. Note that this also prevents [two way talk](/configuration/live#two-way-talk) from being detected for that stream.
|
||||||
|
|
||||||
|
**Save New Camera** writes the configuration and starts the camera right away. No restart is required.
|
||||||
|
|
||||||
|
Other features, including [hardware acceleration](hardware_acceleration_video.md), [two way talk](/configuration/live#two-way-talk), and audio transcoding, is configured after the camera has been added. For camera model specific quirks, see the [camera specific](camera_specific.md) docs.
|
||||||
|
|
||||||
## Setting Up Camera Inputs
|
## Setting Up Camera Inputs
|
||||||
|
|
||||||
Several inputs can be configured for each camera and the role of each input can be mixed and matched based on your needs. This allows you to use a lower resolution stream for object detection, but create recordings from a higher resolution stream, or vice versa.
|
Several inputs can be configured for each camera and the role of each input can be mixed and matched based on your needs. This allows you to use a lower resolution stream for object detection, but create recordings from a higher resolution stream, or vice versa.
|
||||||
@@ -69,7 +112,7 @@ Additional cameras are simply added under the camera configuration section.
|
|||||||
<ConfigTabs>
|
<ConfigTabs>
|
||||||
<TabItem value="ui">
|
<TabItem value="ui">
|
||||||
|
|
||||||
Navigate to <NavPath path="Settings > Global configuration > Camera management" /> and use the add camera button to configure each additional camera.
|
Navigate to <NavPath path="Settings > Global configuration > Camera management" /> and use the [Add Camera Wizard](#adding-a-camera-with-the-add-camera-wizard) to configure each additional camera.
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="yaml">
|
<TabItem value="yaml">
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Settings are organized into two scopes:
|
|||||||
- **Global configuration**: values under <NavPath path="Settings > Global configuration" /> apply to every camera by default. This is where you set the baseline behavior for object detection, recording, snapshots, motion, and so on.
|
- **Global configuration**: values under <NavPath path="Settings > Global configuration" /> apply to every camera by default. This is where you set the baseline behavior for object detection, recording, snapshots, motion, and so on.
|
||||||
- **Camera configuration**: values under <NavPath path="Settings > Camera configuration" /> apply to a single camera. Use the camera selector button at the top of these pages to choose which camera you are editing.
|
- **Camera configuration**: values under <NavPath path="Settings > Camera configuration" /> apply to a single camera. Use the camera selector button at the top of these pages to choose which camera you are editing.
|
||||||
|
|
||||||
When a camera-level section is left untouched, the camera simply inherits the global values. Changing a value on a camera page **overrides** the global value for that camera only: the global setting and every other camera are unaffected. This mirrors how the YAML works, where a value set under `cameras.<name>` takes precedence over the same value set at the top level.
|
When a camera-level section is left untouched, the camera simply inherits the global values. Changing a value on a camera page **overrides** the global value for that camera only: the global setting and every other camera are unaffected. This mirrors how the YAML works, where a value set under `cameras.<name>` takes precedence over the same value set at the top level. See [Global and Camera-Level Configuration](./config_overrides.md) for the full details, including how lists and maps are handled and which settings must be enabled globally first.
|
||||||
|
|
||||||
To undo an override and go back to inheriting from the parent scope, use the reset button at the bottom of the section:
|
To undo an override and go back to inheriting from the parent scope, use the reset button at the bottom of the section:
|
||||||
|
|
||||||
@@ -130,7 +130,8 @@ go2rtc:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
api_key: "{FRIGATE_GENAI_API_KEY}"
|
my_provider:
|
||||||
|
api_key: "{FRIGATE_GENAI_API_KEY}"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Common configuration examples
|
## Common configuration examples
|
||||||
|
|||||||
@@ -0,0 +1,244 @@
|
|||||||
|
---
|
||||||
|
id: config_overrides
|
||||||
|
title: Global and Camera-Level Configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||||
|
import TabItem from "@theme/TabItem";
|
||||||
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
|
||||||
|
Most of Frigate's configuration can be set once for all cameras and then adjusted for individual cameras. The global value acts as the default for every camera, and any camera can override it.
|
||||||
|
|
||||||
|
This page explains how that inheritance works. For a tour of the Settings UI itself, see [Frigate Configuration](./config.md).
|
||||||
|
|
||||||
|
## The basics
|
||||||
|
|
||||||
|
Set a value globally and every camera uses it. Set the same value on a camera and that camera uses its own value instead.
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
1. Navigate to <NavPath path="Settings > Global configuration > Object detection" /> and set **Detect FPS** to `5`. Every camera now detects at 5 fps.
|
||||||
|
2. Navigate to <NavPath path="Settings > Camera configuration > Object detection" />, select the `driveway` camera, and set **Detect FPS** to `10`.
|
||||||
|
|
||||||
|
The `driveway` camera now detects at 10 fps. Every other camera still uses the global value of 5.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
detect:
|
||||||
|
fps: 5 # every camera detects at 5 fps
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
front_door:
|
||||||
|
ffmpeg: ...
|
||||||
|
driveway:
|
||||||
|
ffmpeg: ...
|
||||||
|
detect:
|
||||||
|
fps: 10 # except this one
|
||||||
|
```
|
||||||
|
|
||||||
|
`front_door` inherits `fps: 5`, and `driveway` uses `10`.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
## Overrides apply per value, not per section
|
||||||
|
|
||||||
|
Overriding one value in a section does not detach the rest of that section. Everything you don't set on the camera still comes from the global configuration.
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
If you set a camera's **Motion threshold** but leave **Contour area** alone, only the threshold is overridden. The contour area continues to follow <NavPath path="Settings > Global configuration > Motion detection" />, and changing it there still affects that camera.
|
||||||
|
|
||||||
|
Open a section to see which values are overridden: the section header indicates how many fields differ from the global configuration.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
motion:
|
||||||
|
threshold: 30
|
||||||
|
contour_area: 10
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
driveway:
|
||||||
|
motion:
|
||||||
|
threshold: 40
|
||||||
|
```
|
||||||
|
|
||||||
|
The `driveway` camera ends up with `threshold: 40` and `contour_area: 10`. Only the value you wrote was overridden.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
## Returning a camera to the global value
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
A camera section that has its own values shows an **Overridden** badge. To remove the override and go back to inheriting, use the **Reset to Global** button at the bottom of the section.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
|
Frigate treats a camera value as an override because it is written in the config file, not because it differs from the global value. Repeating the global value under a camera still creates an override:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
snapshots:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
driveway:
|
||||||
|
snapshots:
|
||||||
|
enabled: true # this is an override, even though it matches
|
||||||
|
```
|
||||||
|
|
||||||
|
If you later change the global `snapshots.enabled` to `false`, `driveway` keeps saving snapshots, because it has its own value. To make a camera follow the global value again, delete the key from the camera rather than setting it to match.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
## Lists replace, maps merge
|
||||||
|
|
||||||
|
This is the distinction that surprises people most.
|
||||||
|
|
||||||
|
**Lists are replaced entirely.** A camera's list does not add to the global list, it takes its place.
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
The camera page shows the objects the camera is currently tracking, starting from the global list. Changing that selection under <NavPath path="Settings > Camera configuration > Objects" /> replaces the list for that camera, so make sure every object you want tracked is selected, not just the ones you are adding.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
objects:
|
||||||
|
track:
|
||||||
|
- person
|
||||||
|
- car
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
backyard:
|
||||||
|
objects:
|
||||||
|
track:
|
||||||
|
- dog # backyard tracks ONLY dog, not person or car
|
||||||
|
```
|
||||||
|
|
||||||
|
To track `dog` in addition to the global objects, list all of them on the camera.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
An empty list is a valid override, and is the normal way to opt a camera out of something:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
review:
|
||||||
|
alerts:
|
||||||
|
labels:
|
||||||
|
- person
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
street:
|
||||||
|
review:
|
||||||
|
alerts:
|
||||||
|
labels: [] # this camera never creates alerts
|
||||||
|
```
|
||||||
|
|
||||||
|
**Maps are merged key by key.** A camera can add an entry without redeclaring the others.
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
Adding a filter for one object under <NavPath path="Settings > Camera configuration > Objects" /> does not remove the filters inherited from <NavPath path="Settings > Global configuration > Objects" />. The camera keeps both.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
objects:
|
||||||
|
filters:
|
||||||
|
person:
|
||||||
|
min_area: 5000
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
driveway:
|
||||||
|
objects:
|
||||||
|
filters:
|
||||||
|
car:
|
||||||
|
min_area: 10000
|
||||||
|
```
|
||||||
|
|
||||||
|
The `driveway` camera ends up with both the `car` filter it defined and the `person` filter from the global configuration.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
## Which settings can be overridden
|
||||||
|
|
||||||
|
Most, but not all. The [full reference config](./advanced/reference.md) is the authoritative source: sections that support camera-level overrides are marked with the comment `# NOTE: Can be overridden at the camera level`. In the UI, a setting can be overridden if it appears under both <NavPath path="Settings > Global configuration" /> and <NavPath path="Settings > Camera configuration" />.
|
||||||
|
|
||||||
|
A few things worth knowing beyond that:
|
||||||
|
|
||||||
|
- Some sections are **global only** and have no camera-level equivalent, including `go2rtc`, `genai` providers, `classification`, `telemetry`, `camera_groups`, and `ui`.
|
||||||
|
- Some sections exist **only at the camera level**, such as `zones` and `onvif`.
|
||||||
|
- Some sections are **partially overridable**, meaning a camera accepts only a few of the keys available globally. `face_recognition`, `lpr`, and `audio_transcription` work this way, and the reference config notes which keys apply.
|
||||||
|
|
||||||
|
## Enrichments that must be enabled globally first
|
||||||
|
|
||||||
|
License plate recognition and face recognition are special: the global setting is not just a default, it is a switch that must be on before any camera can use the feature. Enabling one on a camera while it is disabled globally is a configuration error, and Frigate will refuse to start:
|
||||||
|
|
||||||
|
```
|
||||||
|
Camera driveway has lpr enabled but lpr is disabled at the global level of the config. You must enable lpr at the global level.
|
||||||
|
```
|
||||||
|
|
||||||
|
Enable the feature globally, then turn it off on the cameras that don't need it.
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
1. Navigate to <NavPath path="Settings > Global configuration > License plate recognition" /> and enable **LPR**.
|
||||||
|
2. Navigate to <NavPath path="Settings > Camera configuration > License plate recognition" />, select each camera that should not run LPR, and disable the **Enable LPR** toggle.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
lpr:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
driveway:
|
||||||
|
ffmpeg: ... # inherits lpr, enabled
|
||||||
|
backyard:
|
||||||
|
ffmpeg: ...
|
||||||
|
lpr:
|
||||||
|
enabled: false # opted out
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
:::note
|
||||||
|
|
||||||
|
This applies only to `lpr` and `face_recognition`, because the global setting controls whether the supporting background process starts at all. Other features do not work this way. Audio transcription, for example, can be enabled on a single camera without being enabled globally.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
## Profiles
|
||||||
|
|
||||||
|
[Profiles](./profiles.md) add a further layer on top of everything described above. A profile is a named set of camera overrides that you can switch on and off while Frigate is running, for example to change detection and recording behavior when you leave the house.
|
||||||
|
|
||||||
|
Profiles are applied on top of a camera's already-resolved configuration, so a profile value wins over both the camera and the global value while that profile is active. Profiles cover a subset of the camera sections and do not modify your config file.
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
- A camera inherits every value you don't set on it.
|
||||||
|
- Overriding one value does not detach the rest of the section.
|
||||||
|
- Writing a value on a camera overrides it, even if it matches the global value. Remove it to inherit again.
|
||||||
|
- Lists replace the global list. Maps merge into it.
|
||||||
|
- An empty list is an override, not an omission.
|
||||||
|
- `lpr` and `face_recognition` must be enabled globally before a camera can use them.
|
||||||
@@ -73,9 +73,13 @@ classification:
|
|||||||
interval: 10 # also run every N seconds (optional)
|
interval: 10 # also run every N seconds (optional)
|
||||||
cameras:
|
cameras:
|
||||||
front:
|
front:
|
||||||
crop: [0, 180, 220, 400]
|
# [x1, y1, x2, y2] as decimals between 0 and 1, relative to the
|
||||||
|
# camera's detect resolution
|
||||||
|
crop: [0.0, 0.25, 0.3, 0.85]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Crop coordinates are normalized: each value is a fraction of the camera's `detect` width or height, not a pixel value. Drawing the crop in the UI wizard writes these values for you.
|
||||||
|
|
||||||
An optional config, `save_attempts`, can be set as a key under the model name. This defines the number of classification attempts to save in the Recent Classifications tab. For state classification models, the default is 100.
|
An optional config, `save_attempts`, can be set as a key under the model name. This defines the number of classification attempts to save in the Recent Classifications tab. For state classification models, the default is 100.
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ title: Face Recognition
|
|||||||
import ConfigTabs from "@site/src/components/ConfigTabs";
|
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||||
import TabItem from "@theme/TabItem";
|
import TabItem from "@theme/TabItem";
|
||||||
import NavPath from "@site/src/components/NavPath";
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
import FaqItem from "@site/src/components/FaqItem";
|
||||||
|
|
||||||
Face recognition identifies known individuals by matching detected faces with previously learned facial data. When a known `person` is recognized, their name will be added as a `sub_label`. This information is included in the UI, filters, as well as in notifications.
|
Face recognition identifies known individuals by matching detected faces with previously learned facial data. When a known `person` is recognized, their name will be added as a `sub_label`. This information is included in the UI, filters, as well as in notifications.
|
||||||
|
|
||||||
@@ -151,6 +152,14 @@ Follow these steps to begin:
|
|||||||
|
|
||||||
## Creating a Robust Training Set
|
## Creating a Robust Training Set
|
||||||
|
|
||||||
|
:::tip
|
||||||
|
|
||||||
|
**The short version:** Start with a few clear, front-facing photos of each person. As faces are detected in the Recent Recognitions tab, train clear images that scored lower, adding variety (different angles, lighting, and expressions) slowly. Diversity matters far more than volume, and low-quality images hurt recognition more than they help.
|
||||||
|
|
||||||
|
For a step-by-step narrative of these best practices (and the same principles applied to state and object classification), see the [Frigate Tips: Best Practices for Training](https://github.com/blakeblackshear/frigate/discussions/21374) discussion.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
The number of images needed for a sufficient training set for face recognition varies depending on several factors:
|
The number of images needed for a sufficient training set for face recognition varies depending on several factors:
|
||||||
|
|
||||||
- Diversity of the dataset: A dataset with diverse images, including variations in lighting, pose, and facial expressions, will require fewer images per person than a less diverse dataset.
|
- Diversity of the dataset: A dataset with diverse images, including variations in lighting, pose, and facial expressions, will require fewer images per person than a less diverse dataset.
|
||||||
@@ -181,9 +190,27 @@ When choosing images to include in the face training set it is recommended to al
|
|||||||
|
|
||||||
The Recent Recognitions tab in the face library displays recent face recognition attempts. Detected face images are grouped according to the person they were identified as potentially matching.
|
The Recent Recognitions tab in the face library displays recent face recognition attempts. Detected face images are grouped according to the person they were identified as potentially matching.
|
||||||
|
|
||||||
Each face image is labeled with a name (or `Unknown`) along with the confidence score of the recognition attempt. While each image can be used to train the system for a specific person, not all images are suitable for training.
|
Each face image is labeled with a name (or `Unknown`) along with the confidence score of that recognition attempt. Images are grouped by the person they were matched against, not by who they actually are, so a group labeled with a person's name can contain a crop that is really someone else but happened to score as a partial match. The name and score shown on each individual crop describe that single attempt.
|
||||||
|
|
||||||
Refer to the guidelines below for best practices on selecting images for training.
|
While each image can be used to train the system for a specific person, not all images are suitable for training. Refer to the guidelines below for best practices on selecting images for training.
|
||||||
|
|
||||||
|
### How Frigate Decides Who a Person Is
|
||||||
|
|
||||||
|
Recognition does not happen one frame at a time. While a `person` is in view, Frigate runs face recognition on many frames, not just a single frame. The final `sub_label` is decided from all of those attempts together, weighted by the area of each face (larger, closer faces count more), not from any single frame.
|
||||||
|
|
||||||
|
This has a few practical consequences:
|
||||||
|
|
||||||
|
- A handful of wrong guesses on blurry or distant frames usually do not change the result. If Frigate sees a person as "Tom, Tom, Sam, Tom, Tom," it will still conclude the person was Tom.
|
||||||
|
- The goal is not for every individual face crop to be correct. The goal is for each person to be recognized correctly overall, across all the faces captured while they were present.
|
||||||
|
- A single very high confidence match will not by itself assign a sub label. Recognition must be consistent. See [I see scores above the threshold in the Recent Recognitions tab, but a sub label wasn't assigned?](#i-see-scores-above-the-threshold-in-the-recent-recognitions-tab-but-a-sub-label-wasnt-assigned) below.
|
||||||
|
|
||||||
|
### Which Faces Are Worth Training?
|
||||||
|
|
||||||
|
Whether a face is worth training has little to do with what it was recognized as. A crop is a good training candidate when all of these are true:
|
||||||
|
|
||||||
|
- It did not already score high and correctly. Faces that are already recognized confidently add little and increase the risk of over-fitting.
|
||||||
|
- It is clear enough to be useful: not blurry, not heavily off-axis, not infrared (gray-scale). If it is hard for you to make out the face, it will not help the model.
|
||||||
|
- It adds something new: a different angle, lighting, expression, or distance than what you already have.
|
||||||
|
|
||||||
### Step 1 - Building a Strong Foundation
|
### Step 1 - Building a Strong Foundation
|
||||||
|
|
||||||
@@ -199,11 +226,27 @@ Once front-facing images are performing well, start choosing slightly off-angle
|
|||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### How do I debug Face Recognition issues?
|
### Getting Recognition Working
|
||||||
|
|
||||||
|
<FaqItem id="how-do-i-debug-face-recognition-issues" question="How do I debug Face Recognition issues?">
|
||||||
|
|
||||||
Start with the [Usage](#usage) section and re-read the [Model Requirements](#model-requirements) above.
|
Start with the [Usage](#usage) section and re-read the [Model Requirements](#model-requirements) above.
|
||||||
|
|
||||||
1. Ensure `person` is being _detected_. A `person` will automatically be scanned by Frigate for a face. Any detected faces will appear in the Recent Recognitions tab in the Frigate UI's Face Library.
|
1. Enable debug logs to see exactly what Frigate is doing.
|
||||||
|
- Enable debug logs for face recognition by adding `frigate.data_processing.real_time.face: debug` to your `logger` configuration. Restart Frigate after this change.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
logger:
|
||||||
|
default: info
|
||||||
|
logs:
|
||||||
|
# highlight-next-line
|
||||||
|
frigate.data_processing.real_time.face: debug
|
||||||
|
```
|
||||||
|
|
||||||
|
- These logs report where the pipeline stopped for each `person` object, such as no face being found within the person's bounding box, the detected face being smaller than `min_area`, or a face being recognized but scoring too low.
|
||||||
|
- If you see no face-related messages at all, also add `frigate.embeddings.maintainer: debug` to confirm that the face processor was created at startup and that `person` updates are reaching it.
|
||||||
|
|
||||||
|
2. Ensure `person` is being _detected_. A `person` will automatically be scanned by Frigate for a face. Any detected faces will appear in the Recent Recognitions tab in the Frigate UI's Face Library.
|
||||||
|
|
||||||
If you are using a Frigate+ or `face` detecting model:
|
If you are using a Frigate+ or `face` detecting model:
|
||||||
- Watch the [debug view](/usage/live#the-single-camera-view) to ensure that `face` is being detected along with `person`.
|
- Watch the [debug view](/usage/live#the-single-camera-view) to ensure that `face` is being detected along with `person`.
|
||||||
@@ -213,25 +256,51 @@ Start with the [Usage](#usage) section and re-read the [Model Requirements](#mod
|
|||||||
- Check your `detect` stream resolution and ensure it is sufficiently high enough to capture face details on `person` objects.
|
- Check your `detect` stream resolution and ensure it is sufficiently high enough to capture face details on `person` objects.
|
||||||
- You may need to lower your `detection_threshold` if faces are not being detected.
|
- You may need to lower your `detection_threshold` if faces are not being detected.
|
||||||
|
|
||||||
2. Any detected faces will then be _recognized_.
|
3. Any detected faces will then be _recognized_.
|
||||||
- Make sure you have trained at least one face per the recommendations above.
|
- Make sure you have trained at least one face per the recommendations above.
|
||||||
- Adjust `recognition_threshold` settings per the suggestions [above](#advanced-configuration).
|
- Adjust `recognition_threshold` settings per the suggestions [above](#advanced-configuration).
|
||||||
|
|
||||||
### Detection does not work well with blurry images?
|
</FaqItem>
|
||||||
|
|
||||||
Accuracy is definitely a going to be improved with higher quality cameras / streams. It is important to look at the DORI (Detection Observation Recognition Identification) range of your camera, if that specification is posted. This specification explains the distance from the camera that a person can be detected, observed, recognized, and identified. The identification range is the most relevant here, and the distance listed by the camera is the furthest that face recognition will realistically work.
|
<FaqItem id="does-face-recognition-run-on-the-recording-stream" question="Does face recognition run on the recording stream?">
|
||||||
|
|
||||||
|
Face recognition does not run on the recording stream, this would be suboptimal for many reasons:
|
||||||
|
|
||||||
|
1. The latency of accessing the recordings means the notifications would not include the names of recognized people because recognition would not complete until after.
|
||||||
|
2. The embedding models used run on a set image size, so larger images will be scaled down to match this anyway.
|
||||||
|
3. Motion clarity is much more important than extra pixels, over-compression and motion blur are much more detrimental to results than resolution.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
### Improving Accuracy and Training
|
||||||
|
|
||||||
|
<FaqItem id="detection-does-not-work-well-with-blurry-images" question="Detection does not work well with blurry images?">
|
||||||
|
|
||||||
|
Accuracy is definitely going to be improved with higher quality cameras / streams. It is important to look at the DORI (Detection Observation Recognition Identification) range of your camera, if that specification is posted. This specification explains the distance from the camera that a person can be detected, observed, recognized, and identified. The identification range is the most relevant here, and the distance listed by the camera is the furthest that face recognition will realistically work.
|
||||||
|
|
||||||
Some users have also noted that setting the stream in camera firmware to a constant bit rate (CBR) leads to better image clarity than with a variable bit rate (VBR).
|
Some users have also noted that setting the stream in camera firmware to a constant bit rate (CBR) leads to better image clarity than with a variable bit rate (VBR).
|
||||||
|
|
||||||
### Why can't I bulk upload photos?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="can-i-train-faces-for-people-who-only-appear-at-night" question="Can I train faces for people who only appear at night?">
|
||||||
|
|
||||||
|
The embedding models are trained on color images, so gray-scale and infrared (IR) faces sit in a different feature distribution and are more easily confused with other people. Prefer color images, and avoid mixing gray-scale samples in early while you are building a foundation. If someone only ever appears at night, gray-scale training is acceptable, but keep those samples limited and as clear as possible, and add them only once color recognition is stable for your other people.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="why-cant-i-bulk-upload-photos" question="Why can't I bulk upload photos?">
|
||||||
|
|
||||||
It is important to methodically add photos to the library, bulk importing photos (especially from a general photo library) will lead to over-fitting in that particular scenario and hurt recognition performance.
|
It is important to methodically add photos to the library, bulk importing photos (especially from a general photo library) will lead to over-fitting in that particular scenario and hurt recognition performance.
|
||||||
|
|
||||||
### Why can't I bulk reprocess faces?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="why-cant-i-bulk-reprocess-faces" question="Why can't I bulk reprocess faces?">
|
||||||
|
|
||||||
Face embedding models work by breaking apart faces into different features. This means that when reprocessing an image, only images from a similar angle will have its score affected.
|
Face embedding models work by breaking apart faces into different features. This means that when reprocessing an image, only images from a similar angle will have its score affected.
|
||||||
|
|
||||||
### Why do unknown people score similarly to known people?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="why-do-unknown-people-score-similarly-to-known-people" question="Why do unknown people score similarly to known people?">
|
||||||
|
|
||||||
This can happen for a few different reasons, but this is usually an indicator that the training set needs to be improved. This is often related to over-fitting:
|
This can happen for a few different reasons, but this is usually an indicator that the training set needs to be improved. This is often related to over-fitting:
|
||||||
|
|
||||||
@@ -243,31 +312,52 @@ Review your face collections and remove most of the unclear or low-quality image
|
|||||||
|
|
||||||
Avoid training on images that already score highly, as this can lead to over-fitting. Instead, focus on relatively clear images that score lower (ideally with different lighting, angles, and conditions) to help the model generalize more effectively.
|
Avoid training on images that already score highly, as this can lead to over-fitting. Instead, focus on relatively clear images that score lower (ideally with different lighting, angles, and conditions) to help the model generalize more effectively.
|
||||||
|
|
||||||
### Frigate misidentified a face. Can I tell it that a face is "not" a specific person?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="should-i-correct-a-face-that-was-recognized-as-the-wrong-person" question="Should I correct a face that was recognized as the wrong person?">
|
||||||
|
|
||||||
|
Only if it is a good image. Reassigning a face does add it to that person's training set, but two things are true at once:
|
||||||
|
|
||||||
|
- Reassigning a single misclassified frame has a small effect. The image is weighted against every other sample for that person, so correcting 1 frame out of 20 will not move recognition much. Occasional wrong guesses on poor frames are normal and do not need to be fixed.
|
||||||
|
- Reassigning a poor image (blurry, off-angle, low-resolution, gray-scale) can hurt more than the misidentification did, because low-quality samples degrade recognition for that whole person.
|
||||||
|
|
||||||
|
So the decision is about image quality, not about the wrong label. If the crop is clear, well-lit, and reasonably front-facing, and it scored low or was wrong, assigning it to the correct person is useful. If you can barely make out the face yourself, ignore it; do not train it just to correct the label.
|
||||||
|
|
||||||
|
If a person is repeatedly misidentified, do not keep reassigning the same frame. Instead, remove low-quality or misleading images and add a few high-quality samples to the correct person. See [Why do unknown people score similarly to known people?](#why-do-unknown-people-score-similarly-to-known-people) above.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="frigate-misidentified-a-face-can-i-tell-it-that-a-face-is-not-a-specific-person" question={'Frigate misidentified a face. Can I tell it that a face is "not" a specific person?'}>
|
||||||
|
|
||||||
No, face recognition does not support negative training (i.e., explicitly telling it who someone is _not_). Instead, the best approach is to improve the training data by using a more diverse and representative set of images for each person.
|
No, face recognition does not support negative training (i.e., explicitly telling it who someone is _not_). Instead, the best approach is to improve the training data by using a more diverse and representative set of images for each person.
|
||||||
For more guidance, refer to the section above on improving recognition accuracy.
|
For more guidance, refer to the section above on improving recognition accuracy.
|
||||||
|
|
||||||
### I see scores above the threshold in the Recent Recognitions tab, but a sub label wasn't assigned?
|
This also applies to a stranger who is repeatedly matched to a known person (for example, a delivery driver recognized as you). Do not create a profile for them and do not reassign their faces to yourself, as this pollutes your training set and makes recognition worse. Leave the detection as unknown and improve the known person's training set instead. Face recognition learns who someone is, not who they are not.
|
||||||
|
|
||||||
The Frigate considers the recognition scores across all recognition attempts for each person object. The scores are continually weighted based on the area of the face, and a sub label will only be assigned to person if a person is confidently recognized consistently. This avoids cases where a single high confidence recognition would throw off the results.
|
</FaqItem>
|
||||||
|
|
||||||
### Can I use other face recognition software like DoubleTake at the same time as the built in face recognition?
|
<FaqItem id="i-see-scores-above-the-threshold-in-the-recent-recognitions-tab-but-a-sub-label-wasnt-assigned" question="I see scores above the threshold in the Recent Recognitions tab, but a sub label wasn't assigned?">
|
||||||
|
|
||||||
|
Frigate considers the recognition scores across all recognition attempts for each person object. The scores are continually weighted based on the area of the face, and a sub label will only be assigned to person if a person is confidently recognized consistently. This avoids cases where a single high confidence recognition would throw off the results.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
### Compatibility and Maintenance
|
||||||
|
|
||||||
|
<FaqItem id="can-i-use-other-face-recognition-software-like-doubletake-at-the-same-time-as-the-built-in-face-recognition" question="Can I use other face recognition software like DoubleTake at the same time as the built in face recognition?">
|
||||||
|
|
||||||
No, using another face recognition service will interfere with Frigate's built in face recognition. When using double-take the sub_label feature must be disabled if the built in face recognition is also desired.
|
No, using another face recognition service will interfere with Frigate's built in face recognition. When using double-take the sub_label feature must be disabled if the built in face recognition is also desired.
|
||||||
|
|
||||||
### Does face recognition run on the recording stream?
|
</FaqItem>
|
||||||
|
|
||||||
Face recognition does not run on the recording stream, this would be suboptimal for many reasons:
|
<FaqItem id="i-get-an-unknown-error-when-taking-a-photo-directly-with-my-iphone" question="I get an unknown error when taking a photo directly with my iPhone">
|
||||||
|
|
||||||
1. The latency of accessing the recordings means the notifications would not include the names of recognized people because recognition would not complete until after.
|
|
||||||
2. The embedding models used run on a set image size, so larger images will be scaled down to match this anyway.
|
|
||||||
3. Motion clarity is much more important than extra pixels, over-compression and motion blur are much more detrimental to results than resolution.
|
|
||||||
|
|
||||||
### I get an unknown error when taking a photo directly with my iPhone
|
|
||||||
|
|
||||||
By default iOS devices will use HEIC (High Efficiency Image Container) for images, but this format is not supported for uploads. Choosing `large` as the format instead of `original` will use JPG which will work correctly.
|
By default iOS devices will use HEIC (High Efficiency Image Container) for images, but this format is not supported for uploads. Choosing `large` as the format instead of `original` will use JPG which will work correctly.
|
||||||
|
|
||||||
### How can I delete the face database and start over?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="how-can-i-delete-the-face-database-and-start-over" question="How can I delete the face database and start over?">
|
||||||
|
|
||||||
Frigate does not store anything in its database related to face recognition. You can simply delete all of your faces through the Frigate UI or remove the contents of the `/media/frigate/clips/faces` directory.
|
Frigate does not store anything in its database related to face recognition. You can simply delete all of your faces through the Frigate UI or remove the contents of the `/media/frigate/clips/faces` directory.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|||||||
@@ -9,9 +9,27 @@ import NavPath from "@site/src/components/NavPath";
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
A Generative AI provider can be configured in the global config, which will make the Generative AI features available for use. There are currently 4 native providers available to integrate with Frigate. Other providers that support the OpenAI standard API can also be used. See the OpenAI-Compatible section below.
|
A Generative AI provider can be configured in the global config, which will make the Generative AI features available for use. There are currently 5 native providers available to integrate with Frigate. Other providers that support the OpenAI standard API can also be used. See the OpenAI-Compatible section below.
|
||||||
|
|
||||||
To use Generative AI, you must define a single provider at the global level of your Frigate configuration. If the provider you choose requires an API key, you may either directly paste it in your configuration, or store it in an environment variable prefixed with `FRIGATE_`.
|
`genai` is a map of named providers. Each key under `genai` is a name you choose, and its value is that provider's settings:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
genai:
|
||||||
|
my_provider: # any name you like
|
||||||
|
provider: ollama
|
||||||
|
base_url: http://localhost:11434
|
||||||
|
model: qwen3-vl:4b
|
||||||
|
roles:
|
||||||
|
- descriptions
|
||||||
|
- embeddings
|
||||||
|
- chat
|
||||||
|
```
|
||||||
|
|
||||||
|
The examples on this page all use `my_provider`, but the name is arbitrary and is only used to reference the provider elsewhere in the config (for example, `semantic_search.model`).
|
||||||
|
|
||||||
|
Each provider handles one or more **roles**: `chat`, `descriptions`, and `embeddings`. A provider handles all three by default, and each role may be assigned to exactly one provider. Define a single provider if you want it to do everything, or split the roles across several providers using the `roles` option.
|
||||||
|
|
||||||
|
If the provider you choose requires an API key, you may either directly paste it in your configuration, or store it in an environment variable prefixed with `FRIGATE_`.
|
||||||
|
|
||||||
## Local Providers
|
## Local Providers
|
||||||
|
|
||||||
@@ -78,23 +96,26 @@ All llama.cpp native options can be passed through `provider_options`, including
|
|||||||
- Set **Provider** to `llamacpp`
|
- Set **Provider** to `llamacpp`
|
||||||
- Set **Base URL** to your llama.cpp server address (e.g., `http://localhost:8080`)
|
- Set **Base URL** to your llama.cpp server address (e.g., `http://localhost:8080`)
|
||||||
- Set **Model** to the name of your model
|
- Set **Model** to the name of your model
|
||||||
- Under **Provider Options**, set `context_size` to tell Frigate your context size so it can send the appropriate amount of information
|
- Optionally, under **Provider Options**, set `context_size` to override the context size Frigate detects from the server
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="yaml">
|
<TabItem value="yaml">
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: llamacpp
|
my_provider:
|
||||||
base_url: http://localhost:8080
|
provider: llamacpp
|
||||||
model: your-model-name
|
base_url: http://localhost:8080
|
||||||
provider_options:
|
model: your-model-name
|
||||||
context_size: 16000 # Tell Frigate your context size so it can send the appropriate amount of information.
|
provider_options:
|
||||||
|
context_size: 16000 # Optional, overrides the context size reported by the server.
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</ConfigTabs>
|
</ConfigTabs>
|
||||||
|
|
||||||
|
Frigate queries the llama.cpp server for the model's context size at startup and logs it along with the other detected capabilities. If `context_size` is set in `provider_options`, that value is always used instead, even when the server reports its own.
|
||||||
|
|
||||||
### Ollama
|
### Ollama
|
||||||
|
|
||||||
[Ollama](https://ollama.com/) allows you to self-host large language models and keep everything running locally. It is highly recommended to host this server on a machine with an Nvidia graphics card, or on a Apple silicon Mac for best performance.
|
[Ollama](https://ollama.com/) allows you to self-host large language models and keep everything running locally. It is highly recommended to host this server on a machine with an Nvidia graphics card, or on a Apple silicon Mac for best performance.
|
||||||
@@ -127,13 +148,14 @@ Note that Frigate will not automatically download the model you specify in your
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: ollama
|
my_provider:
|
||||||
base_url: http://localhost:11434
|
provider: ollama
|
||||||
model: qwen3-vl:4b
|
base_url: http://localhost:11434
|
||||||
provider_options: # other Ollama client options can be defined
|
model: qwen3-vl:4b
|
||||||
keep_alive: -1
|
provider_options: # other Ollama client options can be defined
|
||||||
options:
|
keep_alive: -1
|
||||||
num_ctx: 8192 # make sure the context matches other services that are using ollama
|
options:
|
||||||
|
num_ctx: 8192 # make sure the context matches other services that are using ollama
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -149,11 +171,12 @@ For OpenAI-compatible servers (such as llama.cpp) that don't expose the configur
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: openai
|
my_provider:
|
||||||
base_url: http://your-llama-server
|
provider: openai
|
||||||
model: your-model-name
|
base_url: http://your-llama-server
|
||||||
provider_options:
|
model: your-model-name
|
||||||
context_size: 8192 # Specify the configured context size
|
provider_options:
|
||||||
|
context_size: 8192 # Specify the configured context size
|
||||||
```
|
```
|
||||||
|
|
||||||
This ensures Frigate uses the correct context window size when generating prompts.
|
This ensures Frigate uses the correct context window size when generating prompts.
|
||||||
@@ -176,10 +199,11 @@ This ensures Frigate uses the correct context window size when generating prompt
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: openai
|
my_provider:
|
||||||
base_url: http://your-server:port
|
provider: openai
|
||||||
api_key: your-api-key # May not be required for local servers
|
base_url: http://your-server:port
|
||||||
model: your-model-name
|
api_key: your-api-key # May not be required for local servers
|
||||||
|
model: your-model-name
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -217,19 +241,21 @@ Ollama also supports [cloud models](https://ollama.com/cloud), where model infer
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: ollama
|
my_provider:
|
||||||
base_url: http://localhost:11434
|
provider: ollama
|
||||||
model: cloud-model-name
|
base_url: http://localhost:11434
|
||||||
|
model: cloud-model-name
|
||||||
```
|
```
|
||||||
|
|
||||||
or when using Ollama Cloud directly
|
or when using Ollama Cloud directly
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: ollama
|
my_provider:
|
||||||
base_url: https://ollama.com
|
provider: ollama
|
||||||
model: cloud-model-name
|
base_url: https://ollama.com
|
||||||
api_key: your-api-key
|
model: cloud-model-name
|
||||||
|
api_key: your-api-key
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -267,9 +293,10 @@ To start using Gemini, you must first get an API key from [Google AI Studio](htt
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: gemini
|
my_provider:
|
||||||
api_key: "{FRIGATE_GEMINI_API_KEY}"
|
provider: gemini
|
||||||
model: gemini-2.5-flash
|
api_key: "{FRIGATE_GEMINI_API_KEY}"
|
||||||
|
model: gemini-2.5-flash
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -279,12 +306,13 @@ genai:
|
|||||||
|
|
||||||
To use a different Gemini-compatible API endpoint, set the `provider_options` with the `base_url` key to your provider's API URL. For example:
|
To use a different Gemini-compatible API endpoint, set the `provider_options` with the `base_url` key to your provider's API URL. For example:
|
||||||
|
|
||||||
```yaml {4,5}
|
```yaml {5,6}
|
||||||
genai:
|
genai:
|
||||||
provider: gemini
|
my_provider:
|
||||||
...
|
provider: gemini
|
||||||
provider_options:
|
...
|
||||||
base_url: https://...
|
provider_options:
|
||||||
|
base_url: https://...
|
||||||
```
|
```
|
||||||
|
|
||||||
Other HTTP options are available, see the [python-genai documentation](https://github.com/googleapis/python-genai).
|
Other HTTP options are available, see the [python-genai documentation](https://github.com/googleapis/python-genai).
|
||||||
@@ -318,9 +346,10 @@ To start using OpenAI, you must first [create an API key](https://platform.opena
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: openai
|
my_provider:
|
||||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
provider: openai
|
||||||
model: gpt-4o
|
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||||
|
model: gpt-4o
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -336,13 +365,14 @@ To use a different OpenAI-compatible API endpoint, set the `OPENAI_BASE_URL` env
|
|||||||
|
|
||||||
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`:
|
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 {5,6}
|
```yaml {6,7}
|
||||||
genai:
|
genai:
|
||||||
provider: openai
|
my_provider:
|
||||||
base_url: http://your-llama-server
|
provider: openai
|
||||||
model: your-model-name
|
base_url: http://your-llama-server
|
||||||
provider_options:
|
model: your-model-name
|
||||||
context_size: 8192 # Specify the configured context size
|
provider_options:
|
||||||
|
context_size: 8192 # Specify the configured context size
|
||||||
```
|
```
|
||||||
|
|
||||||
This ensures Frigate uses the correct context window size when generating prompts.
|
This ensures Frigate uses the correct context window size when generating prompts.
|
||||||
@@ -377,10 +407,11 @@ To start using Azure OpenAI, you must first [create a resource](https://learn.mi
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: azure_openai
|
my_provider:
|
||||||
base_url: https://instance.cognitiveservices.azure.com/openai/responses?api-version=2025-04-01-preview
|
provider: azure_openai
|
||||||
model: gpt-5-mini
|
base_url: https://instance.cognitiveservices.azure.com/openai/responses?api-version=2025-04-01-preview
|
||||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
model: gpt-5-mini
|
||||||
|
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -52,9 +52,10 @@ You can define custom prompts at the global level and per-object type. To config
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
genai:
|
genai:
|
||||||
provider: ollama
|
my_provider:
|
||||||
base_url: http://localhost:11434
|
provider: ollama
|
||||||
model: qwen3-vl:8b-instruct
|
base_url: http://localhost:11434
|
||||||
|
model: qwen3-vl:8b-instruct
|
||||||
|
|
||||||
objects:
|
objects:
|
||||||
genai:
|
genai:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Frigate uses the bundled go2rtc to power a number of key features:
|
|||||||
|
|
||||||
:::tip[Most users no longer need to configure go2rtc by hand]
|
:::tip[Most users no longer need to configure go2rtc by hand]
|
||||||
|
|
||||||
The **camera setup wizard** is the recommended way to add cameras. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />, and the wizard probes your camera and writes its configuration for you, including the go2rtc restream and the live stream mapping, so go2rtc is set up automatically.
|
The [**camera setup wizard**](cameras.md#adding-a-camera-with-the-add-camera-wizard) is the recommended way to add cameras. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />, and the wizard probes your camera and writes its configuration for you, including the go2rtc restream and the live stream mapping, so go2rtc is set up automatically.
|
||||||
|
|
||||||
This guide is mainly useful if you are **upgrading from an older version and have existing cameras that don't yet use go2rtc**, or if you want to fine-tune a stream by hand (for example, to transcode a codec your browser can't play). The [go2rtc troubleshooting guide](/troubleshooting/go2rtc) applies regardless of how your cameras were added.
|
This guide is mainly useful if you are **upgrading from an older version and have existing cameras that don't yet use go2rtc**, or if you want to fine-tune a stream by hand (for example, to transcode a codec your browser can't play). The [go2rtc troubleshooting guide](/troubleshooting/go2rtc) applies regardless of how your cameras were added.
|
||||||
|
|
||||||
@@ -67,4 +67,4 @@ If your stream won't play, has no audio, uses excessive CPU, or otherwise misbeh
|
|||||||
|
|
||||||
## Homekit Configuration
|
## Homekit Configuration
|
||||||
|
|
||||||
To add camera streams to Homekit Frigate must be configured in docker to use `host` networking mode. Once that is done, you can use the go2rtc WebUI (accessed via port 1984, which is disabled by default) to share export a camera to Homekit. Any changes made will automatically be saved to `/config/go2rtc_homekit.yml`.
|
To add camera streams to Homekit Frigate must be configured in docker to use `host` networking mode. Once that is done, you can use the go2rtc WebUI (accessed via port 1984, which is disabled by default) to export a camera to Homekit. Any changes made will automatically be saved to `/config/go2rtc_homekit.yml`.
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ Error marking filters as finished
|
|||||||
Restarting ffmpeg...
|
Restarting ffmpeg...
|
||||||
```
|
```
|
||||||
|
|
||||||
you should try to uprade to FFmpeg 7. This can be done using this config option:
|
you should try to upgrade to FFmpeg 7. This can be done using this config option:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
ffmpeg:
|
ffmpeg:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ title: License Plate Recognition (LPR)
|
|||||||
import ConfigTabs from "@site/src/components/ConfigTabs";
|
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||||
import TabItem from "@theme/TabItem";
|
import TabItem from "@theme/TabItem";
|
||||||
import NavPath from "@site/src/components/NavPath";
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
import FaqItem from "@site/src/components/FaqItem";
|
||||||
|
|
||||||
Frigate can recognize license plates on vehicles and automatically add the detected characters to the `recognized_license_plate` field or a [known](#matching) name as a `sub_label` to tracked objects of type `car` or `motorcycle`. A common use case may be to read the license plates of cars pulling into a driveway or cars passing by on a street.
|
Frigate can recognize license plates on vehicles and automatically add the detected characters to the `recognized_license_plate` field or a [known](#matching) name as a `sub_label` to tracked objects of type `car` or `motorcycle`. A common use case may be to read the license plates of cars pulling into a driveway or cars passing by on a street.
|
||||||
|
|
||||||
@@ -591,7 +592,9 @@ By selecting the appropriate configuration, users can optimize their dedicated L
|
|||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### Why isn't my license plate being detected and recognized?
|
### Detection and Recognition
|
||||||
|
|
||||||
|
<FaqItem id="why-isnt-my-license-plate-being-detected-and-recognized" question="Why isn't my license plate being detected and recognized?">
|
||||||
|
|
||||||
Ensure that:
|
Ensure that:
|
||||||
|
|
||||||
@@ -606,29 +609,43 @@ Recognized plates will show as object labels in the debug view and will appear i
|
|||||||
|
|
||||||
If you are still having issues detecting plates, start with a basic configuration and see the debugging tips below.
|
If you are still having issues detecting plates, start with a basic configuration and see the debugging tips below.
|
||||||
|
|
||||||
### Can I run LPR without detecting `car` or `motorcycle` objects?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="can-i-run-lpr-without-detecting-car-or-motorcycle-objects" question={<>Can I run LPR without detecting <code>car</code> or <code>motorcycle</code> objects?</>}>
|
||||||
|
|
||||||
In normal LPR mode, Frigate requires a `car` or `motorcycle` to be detected first before recognizing a license plate. If you have a dedicated LPR camera, you can change the camera `type` to `"lpr"` to use the Dedicated LPR Camera algorithm. This comes with important caveats, though. See the [Dedicated LPR Cameras](#dedicated-lpr-cameras) section above.
|
In normal LPR mode, Frigate requires a `car` or `motorcycle` to be detected first before recognizing a license plate. If you have a dedicated LPR camera, you can change the camera `type` to `"lpr"` to use the Dedicated LPR Camera algorithm. This comes with important caveats, though. See the [Dedicated LPR Cameras](#dedicated-lpr-cameras) section above.
|
||||||
|
|
||||||
### How can I improve detection accuracy?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="how-can-i-improve-detection-accuracy" question="How can I improve detection accuracy?">
|
||||||
|
|
||||||
- Use high-quality cameras with good resolution.
|
- Use high-quality cameras with good resolution.
|
||||||
- Adjust `detection_threshold` and `recognition_threshold` values.
|
- Adjust `detection_threshold` and `recognition_threshold` values.
|
||||||
- Define a `format` regex to filter out invalid detections.
|
- Define a `format` regex to filter out invalid detections.
|
||||||
|
|
||||||
### Does LPR work at night?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="does-lpr-work-at-night" question="Does LPR work at night?">
|
||||||
|
|
||||||
Yes, but performance depends on camera quality, lighting, and infrared capabilities. Make sure your camera can capture clear images of plates at night.
|
Yes, but performance depends on camera quality, lighting, and infrared capabilities. Make sure your camera can capture clear images of plates at night.
|
||||||
|
|
||||||
### Can I limit LPR to specific zones?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="can-i-limit-lpr-to-specific-zones" question="Can I limit LPR to specific zones?">
|
||||||
|
|
||||||
LPR, like other Frigate enrichments, runs at the camera level rather than the zone level. While you can't restrict LPR to specific zones directly, you can control when recognition runs by setting a `min_area` value to filter out smaller detections.
|
LPR, like other Frigate enrichments, runs at the camera level rather than the zone level. While you can't restrict LPR to specific zones directly, you can control when recognition runs by setting a `min_area` value to filter out smaller detections.
|
||||||
|
|
||||||
### How can I match known plates with minor variations?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="how-can-i-match-known-plates-with-minor-variations" question="How can I match known plates with minor variations?">
|
||||||
|
|
||||||
Use `match_distance` to allow small character mismatches. Alternatively, define multiple variations in `known_plates`.
|
Use `match_distance` to allow small character mismatches. Alternatively, define multiple variations in `known_plates`.
|
||||||
|
|
||||||
### How do I debug LPR issues?
|
</FaqItem>
|
||||||
|
|
||||||
|
### Performance and Troubleshooting
|
||||||
|
|
||||||
|
<FaqItem id="how-do-i-debug-lpr-issues" question="How do I debug LPR issues?">
|
||||||
|
|
||||||
Start with ["Why isn't my license plate being detected and recognized?"](#why-isnt-my-license-plate-being-detected-and-recognized). If you are still having issues, work through these steps.
|
Start with ["Why isn't my license plate being detected and recognized?"](#why-isnt-my-license-plate-being-detected-and-recognized). If you are still having issues, work through these steps.
|
||||||
|
|
||||||
@@ -685,17 +702,23 @@ lpr:
|
|||||||
- Watch the debug view to see plates recognized in real-time. For non-dedicated LPR cameras, the `car` or `motorcycle` label will change to the recognized plate when LPR is enabled and working.
|
- Watch the debug view to see plates recognized in real-time. For non-dedicated LPR cameras, the `car` or `motorcycle` label will change to the recognized plate when LPR is enabled and working.
|
||||||
- Adjust `recognition_threshold` settings per the suggestions [above](#advanced-configuration).
|
- Adjust `recognition_threshold` settings per the suggestions [above](#advanced-configuration).
|
||||||
|
|
||||||
### Will LPR slow down my system?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="will-lpr-slow-down-my-system" question="Will LPR slow down my system?">
|
||||||
|
|
||||||
LPR's performance impact depends on your hardware. Ensure you have at least 4GB RAM and a capable CPU or GPU for optimal results. If you are running the Dedicated LPR Camera mode, resource usage will be higher compared to users who run a model that natively detects license plates. Tune your motion detection settings for your dedicated LPR camera so that the license plate detection model runs only when necessary.
|
LPR's performance impact depends on your hardware. Ensure you have at least 4GB RAM and a capable CPU or GPU for optimal results. If you are running the Dedicated LPR Camera mode, resource usage will be higher compared to users who run a model that natively detects license plates. Tune your motion detection settings for your dedicated LPR camera so that the license plate detection model runs only when necessary.
|
||||||
|
|
||||||
### I am seeing a YOLOv9 plate detection metric in Enrichment Metrics, but I have a Frigate+ or custom model that detects `license_plate`. Why is the YOLOv9 model running?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="i-am-seeing-a-yolov9-plate-detection-metric-in-enrichment-metrics-but-i-have-a-frigate-or-custom-model-that-detects-license_plate-why-is-the-yolov9-model-running" question={<>I am seeing a YOLOv9 plate detection metric in Enrichment Metrics, but I have a Frigate+ or custom model that detects <code>license_plate</code>. Why is the YOLOv9 model running?</>}>
|
||||||
|
|
||||||
The YOLOv9 license plate detector model will run (and the metric will appear) if you've enabled LPR but haven't defined `license_plate` as an object to track, either at the global or camera level.
|
The YOLOv9 license plate detector model will run (and the metric will appear) if you've enabled LPR but haven't defined `license_plate` as an object to track, either at the global or camera level.
|
||||||
|
|
||||||
If you are detecting `car` or `motorcycle` on cameras where you don't want to run LPR, make sure you disable LPR it at the camera level. And if you do want to run LPR on those cameras, make sure you define `license_plate` as an object to track.
|
If you are detecting `car` or `motorcycle` on cameras where you don't want to run LPR, make sure you disable LPR it at the camera level. And if you do want to run LPR on those cameras, make sure you define `license_plate` as an object to track.
|
||||||
|
|
||||||
### It looks like Frigate picked up my camera's timestamp or overlay text as the license plate. How can I prevent this?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="it-looks-like-frigate-picked-up-my-cameras-timestamp-or-overlay-text-as-the-license-plate-how-can-i-prevent-this" question="It looks like Frigate picked up my camera's timestamp or overlay text as the license plate. How can I prevent this?">
|
||||||
|
|
||||||
This could happen if cars or motorcycles travel close to your camera's timestamp or overlay text. You could either move the text through your camera's firmware, or apply a mask to it in Frigate.
|
This could happen if cars or motorcycles travel close to your camera's timestamp or overlay text. You could either move the text through your camera's firmware, or apply a mask to it in Frigate.
|
||||||
|
|
||||||
@@ -703,6 +726,10 @@ If you are using a model that natively detects `license_plate`, add an _object m
|
|||||||
|
|
||||||
If you are not using a model that natively detects `license_plate` or you are using dedicated LPR camera mode, only a _motion mask_ over your text is required.
|
If you are not using a model that natively detects `license_plate` or you are using dedicated LPR camera mode, only a _motion mask_ over your text is required.
|
||||||
|
|
||||||
### I see "Error running ... model" in my logs, or my inference time is very high. How can I fix this?
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="i-see-error-running--model-in-my-logs-or-my-inference-time-is-very-high-how-can-i-fix-this" question={'I see "Error running ... model" in my logs, or my inference time is very high. How can I fix this?'}>
|
||||||
|
|
||||||
This usually happens when your GPU is unable to compile or use one of the LPR models. Set your `device` to `CPU` and try again. GPU acceleration only provides a slight performance increase, and the models are lightweight enough to run without issue on most CPUs.
|
This usually happens when your GPU is unable to compile or use one of the LPR models. Set your `device` to `CPU` and try again. GPU acceleration only provides a slight performance increase, and the models are lightweight enough to run without issue on most CPUs.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|||||||
+123
-67
@@ -6,6 +6,7 @@ title: Live View
|
|||||||
import ConfigTabs from "@site/src/components/ConfigTabs";
|
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||||
import TabItem from "@theme/TabItem";
|
import TabItem from "@theme/TabItem";
|
||||||
import NavPath from "@site/src/components/NavPath";
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
import FaqItem from "@site/src/components/FaqItem";
|
||||||
|
|
||||||
Frigate intelligently displays your camera streams on the Live view dashboard. By default, Frigate employs "smart streaming" where camera images update once per minute when no detectable activity is occurring to conserve bandwidth and resources. As soon as any motion or active objects are detected, cameras seamlessly switch to a live stream.
|
Frigate intelligently displays your camera streams on the Live view dashboard. By default, Frigate employs "smart streaming" where camera images update once per minute when no detectable activity is occurring to conserve bandwidth and resources. As soon as any motion or active objects are detected, cameras seamlessly switch to a live stream.
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ If you are using go2rtc, you should adjust the following settings in your camera
|
|||||||
|
|
||||||
- Video codec: **H.264** - provides the most compatible video codec with all Live view technologies and browsers. Avoid any kind of "smart codec" or "+" codec like _H.264+_ or _H.265+_. as these non-standard codecs remove keyframes (see below).
|
- Video codec: **H.264** - provides the most compatible video codec with all Live view technologies and browsers. Avoid any kind of "smart codec" or "+" codec like _H.264+_ or _H.265+_. as these non-standard codecs remove keyframes (see below).
|
||||||
- Audio codec: **AAC** - provides the most compatible audio codec with all Live view technologies and browsers that support audio.
|
- Audio codec: **AAC** - provides the most compatible audio codec with all Live view technologies and browsers that support audio.
|
||||||
- I-frame interval (sometimes called the keyframe interval, the interframe space, or the GOP length): match your camera's frame rate, or choose "1x" (for interframe space on Reolink cameras). For example, if your stream outputs 20fps, your i-frame interval should be 20 (or 1x on Reolink). Values higher than the frame rate will cause the stream to take longer to begin playback. See [this page](https://gardinal.net/understanding-the-keyframe-interval/) for more on keyframes. For many users this may not be an issue, but it should be noted that a 1x i-frame interval will cause more storage utilization if you are using the stream for the `record` role as well.
|
- I-frame interval (sometimes called the keyframe interval, the interframe space, or the GOP length): match your camera's frame rate, or choose "1x" (for interframe space on Reolink cameras). For example, if your stream outputs 20fps, your i-frame interval should be 20 (or 1x on Reolink). Values higher than the frame rate will cause the stream to take longer to begin playback. See [this page](https://web.archive.org/web/20251213190836/https://gardinal.net/understanding-the-keyframe-interval/) for more on keyframes. For many users this may not be an issue, but it should be noted that a 1x i-frame interval will cause more storage utilization if you are using the stream for the `record` role as well.
|
||||||
|
|
||||||
The default video and audio codec on your camera may not always be compatible with your browser, which is why setting them to H.264 and AAC is recommended. See the [go2rtc docs](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#codecs-madness) for codec support information.
|
The default video and audio codec on your camera may not always be compatible with your browser, which is why setting them to H.264 and AAC is recommended. See the [go2rtc docs](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#codecs-madness) for codec support information.
|
||||||
|
|
||||||
@@ -195,7 +196,7 @@ services:
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.8.3#module-webrtc) for more information about this.
|
See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.9.14#module-webrtc) for more information about this.
|
||||||
|
|
||||||
### Two way talk
|
### Two way talk
|
||||||
|
|
||||||
@@ -341,100 +342,155 @@ When your browser runs into problems playing back your camera streams, it will l
|
|||||||
|
|
||||||
## Live view FAQ
|
## Live view FAQ
|
||||||
|
|
||||||
1. **Why don't I have audio in my Live view?**
|
### Getting Live View Working
|
||||||
|
|
||||||
You must use go2rtc to hear audio in your live streams. If you have go2rtc already configured, you need to ensure your camera is sending PCMA/PCMU or AAC audio. If you can't change your camera's audio codec, you need to [transcode the audio](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#source-ffmpeg) using go2rtc.
|
<FaqItem id="why-dont-i-have-audio-in-my-live-view" question="Why don't I have audio in my Live view?">
|
||||||
|
|
||||||
Note that the low bandwidth mode player is a video-only stream. You should not expect to hear audio when in low bandwidth mode, even if you've set up go2rtc.
|
You must use go2rtc to hear audio in your live streams. If you have go2rtc already configured, you need to ensure your camera is sending PCMA/PCMU or AAC audio. If you can't change your camera's audio codec, you need to [transcode the audio](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#source-ffmpeg) using go2rtc.
|
||||||
|
|
||||||
2. **Frigate shows that my live stream is in "low bandwidth mode". What does this mean?**
|
If the audio controls don't appear in the UI at all, verify that the Live view is actually using your go2rtc stream. If your go2rtc stream names don't match your Frigate camera name, you must map them with the `live -> streams` config (see [Setting Streams For Live UI](#setting-streams-for-live-ui) above); otherwise the UI falls back to the video-only jsmpeg player.
|
||||||
|
|
||||||
Frigate intelligently selects the live streaming technology based on a number of factors (user-selected modes like two-way talk, camera settings, browser capabilities, available bandwidth) and prioritizes showing an actual up-to-date live view of your camera's stream as quickly as possible.
|
Note that the low bandwidth mode player is a video-only stream. You should not expect to hear audio when in low bandwidth mode, even if you've set up go2rtc.
|
||||||
|
|
||||||
When you have go2rtc configured, Live view initially attempts to load and play back your stream with a clearer, fluent stream technology (MSE). An initial timeout, a low bandwidth condition that would cause buffering of the stream, or decoding errors in the stream will cause Frigate to switch to the stream defined by the `detect` role, using the jsmpeg format. This is what the UI labels as "low bandwidth mode". On Live dashboards, the mode will automatically reset when smart streaming is configured and activity stops. Continuous streaming mode does not have an automatic reset mechanism, but you can use the _Reset_ option to force a reload of your stream.
|
</FaqItem>
|
||||||
|
|
||||||
If you are using continuous streaming or you are loading more than a few high resolution streams at once on the dashboard, your browser may struggle to begin playback of your streams before the timeout. Frigate always prioritizes showing a live stream as quickly as possible, even if it is a lower quality jsmpeg stream. You can use the "Reset" link/button to try loading your high resolution stream again.
|
<FaqItem id="i-have-unmuted-some-cameras-on-my-dashboard-but-i-do-not-hear-sound-why" question="I have unmuted some cameras on my dashboard, but I do not hear sound. Why?">
|
||||||
|
|
||||||
Errors in stream playback (e.g., connection failures, codec issues, or buffering timeouts) that cause the fallback to low bandwidth mode (jsmpeg) are logged to the browser console for easier debugging. These errors may include:
|
If your camera is streaming (as indicated by a red dot in the upper right, or if it has been set to continuous streaming mode), your browser may be blocking audio until you interact with the page. This is an intentional browser limitation. See [this article](https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#autoplay_availability). Many browsers have a whitelist feature to change this behavior.
|
||||||
- Network issues (e.g., MSE or WebRTC network connection problems).
|
|
||||||
- Unsupported codecs or stream formats (e.g., H.265 in WebRTC, which is not supported in some browsers).
|
|
||||||
- Buffering timeouts or low bandwidth conditions causing fallback to jsmpeg.
|
|
||||||
- Browser compatibility problems (e.g., iOS Safari limitations with MSE).
|
|
||||||
|
|
||||||
To view browser console logs:
|
</FaqItem>
|
||||||
1. Open the Frigate Live View in your browser.
|
|
||||||
2. Open the browser's Developer Tools (F12 or right-click > Inspect > Console tab).
|
|
||||||
3. Reproduce the error (e.g., load a problematic stream or simulate network issues).
|
|
||||||
4. Look for messages prefixed with the camera name.
|
|
||||||
|
|
||||||
These logs help identify if the issue is player-specific (MSE vs. WebRTC) or related to camera configuration (e.g., go2rtc streams, codecs). If you see frequent errors:
|
<FaqItem id="my-live-view-shows-a-black-screen-or-doesnt-load-but-the-debug-view-works-why" question="My live view shows a black screen or doesn't load, but the debug view works. Why?">
|
||||||
- Verify your camera's H.264/AAC settings (see [Frigate's camera settings recommendations](#camera-settings-recommendations)).
|
|
||||||
- Check go2rtc configuration for transcoding (e.g., audio to AAC/OPUS).
|
|
||||||
- Test with a different stream via the UI dropdown (if `live -> streams` is configured).
|
|
||||||
- For WebRTC-specific issues, ensure port 8555 is forwarded and candidates are set (see [WebRTC Extra Configuration](#webrtc-extra-configuration)).
|
|
||||||
- If your cameras are streaming at a high resolution, your browser may be struggling to load all of the streams before the buffering timeout occurs. Frigate prioritizes showing a true live view as quickly as possible. If the fallback occurs often, change your live view settings to use a lower bandwidth substream.
|
|
||||||
|
|
||||||
3. **It doesn't seem like my cameras are streaming on the Live dashboard. Why?**
|
The debug view plays the `detect` stream processed by Frigate itself, while the Live view plays your go2rtc stream directly in the browser. If the debug view works but the Live view doesn't, your browser usually can't decode what the camera is sending, most often H.265 video or an incompatible audio track.
|
||||||
|
|
||||||
On the default Live dashboard ("All Cameras"), your camera images will update once per minute when no detectable activity is occurring to conserve bandwidth and resources. As soon as any activity is detected, cameras seamlessly switch to a full-resolution live stream. If you want to customize this behavior, use a camera group.
|
Work through the [go2rtc troubleshooting guide](/troubleshooting/go2rtc#live-view-is-black-buffering-or-stuck-in-low-bandwidth-mode) to isolate the problem. Two fixes resolve the majority of cases:
|
||||||
|
|
||||||
4. **I see a strange diagonal line on my live view, but my recordings look fine. How can I fix it?**
|
1. Restream through go2rtc's FFmpeg module by prefixing your source with `ffmpeg:`, for example `- ffmpeg:rtsp://user:password@192.168.1.5:554/stream`.
|
||||||
|
2. If that doesn't help, transcode to compatible codecs: `- ffmpeg:rtsp://user:password@192.168.1.5:554/stream#video=h264#audio=aac#hardware`.
|
||||||
|
|
||||||
This is caused by incorrect dimensions set in your detect width or height (or incorrectly auto-detected), causing the jsmpeg player's rendering engine to display a slightly distorted image. You should enlarge the width and height of your `detect` resolution up to a standard aspect ratio (example: 640x352 becomes 640x360, and 800x443 becomes 800x450, 2688x1520 becomes 2688x1512, etc). If changing the resolution to match a standard (4:3, 16:9, or 32:9, etc) aspect ratio does not solve the issue, you can enable "compatibility mode" in your camera group dashboard's stream settings. Depending on your browser and device, more than a few cameras in compatibility mode may not be supported, so only use this option if changing your `detect` width and height fails to resolve the color artifacts and diagonal line.
|
</FaqItem>
|
||||||
|
|
||||||
5. **How does "smart streaming" work?**
|
<FaqItem id="how-do-i-get-the-best-live-view-experience-in-home-assistant" question="How do I get the best live view experience in Home Assistant?">
|
||||||
|
|
||||||
Because a static image of a scene looks exactly the same as a live stream with no motion or activity, smart streaming updates your camera images once per minute when no detectable activity is occurring to conserve bandwidth and resources. As soon as any activity (motion or object/audio detection) occurs, cameras seamlessly switch to a live stream.
|
For a full-resolution, low-latency live view in Home Assistant dashboards, use the [Advanced Camera Card](https://card.camera) with the [go2rtc live provider](https://card.camera/#/configuration/cameras/live-provider?id=go2rtc), which streams directly from Frigate's bundled go2rtc. This also supports audio and [two-way talk](#two-way-talk) on capable cameras. See the [Home Assistant integration docs](/integrations/home-assistant) for setup.
|
||||||
|
|
||||||
This static image is pulled from the stream defined in your config with the `detect` role. When activity is detected, images from the `detect` stream immediately begin updating at ~5 frames per second so you can see the activity until the live player is loaded and begins playing. This usually only takes a second or two. If the live player times out, buffers, or has streaming errors, the jsmpeg player is loaded and plays a video-only stream from the `detect` role. When activity ends, the players are destroyed and a static image is displayed until activity is detected again, and the process repeats.
|
</FaqItem>
|
||||||
|
|
||||||
Smart streaming depends on having your camera's motion `threshold` and `contour_area` config values dialed in. Use the Motion Tuner in Settings in the UI to tune these values in real-time.
|
### Streaming Behavior
|
||||||
|
|
||||||
This is Frigate's default and recommended setting because it results in a significant bandwidth savings, especially for high resolution cameras.
|
<FaqItem id="how-does-smart-streaming-work" question={'How does "smart streaming" work?'}>
|
||||||
|
|
||||||
6. **I have unmuted some cameras on my dashboard, but I do not hear sound. Why?**
|
Because a static image of a scene looks exactly the same as a live stream with no motion or activity, smart streaming updates your camera images once per minute when no detectable activity is occurring to conserve bandwidth and resources. As soon as any activity (motion or object/audio detection) occurs, cameras seamlessly switch to a live stream.
|
||||||
|
|
||||||
If your camera is streaming (as indicated by a red dot in the upper right, or if it has been set to continuous streaming mode), your browser may be blocking audio until you interact with the page. This is an intentional browser limitation. See [this article](https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#autoplay_availability). Many browsers have a whitelist feature to change this behavior.
|
This static image is pulled from the stream defined in your config with the `detect` role. When activity is detected, images from the `detect` stream immediately begin updating at ~5 frames per second so you can see the activity until the live player is loaded and begins playing. This usually only takes a second or two. If the live player times out, buffers, or has streaming errors, the jsmpeg player is loaded and plays a video-only stream from the `detect` role. When activity ends, the players are destroyed and a static image is displayed until activity is detected again, and the process repeats.
|
||||||
|
|
||||||
7. **My camera streams have lots of visual artifacts / distortion.**
|
Smart streaming depends on having your camera's motion `threshold` and `contour_area` config values dialed in. Use the Motion Tuner in Settings in the UI to tune these values in real-time.
|
||||||
|
|
||||||
Some cameras don't include the hardware to support multiple connections to the high resolution stream, and this can cause unexpected behavior. In this case it is recommended to [restream](./restream.md) the high resolution stream so that it can be used for live view and recordings.
|
This is Frigate's default and recommended setting because it results in a significant bandwidth savings, especially for high resolution cameras.
|
||||||
|
|
||||||
8. **Why does my camera stream switch aspect ratios on the Live dashboard?**
|
</FaqItem>
|
||||||
|
|
||||||
Your camera may change aspect ratios on the dashboard because Frigate uses different streams for different purposes. With go2rtc and Smart Streaming, Frigate shows a static image from the `detect` stream when no activity is present, and switches to the live stream when motion is detected. The camera image will change size if your streams use different aspect ratios.
|
<FaqItem id="it-doesnt-seem-like-my-cameras-are-streaming-on-the-live-dashboard-why" question="It doesn't seem like my cameras are streaming on the Live dashboard. Why?">
|
||||||
|
|
||||||
To prevent this, make the `detect` stream match the go2rtc live stream's aspect ratio (resolution does not need to match, just the aspect ratio). You can either adjust the camera's output resolution or set the `width` and `height` values in your config's `detect` section to a resolution with an aspect ratio that matches.
|
On the default Live dashboard ("All Cameras"), your camera images will update once per minute when no detectable activity is occurring to conserve bandwidth and resources. As soon as any activity is detected, cameras seamlessly switch to a full-resolution live stream. If you want to customize this behavior, use a camera group.
|
||||||
|
|
||||||
Example: Resolutions from two streams
|
</FaqItem>
|
||||||
- Mismatched (may cause aspect ratio switching on the dashboard):
|
|
||||||
- Live/go2rtc stream: 1920x1080 (16:9)
|
|
||||||
- Detect stream: 640x352 (~1.82:1, not 16:9)
|
|
||||||
|
|
||||||
- Matched (prevents switching):
|
<FaqItem id="frigate-shows-that-my-live-stream-is-in-low-bandwidth-mode-what-does-this-mean" question={'Frigate shows that my live stream is in "low bandwidth mode". What does this mean?'}>
|
||||||
- Live/go2rtc stream: 1920x1080 (16:9)
|
|
||||||
- Detect stream: 640x360 (16:9)
|
|
||||||
|
|
||||||
You can update the detect settings in your camera config to match the aspect ratio of your go2rtc live stream. For example:
|
Frigate intelligently selects the live streaming technology based on a number of factors (user-selected modes like two-way talk, camera settings, browser capabilities, available bandwidth) and prioritizes showing an actual up-to-date live view of your camera's stream as quickly as possible.
|
||||||
|
|
||||||
```yaml
|
When you have go2rtc configured, Live view initially attempts to load and play back your stream with a clearer, fluent stream technology (MSE). An initial timeout, a low bandwidth condition that would cause buffering of the stream, or decoding errors in the stream will cause Frigate to switch to the stream defined by the `detect` role, using the jsmpeg format. This is what the UI labels as "low bandwidth mode". On Live dashboards, the mode will automatically reset when smart streaming is configured and activity stops. Continuous streaming mode does not have an automatic reset mechanism, but you can use the _Reset_ option to force a reload of your stream.
|
||||||
cameras:
|
|
||||||
front_door:
|
|
||||||
detect:
|
|
||||||
width: 640
|
|
||||||
height: 360 # set this to 360 instead of 352
|
|
||||||
ffmpeg:
|
|
||||||
inputs:
|
|
||||||
- path: rtsp://127.0.0.1:8554/front_door # main stream 1920x1080
|
|
||||||
roles:
|
|
||||||
- record
|
|
||||||
- path: rtsp://127.0.0.1:8554/front_door_sub # sub stream 640x352
|
|
||||||
roles:
|
|
||||||
- detect
|
|
||||||
```
|
|
||||||
|
|
||||||
The same applies to your `record` stream: if its aspect ratio differs from your `detect` stream, your recordings will appear in a different shape than the live view. For consistent framing across live view and recordings, use the same aspect ratio for all of a camera's streams (the resolution can still differ).
|
If you are using continuous streaming or you are loading more than a few high resolution streams at once on the dashboard, your browser may struggle to begin playback of your streams before the timeout. Frigate always prioritizes showing a live stream as quickly as possible, even if it is a lower quality jsmpeg stream. You can use the "Reset" link/button to try loading your high resolution stream again.
|
||||||
|
|
||||||
9. **Why does Frigate prefer MSE over WebRTC for live view?**
|
Errors in stream playback (e.g., connection failures, codec issues, or buffering timeouts) that cause the fallback to low bandwidth mode (jsmpeg) are logged to the browser console for easier debugging. These errors may include:
|
||||||
|
|
||||||
Frigate prefers MSE because it delivers a better out-of-the-box experience than WebRTC on nearly every axis that matters for a security camera system. MSE is an open standard optimized and supported by all modern browsers, works without any extra configuration (WebRTC requires port forwarding and candidate setup, and lacks H.265 support in some browsers), and requires no internet access for NAT traversal. More importantly, MSE runs over TCP, so every frame arrives and is decoded in order, so nothing is ever silently skipped. WebRTC optimizes for latency over UDP by discarding late or incomplete frames, which works against you on cellular or spotty Wi-Fi: you can end up with frozen video, visual corruption, or gaps in the feed without ever knowing you missed something. Frigate's enhanced MSE player has adaptive speed playback and has been tuned for latency and connection robustness that meets or exceeds WebRTC, so you get near-real-time playback with a guarantee that when the video plays, every frame is actually there - which, for an NVR whose whole purpose is letting you see what happened, matters more than shaving fractions of a second off a latency number. That's why Frigate defaults to MSE and reserves WebRTC for cases that require it, like two-way talk.
|
- Network issues (e.g., MSE or WebRTC network connection problems).
|
||||||
|
- Unsupported codecs or stream formats (e.g., H.265 in WebRTC, which is not supported in some browsers).
|
||||||
|
- Buffering timeouts or low bandwidth conditions causing fallback to jsmpeg.
|
||||||
|
- Browser compatibility problems (e.g., iOS Safari limitations with MSE).
|
||||||
|
|
||||||
|
To view browser console logs:
|
||||||
|
|
||||||
|
1. Open the Frigate Live View in your browser.
|
||||||
|
2. Open the browser's Developer Tools (F12 or right-click > Inspect > Console tab).
|
||||||
|
3. Reproduce the error (e.g., load a problematic stream or simulate network issues).
|
||||||
|
4. Look for messages prefixed with the camera name.
|
||||||
|
|
||||||
|
These logs help identify if the issue is player-specific (MSE vs. WebRTC) or related to camera configuration (e.g., go2rtc streams, codecs). If you see frequent errors:
|
||||||
|
|
||||||
|
- Verify your camera's H.264/AAC settings (see [Frigate's camera settings recommendations](#camera-settings-recommendations)).
|
||||||
|
- Check go2rtc configuration for transcoding (e.g., audio to AAC/OPUS).
|
||||||
|
- Test with a different stream via the UI dropdown (if `live -> streams` is configured).
|
||||||
|
- For WebRTC-specific issues, ensure port 8555 is forwarded and candidates are set (see [WebRTC Extra Configuration](#webrtc-extra-configuration)).
|
||||||
|
- If your cameras are streaming at a high resolution, your browser may be struggling to load all of the streams before the buffering timeout occurs. Frigate prioritizes showing a true live view as quickly as possible. If the fallback occurs often, change your live view settings to use a lower bandwidth substream.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="why-is-my-live-view-delayed-or-lagging-behind-real-time" question="Why is my live view delayed or lagging behind real time?">
|
||||||
|
|
||||||
|
A delay when a stream first starts is usually caused by your camera's I-frame (keyframe) interval. Playback cannot begin until a keyframe arrives, so an interval set higher than your camera's frame rate makes the stream take longer to start. Set the I-frame interval to match the frame rate (or "1x" on Reolink) per the [camera settings recommendations](#camera-settings-recommendations).
|
||||||
|
|
||||||
|
A stream that starts on time but falls further behind live is buffering, which is usually the browser struggling to decode too many high-resolution streams at once. Select a lower-bandwidth substream for your dashboards (see [Setting Streams For Live UI](#setting-streams-for-live-ui)), reduce the number of streams open at once, or improve the network connection between your browser and Frigate. Frigate's player automatically speeds up playback to catch up to live after buffering, and falls back to low bandwidth mode if it stalls for too long. The _Reset_ option forces a fresh connection at the live edge.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="why-does-frigate-prefer-mse-over-webrtc-for-live-view" question="Why does Frigate prefer MSE over WebRTC for live view?">
|
||||||
|
|
||||||
|
Frigate prefers MSE because it delivers a better out-of-the-box experience than WebRTC on nearly every axis that matters for a security camera system. MSE is an open standard optimized and supported by all modern browsers, works without any extra configuration (WebRTC requires port forwarding and candidate setup, and lacks H.265 support in some browsers), and requires no internet access for NAT traversal. More importantly, MSE runs over TCP, so every frame arrives and is decoded in order, so nothing is ever silently skipped. WebRTC optimizes for latency over UDP by discarding late or incomplete frames, which works against you on cellular or spotty Wi-Fi: you can end up with frozen video, visual corruption, or gaps in the feed without ever knowing you missed something. Frigate's enhanced MSE player has adaptive speed playback and has been tuned for latency and connection robustness that meets or exceeds WebRTC, so you get near-real-time playback with a guarantee that when the video plays, every frame is actually there - which, for an NVR whose whole purpose is letting you see what happened, matters more than shaving fractions of a second off a latency number. That's why Frigate defaults to MSE and reserves WebRTC for cases that require it, like two-way talk.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
### Video Quality Issues
|
||||||
|
|
||||||
|
<FaqItem id="i-see-a-strange-diagonal-line-on-my-live-view-but-my-recordings-look-fine-how-can-i-fix-it" question="I see a strange diagonal line on my live view, but my recordings look fine. How can I fix it?">
|
||||||
|
|
||||||
|
This is caused by incorrect dimensions set in your detect width or height (or incorrectly auto-detected), causing the jsmpeg player's rendering engine to display a slightly distorted image. You should enlarge the width and height of your `detect` resolution up to a standard aspect ratio (example: 640x352 becomes 640x360, and 800x443 becomes 800x450, 2688x1520 becomes 2688x1512, etc). If changing the resolution to match a standard (4:3, 16:9, or 32:9, etc) aspect ratio does not solve the issue, you can enable "compatibility mode" in your camera group dashboard's stream settings. Depending on your browser and device, more than a few cameras in compatibility mode may not be supported, so only use this option if changing your `detect` width and height fails to resolve the color artifacts and diagonal line.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="my-camera-streams-have-lots-of-visual-artifacts-or-distortion" question="My camera streams have lots of visual artifacts / distortion.">
|
||||||
|
|
||||||
|
Some cameras don't include the hardware to support multiple connections to the high resolution stream, and this can cause unexpected behavior. In this case it is recommended to [restream](./restream.md) the high resolution stream so that it can be used for live view and recordings.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="why-does-my-camera-stream-switch-aspect-ratios-on-the-live-dashboard" question="Why does my camera stream switch aspect ratios on the Live dashboard?">
|
||||||
|
|
||||||
|
Your camera may change aspect ratios on the dashboard because Frigate uses different streams for different purposes. With go2rtc and Smart Streaming, Frigate shows a static image from the `detect` stream when no activity is present, and switches to the live stream when motion is detected. The camera image will change size if your streams use different aspect ratios.
|
||||||
|
|
||||||
|
To prevent this, make the `detect` stream match the go2rtc live stream's aspect ratio (resolution does not need to match, just the aspect ratio). You can either adjust the camera's output resolution or set the `width` and `height` values in your config's `detect` section to a resolution with an aspect ratio that matches.
|
||||||
|
|
||||||
|
Example: Resolutions from two streams
|
||||||
|
|
||||||
|
- Mismatched (may cause aspect ratio switching on the dashboard):
|
||||||
|
- Live/go2rtc stream: 1920x1080 (16:9)
|
||||||
|
- Detect stream: 640x352 (~1.82:1, not 16:9)
|
||||||
|
|
||||||
|
- Matched (prevents switching):
|
||||||
|
- Live/go2rtc stream: 1920x1080 (16:9)
|
||||||
|
- Detect stream: 640x360 (16:9)
|
||||||
|
|
||||||
|
You can update the detect settings in your camera config to match the aspect ratio of your go2rtc live stream. For example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
cameras:
|
||||||
|
front_door:
|
||||||
|
detect:
|
||||||
|
width: 640
|
||||||
|
height: 360 # set this to 360 instead of 352
|
||||||
|
ffmpeg:
|
||||||
|
inputs:
|
||||||
|
- path: rtsp://127.0.0.1:8554/front_door # main stream 1920x1080
|
||||||
|
roles:
|
||||||
|
- record
|
||||||
|
- path: rtsp://127.0.0.1:8554/front_door_sub # sub stream 640x352
|
||||||
|
roles:
|
||||||
|
- detect
|
||||||
|
```
|
||||||
|
|
||||||
|
The same applies to your `record` stream: if its aspect ratio differs from your `detect` stream, your recordings will appear in a different shape than the live view. For consistent framing across live view and recordings, use the same aspect ratio for all of a camera's streams (the resolution can still differ).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ motion:
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</ConfigTabs>
|
</ConfigTabs>
|
||||||
|
|
||||||
Lower values mean motion detection is more sensitive to changes in color, making it more likely for example to detect motion when a brown dogs blends in with a brown fence or a person wearing a red shirt blends in with a red car. If the threshold is too low however, it may detect things like grass blowing in the wind, shadows, etc. to be detected as motion.
|
Lower values mean motion detection is more sensitive to changes in color, making it more likely for example to detect motion when a brown dog blends in with a brown fence or a person wearing a red shirt blends in with a red car. If the threshold is too low however, it may detect things like grass blowing in the wind, shadows, etc. to be detected as motion.
|
||||||
|
|
||||||
Watching the motion boxes in the debug view, increase the threshold until you only see motion that is visible to the eye. Once this is done, it is important to test and ensure that desired motion is still detected.
|
Watching the motion boxes in the debug view, increase the threshold until you only see motion that is visible to the eye. Once this is done, it is important to test and ensure that desired motion is still detected.
|
||||||
|
|
||||||
|
|||||||
@@ -725,7 +725,7 @@ The inference time was determined on a rk3588 with 3 NPU cores.
|
|||||||
|
|
||||||
To convert a onnx model to the rknn format using the [rknn-toolkit2](https://github.com/airockchip/rknn-toolkit2/) you have to:
|
To convert a onnx model to the rknn format using the [rknn-toolkit2](https://github.com/airockchip/rknn-toolkit2/) you have to:
|
||||||
|
|
||||||
- Place one ore more models in onnx format in the directory `config/model_cache/rknn_cache/onnx` on your docker host (this might require `sudo` privileges).
|
- Place one or more models in onnx format in the directory `config/model_cache/rknn_cache/onnx` on your docker host (this might require `sudo` privileges).
|
||||||
- Save the configuration file under `config/conv2rknn.yaml` (see below for details).
|
- Save the configuration file under `config/conv2rknn.yaml` (see below for details).
|
||||||
- Run `docker exec <frigate_container_id> python3 /opt/conv2rknn.py`. If the conversion was successful, the rknn models will be placed in `config/model_cache/rknn_cache`.
|
- Run `docker exec <frigate_container_id> python3 /opt/conv2rknn.py`. If the conversion was successful, the rknn models will be placed in `config/model_cache/rknn_cache`.
|
||||||
|
|
||||||
@@ -743,13 +743,13 @@ config:
|
|||||||
quant_img_RGB2BGR: true
|
quant_img_RGB2BGR: true
|
||||||
```
|
```
|
||||||
|
|
||||||
Explanation of the paramters:
|
Explanation of the parameters:
|
||||||
|
|
||||||
- `soc`: A list of all SoCs you want to build the rknn model for. If you don't specify this parameter, the script tries to find out your SoC and builds the rknn model for this one.
|
- `soc`: A list of all SoCs you want to build the rknn model for. If you don't specify this parameter, the script tries to find out your SoC and builds the rknn model for this one.
|
||||||
- `quantization`: true: 8 bit integer (i8) quantization, false: 16 bit float (fp16). Default: false.
|
- `quantization`: true: 8 bit integer (i8) quantization, false: 16 bit float (fp16). Default: false.
|
||||||
- `output_name`: The output name of the model. The following variables are available:
|
- `output_name`: The output name of the model. The following variables are available:
|
||||||
- `quant`: "i8" or "fp16" depending on the config
|
- `quant`: "i8" or "fp16" depending on the config
|
||||||
- `input_basename`: the basename of the input model (e.g. "my_model" if the input model is calles "my_model.onnx")
|
- `input_basename`: the basename of the input model (e.g. "my_model" if the input model is called "my_model.onnx")
|
||||||
- `soc`: the SoC this model was build for (e.g. "rk3588")
|
- `soc`: the SoC this model was build for (e.g. "rk3588")
|
||||||
- `tk_version`: Version of `rknn-toolkit2` (e.g. "2.3.0")
|
- `tk_version`: Version of `rknn-toolkit2` (e.g. "2.3.0")
|
||||||
- **example**: Specifying `output_name = "frigate-{quant}-{input_basename}-{soc}-v{tk_version}"` could result in a model called `frigate-i8-my_model-rk3588-v2.3.0.rknn`.
|
- **example**: Specifying `output_name = "frigate-{quant}-{input_basename}-{soc}-v{tk_version}"` could result in a model called `frigate-i8-my_model-rk3588-v2.3.0.rknn`.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Any detection below `min_score` will be immediately thrown out and never tracked
|
|||||||
|
|
||||||
### Threshold
|
### Threshold
|
||||||
|
|
||||||
`threshold` is used to determine that the object is a true positive. Once an object is detected with a score >= `threshold` object is considered a true positive. If `threshold` is too low then some higher scoring false positives may create an tracked object. If `threshold` is too high then true positive tracked objects may be missed due to the object never scoring high enough.
|
`threshold` is used to determine that the object is a true positive. Once an object is detected with a score >= `threshold` object is considered a true positive. If `threshold` is too low then some higher scoring false positives may create a tracked object. If `threshold` is too high then true positive tracked objects may be missed due to the object never scoring high enough.
|
||||||
|
|
||||||
## Configuring Object Scores
|
## Configuring Object Scores
|
||||||
|
|
||||||
|
|||||||
@@ -232,6 +232,21 @@ No. Only one profile can be active at a time. Activating a new profile automatic
|
|||||||
|
|
||||||
When you delete a base zone or mask in the Frigate UI, any profile overrides for that entry are deleted automatically as part of the same operation. If you remove a base entry by editing your config file directly and leave a profile override behind, the config will fail validation at startup until the orphaned override is removed as well.
|
When you delete a base zone or mask in the Frigate UI, any profile overrides for that entry are deleted automatically as part of the same operation. If you remove a base entry by editing your config file directly and leave a profile override behind, the config will fail validation at startup until the orphaned override is removed as well.
|
||||||
|
|
||||||
|
### How do I make a YAML profile track no objects at all?
|
||||||
|
|
||||||
|
Set the tracked object list explicitly to an empty list in the profile:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
cameras:
|
||||||
|
front_door:
|
||||||
|
profiles:
|
||||||
|
home:
|
||||||
|
objects:
|
||||||
|
track: []
|
||||||
|
```
|
||||||
|
|
||||||
|
Leaving the `objects` section empty (or omitting `track`) does not clear the list. Empty sections set no fields, so the profile inherits the full tracked object list from the base config, including anything set at the global level. The same applies to other lists, such as `audio.listen`.
|
||||||
|
|
||||||
### Why are some settings missing when I configure a profile override?
|
### Why are some settings missing when I configure a profile override?
|
||||||
|
|
||||||
Fields that require a Frigate restart to take effect cannot be overridden by profiles, since profiles are applied at runtime without restarting. Those fields are hidden when editing a profile override and can only be changed on the base configuration.
|
Fields that require a Frigate restart to take effect cannot be overridden by profiles, since profiles are applied at runtime without restarting. Those fields are hidden when editing a profile override and can only be changed on the base configuration.
|
||||||
|
|||||||
@@ -163,8 +163,8 @@ genai:
|
|||||||
model: your-model-name
|
model: your-model-name
|
||||||
roles:
|
roles:
|
||||||
- embeddings
|
- embeddings
|
||||||
- vision
|
- descriptions
|
||||||
- tools
|
- chat
|
||||||
|
|
||||||
semantic_search:
|
semantic_search:
|
||||||
enabled: True
|
enabled: True
|
||||||
@@ -226,7 +226,7 @@ For tips on getting the best results from Semantic Search (choosing between thum
|
|||||||
|
|
||||||
## Triggers
|
## Triggers
|
||||||
|
|
||||||
Triggers utilize Semantic Search to automate actions when a tracked object matches a specified image or description. Triggers can be configured so that Frigate executes a specific actions when a tracked object's image or description matches a predefined image or text, based on a similarity threshold. Triggers are managed per camera and can be configured via the Frigate UI in the Settings page under the Triggers tab.
|
Triggers utilize Semantic Search to automate actions when a tracked object matches a specified image or description. Triggers can be configured so that Frigate executes specific actions when a tracked object's image or description matches a predefined image or text, based on a similarity threshold. Triggers are managed per camera and can be configured via the Frigate UI in the Settings page under the Triggers tab.
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Let's look at an example use case: I want to record any cars that enter my drive
|
|||||||
|
|
||||||
One might simply think "Why not just run object detection any time there is motion around the driveway area and notify if the bounding box is in that zone?"
|
One might simply think "Why not just run object detection any time there is motion around the driveway area and notify if the bounding box is in that zone?"
|
||||||
|
|
||||||
With that approach, what video is related to the car that entered the driveway? Did it come from the left or right? Was it parked across the street for an hour before turning into the driveway? One approach is to just record 24/7 or for motion (on any changed changed pixels) and not attempt to do that at all. This is what most other NVRs do. Just don't even try to identify a start and end for that object since it's hard and you will be wrong some portion of the time.
|
With that approach, what video is related to the car that entered the driveway? Did it come from the left or right? Was it parked across the street for an hour before turning into the driveway? One approach is to just record 24/7 or for motion (on any changed pixels) and not attempt to do that at all. This is what most other NVRs do. Just don't even try to identify a start and end for that object since it's hard and you will be wrong some portion of the time.
|
||||||
|
|
||||||
Couldn't you just look at when motion stopped and started? Motion for a video feed is nothing more than looking for pixels that are different than they were in previous frames. If the car entered the driveway while someone was mowing the grass, how would you know which motion was for the car and which was for the person when they mow along the driveway or street? What if another car was driving the other direction on the street? Or what if its a windy day and the bush by your mailbox is blowing around?
|
Couldn't you just look at when motion stopped and started? Motion for a video feed is nothing more than looking for pixels that are different than they were in previous frames. If the car entered the driveway while someone was mowing the grass, how would you know which motion was for the car and which was for the person when they mow along the driveway or street? What if another car was driving the other direction on the street? Or what if its a windy day and the bush by your mailbox is blowing around?
|
||||||
|
|
||||||
@@ -61,4 +61,4 @@ Now you have to determine which of the bounding boxes in this frame should be ma
|
|||||||
|
|
||||||
Now let's assume that those other 3 cars were already being tracked as stationary objects, so the car driving down the street is a new 4th car. The object tracker knows we have had 3 cars and we now have 4. As the new car approaches the parked cars, the bounding boxes for all 4 cars is predicted based on the previous frames. The predicted boxes for the parked cars is pretty much a 100% overlap with the bounding boxes in the new frame. The parked cars are slam dunk matches to the tracking ids they had before and the only one left is the remaining bounding box which gets assigned to the new car. This results in a much lower error rate. Not perfect, but better.
|
Now let's assume that those other 3 cars were already being tracked as stationary objects, so the car driving down the street is a new 4th car. The object tracker knows we have had 3 cars and we now have 4. As the new car approaches the parked cars, the bounding boxes for all 4 cars is predicted based on the previous frames. The predicted boxes for the parked cars is pretty much a 100% overlap with the bounding boxes in the new frame. The parked cars are slam dunk matches to the tracking ids they had before and the only one left is the remaining bounding box which gets assigned to the new car. This results in a much lower error rate. Not perfect, but better.
|
||||||
|
|
||||||
The most difficult scenario that causes IDs to be assigned incorrectly is when an object completely occludes another object. When a car drives in front of another car and its no longer visible, a bounding box disappeared and it's a bit of a toss up when assigning the id since it's difficult to know which one is in front of the other. This happens for cars passing in front of other cars fairly often. It's something that we want to improve in the future.
|
The most difficult scenario that causes IDs to be assigned incorrectly is when an object completely occludes another object. When a car drives in front of another car and it's no longer visible, a bounding box disappeared and it's a bit of a toss up when assigning the id since it's difficult to know which one is in front of the other. This happens for cars passing in front of other cars fairly often. It's something that we want to improve in the future.
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ Users of the Snapcraft build of Docker cannot use storage locations outside your
|
|||||||
|
|
||||||
Frigate utilizes shared memory to store frames during processing. The default `shm-size` provided by Docker is **64MB**.
|
Frigate utilizes shared memory to store frames during processing. The default `shm-size` provided by Docker is **64MB**.
|
||||||
|
|
||||||
The default shm size of **128MB** is fine for setups with **2 cameras** detecting at **720p**. If Frigate is exiting with "Bus error" messages, it is likely because you have too many high resolution cameras and you need to specify a higher shm size, using [`--shm-size`](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) (or [`service.shm_size`](https://docs.docker.com/compose/compose-file/compose-file-v2/#shm_size) in Docker Compose).
|
The default shm size of **128MB** is fine for setups with **2 cameras** detecting at **720p**. If Frigate is exiting with "Bus error" messages, it is likely because you have too many high resolution cameras and you need to specify a higher shm size, using [`--shm-size`](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) (or [`service.shm_size`](https://docs.docker.com/compose/compose-file/compose-file-v2/#shm_size) in Docker Compose). If raising the shm size does not help, check your [process and file limits](#process-and-file-limits) as well.
|
||||||
|
|
||||||
The Frigate container also stores logs in shm, which can take up to **40MB**, so make sure to take this into account in your math as well.
|
The Frigate container also stores logs in shm, which can take up to **40MB**, so make sure to take this into account in your math as well.
|
||||||
|
|
||||||
@@ -86,6 +86,30 @@ The Frigate container also stores logs in shm, which can take up to **40MB**, so
|
|||||||
|
|
||||||
The shm size cannot be set per container for Home Assistant Apps. However, this is probably not required since by default Home Assistant Supervisor allocates `/dev/shm` with half the size of your total memory. If your machine has 8GB of memory, chances are that Frigate will have access to up to 4GB without any additional configuration.
|
The shm size cannot be set per container for Home Assistant Apps. However, this is probably not required since by default Home Assistant Supervisor allocates `/dev/shm` with half the size of your total memory. If your machine has 8GB of memory, chances are that Frigate will have access to up to 4GB without any additional configuration.
|
||||||
|
|
||||||
|
### Process and file limits
|
||||||
|
|
||||||
|
Frigate runs many processes and opens a number of shared memory files. Installs with a large number of cameras can exceed the default limits your container runtime applies.
|
||||||
|
|
||||||
|
Hitting the PID limit logs `RuntimeError: can't start new thread`, often followed by a "Bus error" that makes it look like an shm sizing problem. Compare the current count against the max from inside the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat /sys/fs/cgroup/pids.current
|
||||||
|
cat /sys/fs/cgroup/pids.max
|
||||||
|
```
|
||||||
|
|
||||||
|
If these are close, raise the limit with [`--pids-limit`](https://docs.docker.com/engine/containers/resource_constraints/) (or `service.pids_limit` in Docker Compose).
|
||||||
|
|
||||||
|
Running out of file descriptors logs `OSError: [Errno 24] Too many open files`. Raise the limit in Docker Compose:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
frigate:
|
||||||
|
ulimits:
|
||||||
|
nofile:
|
||||||
|
soft: 65535
|
||||||
|
hard: 65535
|
||||||
|
```
|
||||||
|
|
||||||
## Extra Steps for Specific Hardware
|
## Extra Steps for Specific Hardware
|
||||||
|
|
||||||
The following sections contain additional setup steps that are only required if you are using specific hardware. If you are not using any of these hardware types, you can skip to the [Docker](#docker) installation section.
|
The following sections contain additional setup steps that are only required if you are using specific hardware. If you are not using any of these hardware types, you can skip to the [Docker](#docker) installation section.
|
||||||
@@ -94,7 +118,7 @@ The following sections contain additional setup steps that are only required if
|
|||||||
|
|
||||||
By default, the Raspberry Pi limits the amount of memory available to the GPU. In order to use ffmpeg hardware acceleration, you must increase the available memory by setting `gpu_mem` to the maximum recommended value in `config.txt` as described in the [official docs](https://www.raspberrypi.org/documentation/computers/config_txt.html#memory-options).
|
By default, the Raspberry Pi limits the amount of memory available to the GPU. In order to use ffmpeg hardware acceleration, you must increase the available memory by setting `gpu_mem` to the maximum recommended value in `config.txt` as described in the [official docs](https://www.raspberrypi.org/documentation/computers/config_txt.html#memory-options).
|
||||||
|
|
||||||
Additionally, the USB Coral draws a considerable amount of power. If using any other USB devices such as an SSD, you will experience instability due to the Pi not providing enough power to USB devices. You will need to purchase an external USB hub with it's own power supply. Some have reported success with <a href="https://amzn.to/3a2mH0P" target="_blank" rel="nofollow noopener sponsored">this</a> (affiliate link).
|
Additionally, the USB Coral draws a considerable amount of power. If using any other USB devices such as an SSD, you will experience instability due to the Pi not providing enough power to USB devices. You will need to purchase an external USB hub with its own power supply. Some have reported success with <a href="https://amzn.to/3a2mH0P" target="_blank" rel="nofollow noopener sponsored">this</a> (affiliate link).
|
||||||
|
|
||||||
### Hailo-8
|
### Hailo-8
|
||||||
|
|
||||||
@@ -484,7 +508,6 @@ Generate a Frigate Docker Compose configuration based on your hardware and requi
|
|||||||
|
|
||||||
<DockerComposeGenerator/>
|
<DockerComposeGenerator/>
|
||||||
|
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="original" label="Example Docker Compose File">
|
<TabItem value="original" label="Example Docker Compose File">
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ At this point you should be able to start Frigate and a basic config will be cre
|
|||||||
|
|
||||||
### Step 2: Add a camera
|
### Step 2: Add a camera
|
||||||
|
|
||||||
Click the **Add Camera** button in <NavPath path="Settings > Global configuration > Camera management" /> to use the camera setup wizard to get your first camera added into Frigate.
|
Click the **Add Camera** button in <NavPath path="Settings > Global configuration > Camera management" /> to use the camera setup wizard to get your first camera added into Frigate. See [Adding a camera with the Add Camera Wizard](../configuration/cameras.md#adding-a-camera-with-the-add-camera-wizard) for a walkthrough of each step.
|
||||||
|
|
||||||
### Step 3: Configure hardware acceleration (recommended)
|
### Step 3: Configure hardware acceleration (recommended)
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ The best way to integrate with Home Assistant is to use the [official integratio
|
|||||||
|
|
||||||
### Preparation
|
### Preparation
|
||||||
|
|
||||||
|
Frigate itself must be installed and running before setting up the integration. See the [installation documentation](../frigate/installation.md) for details.
|
||||||
|
|
||||||
The Frigate integration requires the `mqtt` integration to be installed and
|
The Frigate integration requires the `mqtt` integration to be installed and
|
||||||
manually configured first.
|
manually configured first.
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ Use `http://<frigate_device_ip>:8971` as the URL for the integration so that aut
|
|||||||
|
|
||||||
The above URL assumes you have [disabled TLS](../configuration/tls).
|
The above URL assumes you have [disabled TLS](../configuration/tls).
|
||||||
By default, TLS is enabled and Frigate will be using a self-signed certificate. HomeAssistant will fail to connect HTTPS to port 8971 since it fails to verify the self-signed certificate.
|
By default, TLS is enabled and Frigate will be using a self-signed certificate. HomeAssistant will fail to connect HTTPS to port 8971 since it fails to verify the self-signed certificate.
|
||||||
Either disable TLS and use HTTP from HomeAssistant, or configure Frigate to be acessible with a valid certificate.
|
Either disable TLS and use HTTP from HomeAssistant, or configure Frigate to be accessible with a valid certificate.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@@ -279,7 +281,7 @@ For advanced usecases, this behavior can be changed with the [RTSP URL
|
|||||||
template](#options) option. When set, this string will override the default stream
|
template](#options) option. When set, this string will override the default stream
|
||||||
address that is derived from the default behavior described above. This option supports
|
address that is derived from the default behavior described above. This option supports
|
||||||
[jinja2 templates](https://jinja.palletsprojects.com/) and has the `camera` dict
|
[jinja2 templates](https://jinja.palletsprojects.com/) and has the `camera` dict
|
||||||
variables from [Frigate API](../integrations/api)
|
variables from [Frigate API](/integrations/api/frigate-http-api)
|
||||||
available for the template. Note that no Home Assistant state is available to the
|
available for the template. Note that no Home Assistant state is available to the
|
||||||
template, only the camera dict from Frigate.
|
template, only the camera dict from Frigate.
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ MQTT requires a network connection to your broker. This is typically local, but
|
|||||||
### `frigate/available`
|
### `frigate/available`
|
||||||
|
|
||||||
Designed to be used as an availability topic with Home Assistant. Possible message are:
|
Designed to be used as an availability topic with Home Assistant. Possible message are:
|
||||||
"online": published when Frigate is running (on startup)
|
"online": published once Frigate is running and has published its initial state. Note that this is published on every connection to the broker, so it is republished if the broker restarts or the connection drops and recovers, without Frigate itself restarting.
|
||||||
"stopped": published when Frigate is stopped normally
|
"stopped": published when Frigate is stopped normally
|
||||||
"offline": published automatically by the MQTT broker if Frigate disconnects unexpectedly (via MQTT Will Message)
|
"offline": published automatically by the MQTT broker if Frigate disconnects unexpectedly (via MQTT Will Message)
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ Same data available at `/api/stats` published at a configurable interval.
|
|||||||
|
|
||||||
### `frigate/camera_activity`
|
### `frigate/camera_activity`
|
||||||
|
|
||||||
Returns data about each camera, its current features, and if it is detecting motion, objects, etc. Can be triggered by publising to `frigate/onConnect`
|
Returns data about each camera, its current features, and if it is detecting motion, objects, etc. Can be triggered by publishing to `frigate/onConnect`
|
||||||
|
|
||||||
### `frigate/profile/set`
|
### `frigate/profile/set`
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ The [Advanced Camera Card](https://card.camera/#/README) is a Home Assistant das
|
|||||||
|
|
||||||
## [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 an 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.
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ This is a fork (with fixed errors and new features) of [original Double Take](ht
|
|||||||
|
|
||||||
## [Scrypted - Frigate bridge plugin](https://github.com/apocaliss92/scrypted-frigate-bridge)
|
## [Scrypted - Frigate bridge plugin](https://github.com/apocaliss92/scrypted-frigate-bridge)
|
||||||
|
|
||||||
[Scrypted - Frigate bridge](https://github.com/apocaliss92/scrypted-frigate-bridge) is an plugin that allows to ingest Frigate detections, motion, videoclips on Scrypted as well as provide templates to export rebroadcast configurations on Frigate.
|
[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)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ For the best results, follow these guidelines. You may also want to review the d
|
|||||||
|
|
||||||
## AI suggested labels
|
## AI suggested labels
|
||||||
|
|
||||||
If you have an active Frigate+ subscription, new uploads will be scanned for the objects configured for you camera and you will see suggested labels as light blue boxes when annotating in Frigate+. These suggestions are processed via a queue and typically complete within a minute after uploading, but processing times can be longer.
|
If you have an active Frigate+ subscription, new uploads will be scanned for the objects configured for your camera and you will see suggested labels as light blue boxes when annotating in Frigate+. These suggestions are processed via a queue and typically complete within a minute after uploading, but processing times can be longer.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ id: first_model
|
|||||||
title: Requesting your first model
|
title: Requesting your first model
|
||||||
---
|
---
|
||||||
|
|
||||||
|
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||||
|
import TabItem from "@theme/TabItem";
|
||||||
|
import NavPath from "@site/src/components/NavPath";
|
||||||
|
|
||||||
## Step 1: Upload and annotate your images
|
## Step 1: Upload and annotate your images
|
||||||
|
|
||||||
Before requesting your first model, you will need to upload and verify at least 10 images to Frigate+. The more images you upload, annotate, and verify the better your results will be. Most users start to see very good results once they have at least 100 verified images per camera. Keep in mind that varying conditions should be included. You will want images from cloudy days, sunny days, dawn, dusk, and night. Refer to the [integration docs](../integrations/plus.md#generate-an-api-key) for instructions on how to easily submit images to Frigate+ directly from Frigate.
|
Before requesting your first model, you will need to upload and verify at least 10 images to Frigate+. The more images you upload, annotate, and verify the better your results will be. Most users start to see very good results once they have at least 100 verified images per camera. Keep in mind that varying conditions should be included. You will want images from cloudy days, sunny days, dawn, dusk, and night. Refer to the [integration docs](../integrations/plus.md#generate-an-api-key) for instructions on how to easily submit images to Frigate+ directly from Frigate.
|
||||||
@@ -16,13 +20,21 @@ For more detailed recommendations, you can refer to the docs on [annotating](./a
|
|||||||
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. 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 [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. 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.
|
||||||

|

|
||||||
|
|
||||||
## Step 3: Set your model id in the config
|
## Step 3: Set your model
|
||||||
|
|
||||||
You will receive an email notification when your Frigate+ model is ready.
|
You will receive an email notification when your Frigate+ model is ready.
|
||||||

|

|
||||||
|
|
||||||
Models available in Frigate+ can be used with a special model path. No other information needs to be configured because it fetches the remaining config from Frigate+ automatically.
|
Models available in Frigate+ can be used with a special model path. No other information needs to be configured because it fetches the remaining config from Frigate+ automatically.
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
Navigate to <NavPath path="Settings > System > Detectors and model" />. In the **Detection Model** section, choose the **Frigate+** tab. Select your new Frigate+ model from the **Available Frigate+ models** dropdown, then click **Save**. Restart Frigate to apply the change.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
detectors: ...
|
detectors: ...
|
||||||
|
|
||||||
@@ -30,22 +42,46 @@ model:
|
|||||||
path: plus://<your_model_id>
|
path: plus://<your_model_id>
|
||||||
```
|
```
|
||||||
|
|
||||||
:::note
|
|
||||||
|
|
||||||
Model IDs are not secret values and can be shared freely. Access to your model is protected by your API key.
|
|
||||||
|
|
||||||
:::
|
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
When setting the plus model id, all other fields should be removed as these are configured automatically with the Frigate+ model config
|
When setting the plus model id, all other fields should be removed as these are configured automatically with the Frigate+ model config
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|
||||||
|
:::note
|
||||||
|
|
||||||
|
Model IDs are not secret values and can be shared freely. Access to your model is protected by your API key.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
## Step 4: Adjust your object filters for higher scores
|
## Step 4: Adjust your object filters for higher scores
|
||||||
|
|
||||||
Frigate+ models generally have much higher scores than the default model provided in Frigate. You will likely need to increase your `threshold` and `min_score` values. Here is an example of how these values can be refined, but you should expect these to evolve as your model improves. For more information about how `threshold` and `min_score` are related, see the docs on [object filters](../configuration/object_filters.md#object-scores).
|
Frigate+ models generally have much higher scores than the default model provided in Frigate. You will likely need to increase your `threshold` and `min_score` values. Here is an example of how these values can be refined, but you should expect these to evolve as your model improves. For more information about how `threshold` and `min_score` are related, see the docs on [object filters](../configuration/object_filters.md#object-scores).
|
||||||
|
|
||||||
|
<ConfigTabs>
|
||||||
|
<TabItem value="ui">
|
||||||
|
|
||||||
|
Navigate to <NavPath path="Settings > Global configuration > Objects" />. Under **Object filters**, set **Min Score** and **Threshold** for each object type, then click **Save**.
|
||||||
|
|
||||||
|
| Object | Min Score | Threshold |
|
||||||
|
| ----------------- | --------- | --------- |
|
||||||
|
| **dog** | .7 | .9 |
|
||||||
|
| **cat** | .65 | .8 |
|
||||||
|
| **face** | .7 | |
|
||||||
|
| **package** | .65 | .9 |
|
||||||
|
| **license_plate** | .6 | |
|
||||||
|
| **amazon** | .75 | |
|
||||||
|
| **ups** | .75 | |
|
||||||
|
| **fedex** | .75 | |
|
||||||
|
| **person** | .65 | .85 |
|
||||||
|
| **car** | .65 | .85 |
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="yaml">
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
objects:
|
objects:
|
||||||
filters:
|
filters:
|
||||||
@@ -75,3 +111,6 @@ objects:
|
|||||||
min_score: .65
|
min_score: .65
|
||||||
threshold: .85
|
threshold: .85
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</ConfigTabs>
|
||||||
|
|||||||
@@ -0,0 +1,234 @@
|
|||||||
|
---
|
||||||
|
id: common_errors
|
||||||
|
title: Common Error Messages
|
||||||
|
---
|
||||||
|
|
||||||
|
import FaqItem from "@site/src/components/FaqItem";
|
||||||
|
|
||||||
|
This page is an index of error messages you might see in Frigate's logs, what each one means, and where to go next. It is organized by the kind of problem, not by which component logged the message.
|
||||||
|
|
||||||
|
Two things to know before you start:
|
||||||
|
|
||||||
|
- **Many of these messages come from FFmpeg, go2rtc, GPU drivers, or the operating system, not from Frigate itself.** Frigate captures and re-logs their output, so the log level shown in the Frigate UI does not always reflect the original severity.
|
||||||
|
- **Wrapped errors put the real cause on the next line.** When Frigate logs a generic message like `Error occurred when attempting to maintain recording cache`, the actual exception is logged immediately after it. When a camera's FFmpeg process exits, Frigate logs `The following ffmpeg logs include the last 100 lines prior to exit` and dumps that camera's FFmpeg output. Always read those lines, they are where the answer usually is.
|
||||||
|
|
||||||
|
## Camera connection and streams
|
||||||
|
|
||||||
|
<FaqItem id="connection-refused-no-route-to-host-401-404" question="Connection refused / No route to host / 401 Unauthorized / 404 Not Found">
|
||||||
|
|
||||||
|
These are FFmpeg errors about reaching the camera (or the go2rtc restream). `Connection refused` and `No route to host` mean nothing is listening at that address or the host is unreachable; `401 Unauthorized` is wrong credentials; `404 Not Found` is a wrong stream path (or a `restream` input pointing at a go2rtc stream name that does not exist). A camera that has hit its concurrent-connection limit can also return `refused` or `401` on a URL that works in VLC.
|
||||||
|
|
||||||
|
See [go2rtc troubleshooting](/troubleshooting/go2rtc#1-read-the-go2rtc-logs) for how to isolate the stream.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="no-frames-received-in-20-seconds" question="No frames received from <camera> in 20 seconds. Exiting ffmpeg...">
|
||||||
|
|
||||||
|
FFmpeg is running but has stopped delivering video for 20 seconds, so Frigate's camera watchdog restarts it. The stream connected at least once, then went quiet: a camera reboot, a network drop, the camera evicting the connection, or a stalled decoder. If it repeats on a loop, the stream is unstable.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="ffmpeg-process-crashed-unexpectedly" question="Ffmpeg process crashed unexpectedly for <camera>">
|
||||||
|
|
||||||
|
The detect FFmpeg process exited on its own. This message is only the notification; the cause is in the 100 FFmpeg log lines Frigate dumps right after it (look for a `Failed to sync surface`, `Connection refused`, codec, or audio error in that block). Related watchdog messages include `<camera> exceeded fps limit`, which means the camera is delivering frames faster than `detect.fps` (usually a camera whose real frame rate differs from what is configured).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="non-monotonically-increasing-dts" question="Application provided invalid, non monotonically increasing dts to muxer">
|
||||||
|
|
||||||
|
An FFmpeg message meaning the camera sent packets with out-of-order timestamps. Because recordings are copied without re-encoding, FFmpeg cannot fix them, and the segment muxer often splits early, producing one-second segments and a cache backlog. The usual cause is a camera "Smart Codec" / H.264+ / H.265+ mode or a camera clock that jumps.
|
||||||
|
|
||||||
|
See [Recordings: segments are only 1 second long](/troubleshooting/recordings#segments-are-only-1-second-long).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="bad-cseq" question="RTP: PT=xx: bad cseq (packet loss / reordering)">
|
||||||
|
|
||||||
|
An FFmpeg message meaning RTP packets arrived out of sequence, which almost always means the stream is using UDP transport. Frigate's RTSP presets force TCP, so seeing this points at a custom `input_args`, `preset-rtsp-udp`, or a go2rtc source that is not using TCP. Switch to TCP unless your camera is [UDP-only](/configuration/camera_specific#udp-only-cameras).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="error-while-decoding-mb-non-existing-pps" question="error while decoding MB / non-existing PPS referenced (corrupt frames)">
|
||||||
|
|
||||||
|
FFmpeg decoder messages meaning the received video bitstream was incomplete or damaged. A few of these at every stream start are normal (the decoder connected before the first keyframe) and Frigate discards them. A continuous stream of them means real packet loss, from Wi-Fi or a saturated link, an overloaded camera, or an FFmpeg restart loop caused by another problem. Fix the underlying instability rather than the message.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="could-not-find-codec-parameters" question="Could not find codec parameters for stream ... unspecified size">
|
||||||
|
|
||||||
|
An FFmpeg message meaning it probed the stream but never saw enough decodable video to determine the frame size, often because the probe window ended before the first keyframe on a long-GOP stream, or because the stream is not delivering usable video. If it is a Reolink HTTP stream, use `preset-http-reolink`, which raises the probe size for exactly this case.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Recording
|
||||||
|
|
||||||
|
<FaqItem id="no-new-recording-segments" question="No new recording segments were created for <camera> in the last 120s">
|
||||||
|
|
||||||
|
Frigate's record watchdog is restarting the record FFmpeg process because no valid segment has reached the cache. This means the record stream is not connecting or the segments are being rejected (see the audio-codec entry below).
|
||||||
|
|
||||||
|
See [Recordings: the record stream isn't connecting](/troubleshooting/recordings#the-record-stream-isnt-connecting).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="invalid-or-missing-video-stream-in-segment" question="Invalid or missing video stream in segment. Discarding.">
|
||||||
|
|
||||||
|
A cached recording segment failed validation (no readable video stream) and was deleted. The most common cause is a segment that was truncated because the record FFmpeg process was killed mid-write, so this often appears alongside, and as a consequence of, the record-stream restarts above. A segment containing only audio triggers it too.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="incompatible-audio-codec" question="Recordings silently fail to save (incompatible audio codec)">
|
||||||
|
|
||||||
|
Some camera audio codecs (G.711 variants such as `pcm_alaw` and `pcm_mulaw`) cannot be stored in an MP4 container, so segments never finalize even though live view works.
|
||||||
|
|
||||||
|
See [Recordings: incompatible audio codec](/troubleshooting/recordings#incompatible-audio-codec-recordings-silently-fail-to-save) for the FFmpeg preset that transcodes the audio to AAC.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="error-maintaining-recording-cache" question="Error occurred when attempting to maintain recording cache">
|
||||||
|
|
||||||
|
A generic wrapper; the real exception is on the next log line. Frequently it is `[Errno 28] No space left on device` or `[Errno 17] File exists` on a network share.
|
||||||
|
|
||||||
|
See [Recordings cache warnings and errors](/troubleshooting/recordings#i-see-the-message-error--error-occurred-when-attempting-to-maintain-recording-cache), which covers this message and the common `Errno` cases.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Hardware acceleration
|
||||||
|
|
||||||
|
<FaqItem id="failed-to-sync-surface" question="Failed to sync surface / Failed to download frame: -5 / Error while filtering">
|
||||||
|
|
||||||
|
A VAAPI/QSV hardware frame-sync failure between FFmpeg and the GPU driver, not a Frigate bug. It usually appears when the detect stream is being scaled or decoded on the GPU.
|
||||||
|
|
||||||
|
See [GPU: Failed to download frame: -5](/troubleshooting/gpu#failed-to-download-frame--5), which lists the fixes in order (switch VAAPI/QSV preset, change `LIBVA_DRIVER_NAME`, use an H.264 substream, match detect resolution and fps to the stream).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="no-decoder-surfaces-left" question="No decoder surfaces left / Can't allocate a surface">
|
||||||
|
|
||||||
|
Both mean the GPU ran out of decode surfaces: `No decoder surfaces left` is NVIDIA NVDEC, `Can't allocate a surface` is Intel QSV. This is surface-pool exhaustion, typically from too many concurrent hardware-decoded cameras on one GPU (consumer NVIDIA cards have a driver-enforced limit on simultaneous decode sessions). Reduce the number of cameras decoding on that GPU, decode some on the CPU, or move to hardware without the session cap.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="nvidia-container-cli-nvml-error" question="nvidia-container-cli: nvml error: driver not loaded">
|
||||||
|
|
||||||
|
This comes from the NVIDIA container runtime while starting the container, not from Frigate, and the container never starts. The NVIDIA driver is not loaded on the host. Confirm `nvidia-smi` works on the host itself (not inside the container) before troubleshooting Frigate. In a VM or LXC, the driver must be available inside the guest. See [Hardware: Nvidia GPU](/configuration/hardware_acceleration_video).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Detectors and models
|
||||||
|
|
||||||
|
<FaqItem id="illegal-instruction" question="Illegal instruction (core dumped)">
|
||||||
|
|
||||||
|
The process was killed by the CPU for executing an unsupported instruction. There are two distinct causes in Frigate:
|
||||||
|
|
||||||
|
- **A Coral EdgeTPU** on a newer kernel with an outdated gasket driver. See [EdgeTPU: Illegal instruction](/troubleshooting/edgetpu#attempting-to-load-tpu-as-pci--fatal-python-error-illegal-instruction).
|
||||||
|
- **A CPU without AVX/AVX2**, when enabling semantic search, face recognition, license plate recognition, classification, or audio transcription. These features use libraries compiled with AVX and crash immediately on CPUs that lack it (commonly Intel Celeron/Pentium before the 2020 Tiger Lake generation). See the [CPU requirements](/frigate/planning_setup#cpu).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="onnx-invalidprotobuf" question="ONNX Runtime InvalidProtobuf / failed to load model">
|
||||||
|
|
||||||
|
ONNX Runtime could not parse the model file. The file exists but its contents are not a valid ONNX model, usually a corrupted or interrupted download in `model_cache`, or the wrong file pointed at by `model.path`. Delete the cached model file so Frigate re-downloads it, and confirm `model.path` points at an actual `.onnx` model. See [ONNX detector configuration](/configuration/object_detectors#onnx).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="cuda-failure-999-901" question="CUDA failure 999 / CUDA failure 901">
|
||||||
|
|
||||||
|
ONNX Runtime CUDA errors. `999` (`cudaErrorUnknown`) is a general, unrecoverable CUDA context failure, usually a driver/runtime version mismatch between the host and the container or a GPU in a bad state. `901` is a CUDA-graph capture error, which points at a custom model whose operations are not capture-safe. For `999`, align the host driver with the container's CUDA version and confirm the GPU is healthy.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="openvino-no-supported-devices" question="Can't get OPTIMIZATION_CAPABILITIES property as no supported devices found">
|
||||||
|
|
||||||
|
OpenVINO could not find the configured device (usually `GPU` or `NPU`). Most often the `/dev/dri` render node is not passed into the container, or the wrong render node is mapped when an iGPU and a discrete GPU coexist.
|
||||||
|
|
||||||
|
See [GPU: no supported devices found](/troubleshooting/gpu#cant-get-optimization_capabilities-property-as-no-supported-devices-found).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Memory and storage
|
||||||
|
|
||||||
|
<FaqItem id="fatal-python-error-bus-error" question="Fatal Python error: Bus error">
|
||||||
|
|
||||||
|
Frigate ran out of shared memory (`/dev/shm`). The container's `shm_size` is too small for the number and resolution of your detect streams, or you added cameras after startup without increasing it.
|
||||||
|
|
||||||
|
See [Calculating required shm-size](/frigate/installation#calculating-required-shm-size). If you cannot increase `shm_size`, lowering the `SHM_MAX_FRAMES` environment variable reduces how many frames Frigate buffers per camera.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="errno-28-no-space-left" question="[Errno 28] No space left on device">
|
||||||
|
|
||||||
|
A filesystem is full: the recordings volume (`/media/frigate`), the cache tmpfs (`/tmp/cache`), or `/dev/shm`. Check which one, and note that inode exhaustion can produce this while `df -h` still shows free space.
|
||||||
|
|
||||||
|
See [Recordings: No space left on device](/troubleshooting/recordings#i-see-the-message-error--error-occurred-when-attempting-to-maintain-recording-cache).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="container-exits-with-no-logs" question="The container exits or restarts with no error in the logs">
|
||||||
|
|
||||||
|
A silent exit is usually the host or container out-of-memory killer. Because `/dev/shm` and `/tmp/cache` are memory-backed, they count against the container's memory limit, so aggressive shm or cache sizing can trigger it. Give the container more memory, or reduce shm/cache sizing, and check the host's OOM messages (`dmesg`).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Database
|
||||||
|
|
||||||
|
<FaqItem id="database-is-locked" question="database is locked">
|
||||||
|
|
||||||
|
SQLite could not acquire the write lock. Frigate's timeout already scales with camera count, so under normal local-disk operation this essentially only happens when the database is on a network share (SMB/NFS), where file locking is unreliable, or when two instances point at the same file.
|
||||||
|
|
||||||
|
See [Database is locked](/troubleshooting/faqs#error-database-is-locked).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="database-disk-image-is-malformed" question="database disk image is malformed">
|
||||||
|
|
||||||
|
The SQLite database file is corrupted, typically after hard power loss, a network-share database, or a filesystem with unsafe write semantics. Frigate does not repair it automatically, but the database can usually be recovered by hand.
|
||||||
|
|
||||||
|
**Stop Frigate first**, then work on the database file directly (by default `/config/frigate.db`). Start by checking what is actually wrong:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sqlite3 frigate.db "PRAGMA integrity_check;"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the only problems reported are index-related (lines such as `row 14 missing from index recordings_path` or `non-unique entry in index ...`), rebuilding the indexes is usually enough and is the least destructive fix:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sqlite3 frigate.db "REINDEX;"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the integrity check reports page or byte-level corruption instead (for example `Multiple uses for byte 2706 of page 142272`), dump the readable contents into a new database:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# dump what can still be read
|
||||||
|
sqlite3 frigate.db .dump > frigate.dump
|
||||||
|
|
||||||
|
# keep the corrupt file, then rebuild from the dump
|
||||||
|
mv frigate.db frigate.db.bak
|
||||||
|
cat frigate.dump | sqlite3 frigate.db
|
||||||
|
|
||||||
|
# confirm the rebuilt database is clean, this should print "ok"
|
||||||
|
sqlite3 frigate.db "PRAGMA integrity_check;"
|
||||||
|
```
|
||||||
|
|
||||||
|
Rows stored in the corrupted pages cannot be recovered, so expect to lose some tracked objects, review items, or thumbnails. Recordings themselves are files on disk and are not affected.
|
||||||
|
|
||||||
|
As a last resort, stop Frigate, delete `frigate.db`, and restart. Frigate recreates it, but existing recordings lose all of their metadata. If a `backup.db` exists next to your database, Frigate wrote it before the last schema migration and restoring it recovers everything up to that point.
|
||||||
|
|
||||||
|
Repeat corruption usually points at the underlying storage: move the database off a network share, and on Raspberry Pi check power delivery and the SD card or SSD.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Startup and web access
|
||||||
|
|
||||||
|
<FaqItem id="unable-to-start-frigate-in-safe-mode" question="Unable to start Frigate in safe mode / Starting Frigate in safe mode">
|
||||||
|
|
||||||
|
When your config fails validation at startup, Frigate prints the validation errors (with line numbers), then starts in **safe mode**: a minimal configuration with no cameras and MQTT disabled, so the UI stays reachable. In safe mode the only available page is the Config Editor, which shows the validation errors so you can fix them, then save and restart. Note that recording retention and storage cleanup do **not** run while in safe mode, so do not leave a low-disk system sitting in it.
|
||||||
|
|
||||||
|
`Unable to start Frigate in safe mode` means even the minimal config failed, which points at an error in your `auth`, `proxy`, or `database` section, or a config file that is not valid YAML at all. Safe mode is not sticky; fix the config and restart and Frigate returns to normal.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="502-bad-gateway" question="502 Bad Gateway / connection refused to 127.0.0.1:5001">
|
||||||
|
|
||||||
|
The web server is up but the Frigate backend (port 5001) is not answering yet. By far the most common reason is that the page was loaded during startup: the API binds last, after database migrations (which can take minutes on a large database), model downloads, and process startup, while the web server is already serving. Wait for startup to finish. If it persists, the backend has failed to start, and the reason is earlier in the logs. This also explains a `connection refused to 127.0.0.1:5001` seen while loading `/ws`, because every authenticated request first makes an auth subrequest to that port.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
@@ -39,7 +39,9 @@ The per-clip variation is typically quite low and is mostly an artifact of keyfr
|
|||||||
|
|
||||||
Debug Replay lets you re-run Frigate's detection pipeline against a section of recorded video without manually configuring a dummy camera. It automatically extracts the recording, creates a temporary camera with the same detection settings as the original, and loops the clip through the pipeline so you can observe detections in real time.
|
Debug Replay lets you re-run Frigate's detection pipeline against a section of recorded video without manually configuring a dummy camera. It automatically extracts the recording, creates a temporary camera with the same detection settings as the original, and loops the clip through the pipeline so you can observe detections in real time.
|
||||||
|
|
||||||
Debug Replay isn't intended to be a one-stop pane for all Frigate diagnostics or a comprehensive debugging environment for every Frigate feature. It merely makes it easier to spin up a "dummy camera" and perform some common adjustments in real-time. You'll still need to use the normal tools (logs, an MQTT client, etc) to debug your feature.
|
The replay camera behaves like a live camera feed rather than History's video player: it loops the clip continuously as Frigate analyzes it and has no playback controls, so you cannot pause, scrub, or step through it frame by frame.
|
||||||
|
|
||||||
|
Debug Replay isn't intended to be a one-stop pane for all Frigate diagnostics or a comprehensive debugging environment for every Frigate feature. It merely makes it easier to spin up a "dummy camera" and perform some common adjustments in real time. You'll still need to use the normal tools (logs, an MQTT client, etc) to debug your feature.
|
||||||
|
|
||||||
### When to use
|
### When to use
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ There are many possible causes for a USB coral not being detected and some are O
|
|||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
Using `lsusb` or checking the hardware page in HA OS will show as `1a6e:089a Global Unichip Corp.` until Frigate runs an inferance using the coral. So don't worry about the identification until after Frigate has attempted to detect the coral.
|
Using `lsusb` or checking the hardware page in HA OS will show as `1a6e:089a Global Unichip Corp.` until Frigate runs an inference using the coral. So don't worry about the identification until after Frigate has attempted to detect the coral.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@@ -43,13 +43,13 @@ Some users have reported that this older device runs an older kernel causing iss
|
|||||||
3. Start the docker container with Coral TPU enabled in the config
|
3. Start the docker container with Coral TPU enabled in the config
|
||||||
4. The TPU would be detected but a few moments later it would disconnect.
|
4. The TPU would be detected but a few moments later it would disconnect.
|
||||||
5. While leaving the TPU device plugged in, restart the NAS using the reboot command in the UI. Do NOT unplug the NAS/power it off etc.
|
5. While leaving the TPU device plugged in, restart the NAS using the reboot command in the UI. Do NOT unplug the NAS/power it off etc.
|
||||||
6. Open the control panel - info scree. The coral TPU will now be recognised as a USB Device - google inc
|
6. Open the control panel - info screen. The coral TPU will now be recognized as a USB Device - google inc
|
||||||
7. Start the frigate container. Everything should work now!
|
7. Start the frigate container. Everything should work now!
|
||||||
|
|
||||||
### QNAP NAS
|
### QNAP NAS
|
||||||
|
|
||||||
QNAP NAS devices, such as the TS-253A, may use connected Coral TPU devices if [QuMagie](https://www.qnap.com/en/software/qumagie) is installed along with its QNAP AI Core extension. If any of the features (`facial recognition`, `object recognition`, or `similar photo recognition`) are enabled, Container Station applications such as `Frigate` or `CodeProject.AI Server` will be unable to initialize the TPU device in use.
|
QNAP NAS devices, such as the TS-253A, may use connected Coral TPU devices if [QuMagie](https://www.qnap.com/en/software/qumagie) is installed along with its QNAP AI Core extension. If any of the features (`facial recognition`, `object recognition`, or `similar photo recognition`) are enabled, Container Station applications such as `Frigate` or `CodeProject.AI Server` will be unable to initialize the TPU device in use.
|
||||||
To allow the Coral TPU device to be discovered, the you must either:
|
To allow the Coral TPU device to be discovered, you must either:
|
||||||
|
|
||||||
1. [Disable the AI recognition features in QuMagie](https://docs.qnap.com/application/qumagie/2.x/en-us/configuring-qnap-ai-core-settings-FB13CE03.html),
|
1. [Disable the AI recognition features in QuMagie](https://docs.qnap.com/application/qumagie/2.x/en-us/configuring-qnap-ai-core-settings-FB13CE03.html),
|
||||||
2. Remove the QNAP AI Core extension or
|
2. Remove the QNAP AI Core extension or
|
||||||
@@ -76,7 +76,7 @@ This is an issue due to outdated gasket driver when being used with new linux ke
|
|||||||
|
|
||||||
### Not detected on Raspberry Pi5
|
### Not detected on Raspberry Pi5
|
||||||
|
|
||||||
A kernel update to the RPi5 means an upate to config.txt is required, see [the raspberry pi forum for more info](https://forums.raspberrypi.com/viewtopic.php?t=363682&sid=cb59b026a412f0dc041595951273a9ca&start=25)
|
A kernel update to the RPi5 means an update to config.txt is required, see [the raspberry pi forum for more info](https://forums.raspberrypi.com/viewtopic.php?t=363682&sid=cb59b026a412f0dc041595951273a9ca&start=25)
|
||||||
|
|
||||||
Specifically, add the following to config.txt
|
Specifically, add the following to config.txt
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ dtoverlay=pcie-32bit-dma-pi5
|
|||||||
|
|
||||||
## Only One PCIe Coral Is Detected With Coral Dual EdgeTPU
|
## Only One PCIe Coral Is Detected With Coral Dual EdgeTPU
|
||||||
|
|
||||||
Coral Dual EdgeTPU is one card with two identical TPU cores. Each core has it's own PCIe interface and motherboard needs to have two PCIe busses on the m.2 slot to make them both work.
|
Coral Dual EdgeTPU is one card with two identical TPU cores. Each core has its own PCIe interface and motherboard needs to have two PCIe busses on the m.2 slot to make them both work.
|
||||||
|
|
||||||
E-key slot implemented to full m.2 electromechanical specification has two PCIe busses. Most motherboard manufacturers implement only one PCIe bus in m.2 E-key connector (this is why only one TPU is working). Some SBCs can have only USB bus on m.2 connector, ie none of TPUs will work.
|
E-key slot implemented to full m.2 electromechanical specification has two PCIe busses. Most motherboard manufacturers implement only one PCIe bus in m.2 E-key connector (this is why only one TPU is working). Some SBCs can have only USB bus on m.2 connector, ie none of TPUs will work.
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ You can open `chrome://media-internals/` in another tab and then try to playback
|
|||||||
|
|
||||||
### What do I do if my cameras sub stream is not good enough?
|
### What do I do if my cameras sub stream is not good enough?
|
||||||
|
|
||||||
Frigate generally [recommends cameras with configurable sub streams](/frigate/hardware.md). However, if your camera does not have a sub stream that a suitable resolution, the main stream can be resized.
|
Frigate generally [recommends cameras with configurable sub streams](/frigate/hardware.md). However, if your camera does not have a sub stream that is a suitable resolution, the main stream can be resized.
|
||||||
|
|
||||||
To do this efficiently the following setup is required:
|
To do this efficiently the following setup is required:
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ id: recordings
|
|||||||
title: Recordings Errors
|
title: Recordings Errors
|
||||||
---
|
---
|
||||||
|
|
||||||
|
import FaqItem from "@site/src/components/FaqItem";
|
||||||
|
|
||||||
## Why are my recordings not working? (empty Recordings, "No recordings found for this time")
|
## Why are my recordings not working? (empty Recordings, "No recordings found for this time")
|
||||||
|
|
||||||
If Frigate shows live video but the History view is empty, or you see "No recordings found for this time", the cause is almost always in one of the three categories below. Segments are first written to the RAM cache and are only moved to disk if they match a retention policy _and_ the camera's `record` stream is producing valid, storable video. Work through the categories in order: retention configuration is by far the most common cause.
|
If Frigate shows live video but the History view is empty, or you see "No recordings found for this time", the cause is almost always in one of the three categories below. Segments are first written to the RAM cache and are only moved to disk if they match a retention policy _and_ the camera's `record` stream is producing valid, storable video. Work through the categories in order: retention configuration is by far the most common cause.
|
||||||
@@ -19,7 +21,7 @@ A healthy camera logs lines like `Copied /media/frigate/recordings/{segment_path
|
|||||||
|
|
||||||
### Retention configuration issues
|
### Retention configuration issues
|
||||||
|
|
||||||
#### Recording is enabled, but nothing is saved
|
<FaqItem id="recording-is-enabled-but-nothing-is-saved" question="Recording is enabled, but nothing is saved">
|
||||||
|
|
||||||
This is the single most common cause. Setting `record.enabled: True` on its own does **not** keep any footage: **continuous recording is disabled by default**, and segments in the cache are only moved to disk if they match a configured retention policy. You must configure at least one of `continuous`, `motion`, `alerts`, or `detections` retention.
|
This is the single most common cause. Setting `record.enabled: True` on its own does **not** keep any footage: **continuous recording is disabled by default**, and segments in the cache are only moved to disk if they match a configured retention policy. You must configure at least one of `continuous`, `motion`, `alerts`, or `detections` retention.
|
||||||
|
|
||||||
@@ -34,7 +36,9 @@ record:
|
|||||||
|
|
||||||
See [Recording](/configuration/record) for the full set of common configurations, including reduced-storage and alerts-only setups.
|
See [Recording](/configuration/record) for the full set of common configurations, including reduced-storage and alerts-only setups.
|
||||||
|
|
||||||
#### Motion or event-only recording keeps less than you expect
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="motion-or-event-only-recording-keeps-less-than-you-expect" question="Motion or event-only recording keeps less than you expect">
|
||||||
|
|
||||||
If you only configured `motion`, `alerts`, or `detections` retention (with no `continuous`), Frigate keeps footage selectively based on the retention `mode`:
|
If you only configured `motion`, `alerts`, or `detections` retention (with no `continuous`), Frigate keeps footage selectively based on the retention `mode`:
|
||||||
|
|
||||||
@@ -44,20 +48,26 @@ If you only configured `motion`, `alerts`, or `detections` retention (with no `c
|
|||||||
|
|
||||||
If you expected continuous footage but only configured motion/event retention, add a `continuous` retention period as shown above. To verify motion is actually being detected, watch the motion boxes in the debug view or the Motion Tuner in the UI.
|
If you expected continuous footage but only configured motion/event retention, add a `continuous` retention period as shown above. To verify motion is actually being detected, watch the motion boxes in the debug view or the Motion Tuner in the UI.
|
||||||
|
|
||||||
#### Alert and detection recordings require working object detection
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="alert-and-detection-recordings-require-working-object-detection" question="Alert and detection recordings require working object detection">
|
||||||
|
|
||||||
`alerts` and `detections` retention only keep footage that overlaps a tracked object, so they depend on object detection running:
|
`alerts` and `detections` retention only keep footage that overlaps a tracked object, so they depend on object detection running:
|
||||||
|
|
||||||
- **Detection must be enabled.** If `detect: enabled: False`, no alerts or detections are ever created, so alert/detection retention keeps nothing. (Continuous and motion retention still work with detection disabled.)
|
- **Detection must be enabled.** If `detect: enabled: False`, no alerts or detections are ever created, so alert/detection retention keeps nothing. (Continuous and motion retention still work with detection disabled.)
|
||||||
- **The object must be supported by your model.** If you track an object your model doesn't support (for example `deer` or `license_plate` on the default model), Frigate never detects it and never records for it. Check your logs for warnings such as `... is configured to track ['deer'] objects, which are not supported by the current model` and remove unsupported objects or switch to a model (e.g. [Frigate+](/plus/)) that includes them.
|
- **The object must be supported by your model.** If you track an object your model doesn't support (for example `deer` or `license_plate` on the default model), Frigate never detects it and never records for it. Check your logs for warnings such as `... is configured to track ['deer'] objects, which are not supported by the current model` and remove unsupported objects or switch to a model (e.g. [Frigate+](/plus/)) that includes them.
|
||||||
|
|
||||||
#### You're following an outdated guide
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="youre-following-an-outdated-guide" question="You're following an outdated guide">
|
||||||
|
|
||||||
Configuration keys change between major versions. The old `clips` config, for example, has not existed for a long time. If you copied a config from an old blog post or video, verify every key against the current [reference config](/configuration/advanced/reference).
|
Configuration keys change between major versions. The old `clips` config, for example, has not existed for a long time. If you copied a config from an old blog post or video, verify every key against the current [reference config](/configuration/advanced/reference).
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
### Camera and stream issues
|
### Camera and stream issues
|
||||||
|
|
||||||
#### Incompatible audio codec (recordings silently fail to save)
|
<FaqItem id="incompatible-audio-codec-recordings-silently-fail-to-save" question="Incompatible audio codec (recordings silently fail to save)">
|
||||||
|
|
||||||
Frigate stores recordings in an MP4 container, and some camera audio codecs (most commonly `pcm_alaw`, `pcm_mulaw`, or other G.711 variants) **cannot be placed in an MP4 container**. When this happens, ffmpeg fails to write the segment and no recording is saved, even though the live view works fine. This is a frequent cause on Tapo, TP-Link VIGI, and some Reolink cameras.
|
Frigate stores recordings in an MP4 container, and some camera audio codecs (most commonly `pcm_alaw`, `pcm_mulaw`, or other G.711 variants) **cannot be placed in an MP4 container**. When this happens, ffmpeg fails to write the segment and no recording is saved, even though the live view works fine. This is a frequent cause on Tapo, TP-Link VIGI, and some Reolink cameras.
|
||||||
|
|
||||||
@@ -72,7 +82,9 @@ cameras:
|
|||||||
# or preset-record-generic to record with no audio
|
# or preset-record-generic to record with no audio
|
||||||
```
|
```
|
||||||
|
|
||||||
#### The record stream isn't connecting
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="the-record-stream-isnt-connecting" question="The record stream isn't connecting">
|
||||||
|
|
||||||
A message like `No new recording segments were created for <camera> in the last 120s` means ffmpeg cannot read the `record` stream. To diagnose:
|
A message like `No new recording segments were created for <camera> in the last 120s` means ffmpeg cannot read the `record` stream. To diagnose:
|
||||||
|
|
||||||
@@ -81,17 +93,11 @@ A message like `No new recording segments were created for <camera> in the last
|
|||||||
- Test the exact RTSP URL (with the correct path, port, and credentials) in VLC or `ffplay`.
|
- Test the exact RTSP URL (with the correct path, port, and credentials) in VLC or `ffplay`.
|
||||||
- If you restream through go2rtc, make sure the `record` input path points at the correct go2rtc stream name. Copying a config between cameras without updating the stream name is a common mistake.
|
- If you restream through go2rtc, make sure the `record` input path points at the correct go2rtc stream name. Copying a config between cameras without updating the stream name is a common mistake.
|
||||||
|
|
||||||
#### Recordings play back with no video (or won't play at all)
|
</FaqItem>
|
||||||
|
|
||||||
Frigate copies the `record` stream directly without re-encoding, so playback depends on your browser supporting the camera's codec. H265/HEVC recordings may not be playable in some browsers. If recordings appear as audio-only or a black screen, your camera is likely sending a codec your browser can't decode. Configure the camera to output **H264** for maximum compatibility.
|
|
||||||
|
|
||||||
#### Segments are only ~1 second long
|
|
||||||
|
|
||||||
If the record stream uses a "Smart Codec"/H.264+ mode or changes encoding parameters mid-stream, corrupt timestamps cause segments to be split far too frequently and fill the cache. This produces the "Too many unprocessed recording segments" warning. See [that section below](#i-see-the-message-warning--too-many-unprocessed-recording-segments-in-cache-for-camera-this-likely-indicates-an-issue-with-the-detect-stream) for the full diagnosis.
|
|
||||||
|
|
||||||
### Storage and mounting issues
|
### Storage and mounting issues
|
||||||
|
|
||||||
#### The storage volume isn't mounted correctly
|
<FaqItem id="the-storage-volume-isnt-mounted-correctly" question="The storage volume isn't mounted correctly">
|
||||||
|
|
||||||
If the recordings volume (`/media/frigate`) points at the wrong location, isn't writable, or a network/encrypted mount failed to mount at boot, Frigate cannot save recordings, or it silently writes to the boot drive and then purges aggressively because the drive appears far smaller than expected.
|
If the recordings volume (`/media/frigate`) points at the wrong location, isn't writable, or a network/encrypted mount failed to mount at boot, Frigate cannot save recordings, or it silently writes to the boot drive and then purges aggressively because the drive appears far smaller than expected.
|
||||||
|
|
||||||
@@ -100,21 +106,114 @@ If the recordings volume (`/media/frigate`) points at the wrong location, isn't
|
|||||||
- For a mount that may fail intermittently, protecting the mount point with `chattr +i` on an empty directory forces Frigate to error out (rather than silently writing to the boot drive) when the mount is missing.
|
- For a mount that may fail intermittently, protecting the mount point with `chattr +i` on an empty directory forces Frigate to error out (rather than silently writing to the boot drive) when the mount is missing.
|
||||||
- Check `dmesg` and system logs for filesystem or I/O errors around the time recordings disappeared.
|
- Check `dmesg` and system logs for filesystem or I/O errors around the time recordings disappeared.
|
||||||
|
|
||||||
If recordings _are_ being written but the copy is too slow to keep up, see the ["Unable to keep up with recording segments"](#i-see-the-message-warning--unable-to-keep-up-with-recording-segments-in-cache-for-camera-keeping-the-5-most-recent-segments-out-of-6-and-discarding-the-rest) section below.
|
If recordings _are_ being written but the copy is too slow to keep up, see the ["Unable to keep up with recording segments"](#i-see-the-message-warning--unable-to-keep-up-with-recording-segments-in-cache-for-camera-keeping-the-5-most-recent-segments-out-of-6-and-discarding-the-rest) question below.
|
||||||
|
|
||||||
## I have Frigate configured for motion recording only, but it still seems to be recording even with no motion. Why?
|
</FaqItem>
|
||||||
|
|
||||||
You'll want to:
|
## Recordings won't play back
|
||||||
|
|
||||||
- Make sure your camera's timestamp is masked out with a motion mask. Even if there is no motion occurring in your scene, your motion settings may be sensitive enough to count your timestamp as motion.
|
<FaqItem id="pipeline-error-decode" question={"Recordings won't play back: \"PIPELINE_ERROR_DECODE\" (or \"Media failed to decode\")"}>
|
||||||
- If you have audio detection enabled, keep in mind that audio that is heard above `min_volume` is considered motion.
|
|
||||||
- [Tune your motion detection settings](/configuration/motion_detection) either by editing your config file or by using the UI's Motion Tuner.
|
|
||||||
|
|
||||||
## I see the message: WARNING : Unable to keep up with recording segments in cache for camera. Keeping the 5 most recent segments out of 6 and discarding the rest...
|
When a recording refuses to play in the Frigate UI and you see an error like `Failed to play recordings (error 3): PIPELINE_ERROR_DECODE`, the message is coming from **your browser**, not from Frigate. `PIPELINE_ERROR_DECODE` is emitted exclusively by the media pipeline in **Chromium-based browsers** (Chrome, Edge, Brave, Vivaldi, Opera, Arc, and the Android WebView used by many in-app browsers) when the browser cannot decode a video or audio packet in the recording. WebKit browsers (Safari) report the same underlying problem with a different message, usually `Media failed to decode` or `DECODER_ERROR_NOT_SUPPORTED`.
|
||||||
|
|
||||||
|
Frigate copies the `record` stream to disk **without re-encoding it**, so the browser must decode exactly what your camera produced, and Chromium's decoder is far stricter about malformed or nonstandard media than VLC or ffmpeg.
|
||||||
|
|
||||||
|
:::warning
|
||||||
|
|
||||||
|
The same recording playing perfectly in VLC, decoding cleanly with `ffprobe`/`ffmpeg`, or having a valid MP4 container does **not** mean the browser can decode it. VLC and ffmpeg are much more tolerant of codec quirks and damaged packets than a browser's media pipeline, so a "valid" file can still trigger `PIPELINE_ERROR_DECODE`. This is outside of Frigate's control, because Frigate never modifies the recording stream.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### Step 1: Confirm it is a browser issue
|
||||||
|
|
||||||
|
Open the same recording in **Firefox** or **Safari**. Firefox and Safari both use a different media engine and cannot produce `PIPELINE_ERROR_DECODE`, so if playback works there you have confirmed a client-side codec or decoder problem rather than a bad recording. Switching browsers is a workaround, not a fix; the remaining steps address the root cause so that Chromium browsers work too.
|
||||||
|
|
||||||
|
#### Step 2: Rule out H.265 / HEVC
|
||||||
|
|
||||||
|
Browser support for H.265 (HEVC) is limited and depends on the operating system, GPU, hardware acceleration, and browser version, which makes it the most common cause of this error. Options, in order of reliability:
|
||||||
|
|
||||||
|
- **Record H.264 instead.** Configure the camera's `record`/main stream to output H.264, the most compatible codec across all browsers. See [camera settings recommendations](/configuration/live#camera-settings-recommendations).
|
||||||
|
- **Transcode to H.264 with go2rtc.** If you must keep HEVC on the camera, have go2rtc re-encode the recording stream. This increases CPU usage; add `#hardware` to use the GPU where available:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
go2rtc:
|
||||||
|
streams:
|
||||||
|
your_camera:
|
||||||
|
# transcode video to h264 and audio to aac; #hardware uses the GPU if available
|
||||||
|
- "ffmpeg:rtsp://user:password@CAMERA_IP:554/stream#video=h264#audio=aac#hardware"
|
||||||
|
cameras:
|
||||||
|
your_camera:
|
||||||
|
ffmpeg:
|
||||||
|
inputs:
|
||||||
|
- path: rtsp://127.0.0.1:8554/your_camera
|
||||||
|
input_args: preset-rtsp-restream
|
||||||
|
roles:
|
||||||
|
- record
|
||||||
|
```
|
||||||
|
|
||||||
|
The `#video=h264` parameter only takes effect with the `ffmpeg:` source module; adding it to a plain `rtsp://` go2rtc source does nothing.
|
||||||
|
|
||||||
|
- **Keep HEVC but improve compatibility.** If your browser and OS do support HEVC, set [`apple_compatibility`](/configuration/camera_specific#h265-cameras-via-safari) on the camera. Some players (Safari and other clients) require a specific HEVC stream format that this option corrects:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
cameras:
|
||||||
|
your_camera:
|
||||||
|
ffmpeg:
|
||||||
|
apple_compatibility: true
|
||||||
|
```
|
||||||
|
|
||||||
|
You may also need to enable HEVC and hardware decoding in the browser itself (for example, Chrome's Settings → System → "Use hardware acceleration when available"). HEVC hardware support varies widely by GPU, OS, and browser version.
|
||||||
|
|
||||||
|
#### Step 3: Clean up damaged packets from the camera
|
||||||
|
|
||||||
|
If the error is **intermittent** (the same recording plays after a page refresh, or fails only after playing for a while), the camera is most likely emitting occasional corrupt or malformed packets. Some camera models are more prone to this than others. Routing the stream through go2rtc's `ffmpeg` module often "cleans up" the stream enough for the browser to decode it, even without changing the codec:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
go2rtc:
|
||||||
|
streams:
|
||||||
|
your_camera:
|
||||||
|
- "ffmpeg:rtsp://user:password@CAMERA_IP:554/stream#video=h264#audio=aac"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 4: Fix incompatible or corrupt audio
|
||||||
|
|
||||||
|
Audio is one of the most common culprits, and a decode failure on the audio track fails the whole recording. Make sure the camera outputs **AAC** audio, transcode the audio to AAC with go2rtc (`#audio=aac`), or drop audio entirely. See [Incompatible audio codec](#incompatible-audio-codec-recordings-silently-fail-to-save) for a preset-based way to do this.
|
||||||
|
|
||||||
|
#### Step 5: Avoid "smart" / "+" codecs and check the keyframe interval
|
||||||
|
|
||||||
|
- Disable any **"Smart Codec"**, **"H.264+"**, or **"H.265+"** feature in the camera. These nonstandard modes drop keyframes and change encoding parameters mid-stream, producing exactly the kind of packets a browser refuses to decode. (They also cause [short recording segments](#segments-are-only-1-second-long).)
|
||||||
|
- Set the camera's **I-frame (keyframe) interval equal to the frame rate** (for example `20` for a 20 fps stream). Long keyframe intervals slow the start of playback and make decode errors more likely.
|
||||||
|
|
||||||
|
#### Step 6: Consider bitrate and the client hardware
|
||||||
|
|
||||||
|
The browser decodes the video locally, so a stream that is too demanding can fail on one device while playing on another:
|
||||||
|
|
||||||
|
- A **very high bitrate or resolution** (for example a 4K/8MP HEVC main stream) can overwhelm a low-power tablet, phone, or SBC and stall the decoder. Test the same recording on a desktop; if it plays there, lower the camera's bitrate or record a lower-resolution profile.
|
||||||
|
- Errors that name the client's GPU decoder, such as `VaapiVideoDecoder: failed Initialize()ing the frame pool`, indicate a browser hardware-decode problem. Toggling the browser's "Use hardware acceleration" setting (on or off) often resolves these.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="recordings-play-back-with-no-video-or-wont-play-at-all" question="Recordings play back with no video (or won't play at all)">
|
||||||
|
|
||||||
|
Frigate copies the `record` stream directly without re-encoding, so playback depends on your browser supporting the camera's codec. H265/HEVC recordings may not be playable in some browsers. If recordings appear as audio-only or a black screen, your camera is likely sending a codec your browser can't decode. Configure the camera to output **H264** for maximum compatibility.
|
||||||
|
|
||||||
|
If playback instead fails with an explicit `PIPELINE_ERROR_DECODE` or `Media failed to decode` error, see [Recordings won't play back with "PIPELINE_ERROR_DECODE"](#pipeline-error-decode) above.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Recording cache warnings and errors
|
||||||
|
|
||||||
|
<FaqItem id="segments-are-only-1-second-long" question="Segments are only ~1 second long">
|
||||||
|
|
||||||
|
If the record stream uses a "Smart Codec"/H.264+ mode or changes encoding parameters mid-stream, corrupt timestamps cause segments to be split far too frequently and fill the cache. This produces the "Too many unprocessed recording segments" warning. See [that question below](#i-see-the-message-warning--too-many-unprocessed-recording-segments-in-cache-for-camera-this-likely-indicates-an-issue-with-the-detect-stream) for the full diagnosis.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="i-see-the-message-warning--unable-to-keep-up-with-recording-segments-in-cache-for-camera-keeping-the-5-most-recent-segments-out-of-6-and-discarding-the-rest" question="I see the message: WARNING : Unable to keep up with recording segments in cache for camera. Keeping the 5 most recent segments out of 6 and discarding the rest...">
|
||||||
|
|
||||||
This warning means the recording maintainer cannot move recording segments from the RAM cache to disk fast enough. When the cache fills up, Frigate discards the oldest segments to avoid running out of memory and crashing, so you lose recorded footage. This is almost always a storage throughput or system resource problem. Work through the steps below to identify which.
|
This warning means the recording maintainer cannot move recording segments from the RAM cache to disk fast enough. When the cache fills up, Frigate discards the oldest segments to avoid running out of memory and crashing, so you lose recorded footage. This is almost always a storage throughput or system resource problem. Work through the steps below to identify which.
|
||||||
|
|
||||||
### Step 1: Enable recording debug logging
|
#### Step 1: Enable recording debug logging
|
||||||
|
|
||||||
The first step is to measure how long each segment takes to move from the RAM cache to disk. Enable debug logging for the recording maintainer:
|
The first step is to measure how long each segment takes to move from the RAM cache to disk. Enable debug logging for the recording maintainer:
|
||||||
|
|
||||||
@@ -132,14 +231,14 @@ DEBUG : Copied /media/frigate/recordings/{segment_path} in 0.2 seconds.
|
|||||||
|
|
||||||
Let this run until the warnings begin to appear, so you can confirm whether the disk is actually slowing down at the moment the error occurs.
|
Let this run until the warnings begin to appear, so you can confirm whether the disk is actually slowing down at the moment the error occurs.
|
||||||
|
|
||||||
### Step 2: Interpret the copy times
|
#### Step 2: Interpret the copy times
|
||||||
|
|
||||||
The copy duration tells you which direction to investigate:
|
The copy duration tells you which direction to investigate:
|
||||||
|
|
||||||
- **Consistently longer than ~1 second**: your storage cannot keep up with the incoming recordings. Continue with Steps 3–5 to diagnose the slow storage.
|
- **Consistently longer than ~1 second**: your storage cannot keep up with the incoming recordings. Continue with Steps 3–5 to diagnose the slow storage.
|
||||||
- **Consistently well under 1 second**: storage is fast enough, and the problem is more likely CPU or resource contention. Skip to Step 6.
|
- **Consistently well under 1 second**: storage is fast enough, and the problem is more likely CPU or resource contention. Skip to Step 6.
|
||||||
|
|
||||||
### Step 3: Check RAM, swap, cache, and disk utilization
|
#### Step 3: Check RAM, swap, cache, and disk utilization
|
||||||
|
|
||||||
If CPU, RAM, disk throughput, or bus I/O is insufficient, nothing inside Frigate will help. Review each aspect of available system resources while the warnings are occurring.
|
If CPU, RAM, disk throughput, or bus I/O is insufficient, nothing inside Frigate will help. Review each aspect of available system resources while the warnings are occurring.
|
||||||
|
|
||||||
@@ -175,19 +274,21 @@ services:
|
|||||||
|
|
||||||
NOTE: These are hard limits for the container, so be sure there is enough headroom above what `docker stats` shows for your container. It will immediately halt if it hits `<MAXRAM>`. In general, keeping all cache and tmp filespace in RAM is preferable to disk I/O where possible.
|
NOTE: These are hard limits for the container, so be sure there is enough headroom above what `docker stats` shows for your container. It will immediately halt if it hits `<MAXRAM>`. In general, keeping all cache and tmp filespace in RAM is preferable to disk I/O where possible.
|
||||||
|
|
||||||
### Step 4: Check your storage type
|
#### Step 4: Check your storage type
|
||||||
|
|
||||||
Mounting a network share is a popular option for storing recordings, but it can lead to reduced copy times and cause problems. Some users have found that using `NFS` instead of `SMB` considerably decreased copy times and fixed the issue. It is also important to ensure that the network connection between the device running Frigate and the network share is stable and fast. A saturated or unreliable link will stall copies.
|
Mounting a network share is a popular option for storing recordings, but it can lead to reduced copy times and cause problems. Some users have found that using `NFS` instead of `SMB` considerably decreased copy times and fixed the issue. It is also important to ensure that the network connection between the device running Frigate and the network share is stable and fast. A saturated or unreliable link will stall copies.
|
||||||
|
|
||||||
### Step 5: Check your mount options
|
#### Step 5: Check your mount options
|
||||||
|
|
||||||
Some users found that mounting a drive via `fstab` with the `sync` option dramatically reduced performance and led to this issue. Using `async` instead greatly reduced copy times.
|
Some users found that mounting a drive via `fstab` with the `sync` option dramatically reduced performance and led to this issue. Using `async` instead greatly reduced copy times.
|
||||||
|
|
||||||
### Step 6: Rule out CPU load
|
#### Step 6: Rule out CPU load
|
||||||
|
|
||||||
If the copy times are consistently under 1 second but you still see the warning, the machine's CPU load is likely too high for Frigate to have the resources to keep up. Try temporarily shutting down other services, and any resource-intensive Frigate features, to see if the issue improves.
|
If the copy times are consistently under 1 second but you still see the warning, the machine's CPU load is likely too high for Frigate to have the resources to keep up. Try temporarily shutting down other services, and any resource-intensive Frigate features, to see if the issue improves.
|
||||||
|
|
||||||
## I see the message: WARNING : Too many unprocessed recording segments in cache for camera. This likely indicates an issue with the detect stream...
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="i-see-the-message-warning--too-many-unprocessed-recording-segments-in-cache-for-camera-this-likely-indicates-an-issue-with-the-detect-stream" question="I see the message: WARNING : Too many unprocessed recording segments in cache for camera. This likely indicates an issue with the detect stream...">
|
||||||
|
|
||||||
This warning means that the detect stream for the affected camera has fallen behind or stopped processing frames. Frigate's recording cache holds segments waiting to be analyzed by the detector. When more than 6 segments pile up without being processed, Frigate discards the oldest ones to prevent the cache from filling up.
|
This warning means that the detect stream for the affected camera has fallen behind or stopped processing frames. Frigate's recording cache holds segments waiting to be analyzed by the detector. When more than 6 segments pile up without being processed, Frigate discards the oldest ones to prevent the cache from filling up.
|
||||||
|
|
||||||
@@ -197,11 +298,11 @@ This error is a **symptom**, not the root cause. The actual cause is always logg
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Step 1: Get the full logs
|
#### Step 1: Get the full logs
|
||||||
|
|
||||||
Collect complete Frigate logs from startup through the first occurrence of the error. Look for errors or warnings that appear **before** the "Too many unprocessed" messages begin. That is where the root cause will be found.
|
Collect complete Frigate logs from startup through the first occurrence of the error. Look for errors or warnings that appear **before** the "Too many unprocessed" messages begin. That is where the root cause will be found.
|
||||||
|
|
||||||
### Step 2: Check the cache directory
|
#### Step 2: Check the cache directory
|
||||||
|
|
||||||
Exec into the Frigate container and inspect the recording cache:
|
Exec into the Frigate container and inspect the recording cache:
|
||||||
|
|
||||||
@@ -211,7 +312,7 @@ docker exec -it frigate ls -la /tmp/cache
|
|||||||
|
|
||||||
Each camera should have a small number of `.mp4` segment files. If one camera has significantly more files than others, that camera is the source of the problem. A problem with a single camera can cascade and cause all cameras to show this error.
|
Each camera should have a small number of `.mp4` segment files. If one camera has significantly more files than others, that camera is the source of the problem. A problem with a single camera can cascade and cause all cameras to show this error.
|
||||||
|
|
||||||
### Step 3: Verify segment duration
|
#### Step 3: Verify segment duration
|
||||||
|
|
||||||
Recording segments should be approximately 10 seconds long. Run `ffprobe` on segments in the cache to check:
|
Recording segments should be approximately 10 seconds long. Run `ffprobe` on segments in the cache to check:
|
||||||
|
|
||||||
@@ -233,7 +334,7 @@ You don't have to run `ffprobe` by hand to catch this. Open a camera's **Camera
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Step 4: Check for a stuck detector
|
#### Step 4: Check for a stuck detector
|
||||||
|
|
||||||
If the detect stream is not processing frames, segments will accumulate. Common causes:
|
If the detect stream is not processing frames, segments will accumulate. Common causes:
|
||||||
|
|
||||||
@@ -242,7 +343,7 @@ If the detect stream is not processing frames, segments will accumulate. Common
|
|||||||
- **Model too large**: Use smaller model variants (e.g., YOLO `s` or `t` size, not `e` or `x`). Use 320x320 input size rather than 640x640 unless you have a powerful dedicated detector.
|
- **Model too large**: Use smaller model variants (e.g., YOLO `s` or `t` size, not `e` or `x`). Use 320x320 input size rather than 640x640 unless you have a powerful dedicated detector.
|
||||||
- **Virtualization**: Running Frigate in a VM (especially Proxmox) can cause the detector to hang or stall. This is a known issue with GPU/TPU passthrough in virtualized environments and is not something Frigate can fix. Running Frigate in Docker on bare metal is recommended.
|
- **Virtualization**: Running Frigate in a VM (especially Proxmox) can cause the detector to hang or stall. This is a known issue with GPU/TPU passthrough in virtualized environments and is not something Frigate can fix. Running Frigate in Docker on bare metal is recommended.
|
||||||
|
|
||||||
### Step 5: Check for GPU hangs
|
#### Step 5: Check for GPU hangs
|
||||||
|
|
||||||
On the host machine, check `dmesg` for GPU-related errors:
|
On the host machine, check `dmesg` for GPU-related errors:
|
||||||
|
|
||||||
@@ -252,7 +353,7 @@ dmesg | grep -i -E "gpu|drm|reset|hang"
|
|||||||
|
|
||||||
Messages like `trying reset from guc_exec_queue_timedout_job` or similar GPU reset/hang messages indicate a driver or hardware issue. Ensure your kernel and GPU drivers (especially Intel) are up to date.
|
Messages like `trying reset from guc_exec_queue_timedout_job` or similar GPU reset/hang messages indicate a driver or hardware issue. Ensure your kernel and GPU drivers (especially Intel) are up to date.
|
||||||
|
|
||||||
### Step 6: Verify hardware acceleration configuration
|
#### Step 6: Verify hardware acceleration configuration
|
||||||
|
|
||||||
An incorrect `hwaccel_args` preset can cause ffmpeg to fail silently or consume excessive CPU, starving the detector of resources.
|
An incorrect `hwaccel_args` preset can cause ffmpeg to fail silently or consume excessive CPU, starving the detector of resources.
|
||||||
|
|
||||||
@@ -260,11 +361,11 @@ An incorrect `hwaccel_args` preset can cause ffmpeg to fail silently or consume
|
|||||||
- For h265 cameras, use the corresponding h265 preset (e.g., `preset-intel-qsv-h265`).
|
- For h265 cameras, use the corresponding h265 preset (e.g., `preset-intel-qsv-h265`).
|
||||||
- Note that `hwaccel_args` are only relevant for the detect stream. Frigate does not decode the record stream.
|
- Note that `hwaccel_args` are only relevant for the detect stream. Frigate does not decode the record stream.
|
||||||
|
|
||||||
### Step 7: Verify go2rtc stream configuration
|
#### Step 7: Verify go2rtc stream configuration
|
||||||
|
|
||||||
Ensure that the ffmpeg source names in your go2rtc configuration match the correct camera stream. A misconfigured stream name (e.g., copying a config from one camera to another without updating the stream reference) will cause the wrong stream to be used or the stream to fail entirely.
|
Ensure that the ffmpeg source names in your go2rtc configuration match the correct camera stream. A misconfigured stream name (e.g., copying a config from one camera to another without updating the stream reference) will cause the wrong stream to be used or the stream to fail entirely.
|
||||||
|
|
||||||
### Step 8: Check system resources
|
#### Step 8: Check system resources
|
||||||
|
|
||||||
If none of the above apply, the issue may be a general resource constraint. Monitor the following on your host:
|
If none of the above apply, the issue may be a general resource constraint. Monitor the following on your host:
|
||||||
|
|
||||||
@@ -275,7 +376,9 @@ If none of the above apply, the issue may be a general resource constraint. Moni
|
|||||||
|
|
||||||
Try temporarily disabling resource-intensive features like `genai` and `face_recognition` to see if the issue resolves. This can help isolate whether the detector is being starved of resources.
|
Try temporarily disabling resource-intensive features like `genai` and `face_recognition` to see if the issue resolves. This can help isolate whether the detector is being starved of resources.
|
||||||
|
|
||||||
## I see the message: ERROR : Error occurred when attempting to maintain recording cache
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="i-see-the-message-error--error-occurred-when-attempting-to-maintain-recording-cache" question="I see the message: ERROR : Error occurred when attempting to maintain recording cache">
|
||||||
|
|
||||||
This message means the recording maintainer hit an error while moving segments from the cache to disk. It is a **generic wrapper**: the actual cause is always logged on the **very next line**. Frigate usually recovers and keeps running, but any affected segments are lost, so it is worth resolving.
|
This message means the recording maintainer hit an error while moving segments from the cache to disk. It is a **generic wrapper**: the actual cause is always logged on the **very next line**. Frigate usually recovers and keeps running, but any affected segments are lost, so it is worth resolving.
|
||||||
|
|
||||||
@@ -287,27 +390,57 @@ Always read the line immediately following this message. `Error occurred when at
|
|||||||
|
|
||||||
Because these are operating-system-level errors, they must be resolved on the **host**, not within Frigate's configuration. The most common underlying errors are below.
|
Because these are operating-system-level errors, they must be resolved on the **host**, not within Frigate's configuration. The most common underlying errors are below.
|
||||||
|
|
||||||
### [Errno 28] No space left on device
|
#### [Errno 28] No space left on device
|
||||||
|
|
||||||
The filesystem Frigate is writing to is full. Things to check:
|
The filesystem Frigate is writing to is full. Things to check:
|
||||||
|
|
||||||
- **The recordings volume is genuinely full.** Check free space on the host with `df -h` for the path mapped to `/media/frigate`, and review the **Storage** page in the Frigate UI.
|
- **The recordings volume is genuinely full.** Check free space on the host with `df -h` for the path mapped to `/media/frigate`, and review the **Storage** page in the Frigate UI.
|
||||||
- **The disk shows free space but is still "full".** This usually means the filesystem has run out of **inodes** (check with `df -i`), or recordings are landing on a different, smaller filesystem than you expect because of an incorrect bind mount. See [The storage volume isn't mounted correctly](#the-storage-volume-isnt-mounted-correctly) above.
|
- **The disk shows free space but is still "full".** This usually means the filesystem has run out of **inodes** (check with `df -i`), or recordings are landing on a different, smaller filesystem than you expect because of an incorrect bind mount. See [The storage volume isn't mounted correctly](#the-storage-volume-isnt-mounted-correctly) above.
|
||||||
- **`/tmp/cache` is full.** If you mounted `/tmp/cache` as a small `tmpfs`, a backlog of segments can fill it. Increase the tmpfs size, or address whatever is causing segments to pile up (see the [Too many unprocessed recording segments](#i-see-the-message-warning--too-many-unprocessed-recording-segments-in-cache-for-camera-this-likely-indicates-an-issue-with-the-detect-stream) section above).
|
- **`/tmp/cache` is full.** If you mounted `/tmp/cache` as a small `tmpfs`, a backlog of segments can fill it. Increase the tmpfs size, or address whatever is causing segments to pile up (see the [Too many unprocessed recording segments](#i-see-the-message-warning--too-many-unprocessed-recording-segments-in-cache-for-camera-this-likely-indicates-an-issue-with-the-detect-stream) question above).
|
||||||
- **The host blocks writes before Frigate can purge.** On some systems (for example Unraid with a fill-up threshold), the host stops writes before Frigate's emergency cleanup can run. Leave more headroom on the volume, or lower your retention so Frigate purges sooner.
|
- **The host blocks writes before Frigate can purge.** On some systems (for example Unraid with a fill-up threshold), the host stops writes before Frigate's emergency cleanup can run. Leave more headroom on the volume, or lower your retention so Frigate purges sooner.
|
||||||
|
|
||||||
### [Errno 17] File exists (with ffmpeg "Error writing trailer" or "unable to re-open output file")
|
#### [Errno 17] File exists (with ffmpeg "Error writing trailer" or "unable to re-open output file")
|
||||||
|
|
||||||
Errors like `[Errno 17] File exists: '/media/frigate/recordings/.../<camera>'`, often alongside ffmpeg errors such as `Unable to re-open ... output file for shifting data` or `Error writing trailer: No such file or directory`, are a hallmark of an **unreliable network share** (NFS or SMB). The mount is dropping, serving stale directory entries, or mishandling file locking.
|
Errors like `[Errno 17] File exists: '/media/frigate/recordings/.../<camera>'`, often alongside ffmpeg errors such as `Unable to re-open ... output file for shifting data` or `Error writing trailer: No such file or directory`, are a hallmark of an **unreliable network share** (NFS or SMB). The mount is dropping, serving stale directory entries, or mishandling file locking.
|
||||||
|
|
||||||
- Confirm the network connection to the NAS is stable and fast. An intermittent link produces these errors sporadically.
|
- Confirm the network connection to the NAS is stable and fast. An intermittent link produces these errors sporadically.
|
||||||
- Prefer **NFS over SMB** for the recordings mount; several users have found NFS more reliable and faster.
|
- Prefer **NFS over SMB** for the recordings mount; several users have found NFS more reliable and faster.
|
||||||
- Review your `fstab`/mount options for settings that hurt consistency or performance (see the `sync` vs `async` note in the [Unable to keep up with recording segments](#i-see-the-message-warning--unable-to-keep-up-with-recording-segments-in-cache-for-camera-keeping-the-5-most-recent-segments-out-of-6-and-discarding-the-rest) section above).
|
- Review your `fstab`/mount options for settings that hurt consistency or performance (see the `sync` vs `async` note in the [Unable to keep up with recording segments](#i-see-the-message-warning--unable-to-keep-up-with-recording-segments-in-cache-for-camera-keeping-the-5-most-recent-segments-out-of-6-and-discarding-the-rest) question above).
|
||||||
- Enable `frigate.record.maintainer` debug logging to confirm whether the errors line up with the share becoming unavailable.
|
- Enable `frigate.record.maintainer` debug logging to confirm whether the errors line up with the share becoming unavailable.
|
||||||
|
|
||||||
### Errors referencing a camera you manually renamed or removed
|
#### Errors referencing a camera you manually renamed or removed
|
||||||
|
|
||||||
If the next-line error references a camera name that no longer exists in your config, orphaned data is left over from a rename or removal in a persistent `/tmp/cache` volume.
|
If the next-line error references a camera name that no longer exists in your config, orphaned data is left over from a rename or removal in a persistent `/tmp/cache` volume.
|
||||||
|
|
||||||
- Using a `tmpfs` mount for `/tmp/cache` as recommended in the [installation docs](/frigate/installation#storage) prevents stale cache files under the old camera name from surviving a restart, which avoids this issue entirely.
|
- Using a `tmpfs` mount for `/tmp/cache` as recommended in the [installation docs](/frigate/installation#storage) prevents stale cache files under the old camera name from surviving a restart, which avoids this issue entirely.
|
||||||
- If errors persist, stop Frigate and remove any leftover segments for the old camera name from `/tmp/cache`.
|
- If errors persist, stop Frigate and remove any leftover segments for the old camera name from `/tmp/cache`.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
## Other recording questions
|
||||||
|
|
||||||
|
<FaqItem id="i-have-frigate-configured-for-motion-recording-only-but-it-still-seems-to-be-recording-even-with-no-motion-why" question="I have Frigate configured for motion recording only, but it still seems to be recording even with no motion. Why?">
|
||||||
|
|
||||||
|
You'll want to:
|
||||||
|
|
||||||
|
- Make sure your camera's timestamp is masked out with a motion mask. Even if there is no motion occurring in your scene, your motion settings may be sensitive enough to count your timestamp as motion.
|
||||||
|
- If you have audio detection enabled, keep in mind that audio that is heard above `min_volume` is considered motion.
|
||||||
|
- [Tune your motion detection settings](/configuration/motion_detection) either by editing your config file or by using the UI's Motion Tuner.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|
||||||
|
<FaqItem id="my-timeline-previews-are-black-after-restarting-frigate-or-recreating-the-container" question="My timeline previews are black after restarting Frigate or recreating the container. Why?">
|
||||||
|
|
||||||
|
The scrubbing previews (the timelapse clips shown when dragging the History timeline, the secondary-camera previews, and the preview that plays when hovering a review card) are not recorded continuously. Frigate caches low-resolution preview frames in `/tmp/cache` throughout each hour and only assembles them into a finished preview clip **at the top of the hour**.
|
||||||
|
|
||||||
|
In the recommended configuration, `/tmp/cache` is a small in-memory (`tmpfs`) area. When Frigate starts, it tries to restore the current hour's cached frames, so a **soft restart from the UI** preserves them. But if you recreate the Docker container or stop Frigate forcibly by any other means partway through an hour, the in-memory cache is discarded, so no preview clip is produced for that partial hour.
|
||||||
|
|
||||||
|
This is expected behavior, not a bug:
|
||||||
|
|
||||||
|
- Previews for hours that already completed and were written to disk are unaffected.
|
||||||
|
- The next full hour after a restart will generate previews normally.
|
||||||
|
- This is unrelated to `shm_size`; increasing shared memory does not change it.
|
||||||
|
|
||||||
|
To avoid the gap, use the **Restart Frigate** button in the UI's Settings menu rather than recreating the container when possible.
|
||||||
|
|
||||||
|
</FaqItem>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ To act on many objects at once, Ctrl/Cmd-click or right-click to start a selecti
|
|||||||
|
|
||||||
1. Semantic Search is used in conjunction with the other filters available on the Explore page. Use a combination of traditional filtering and Semantic Search for the best results.
|
1. Semantic Search is used in conjunction with the other filters available on the Explore page. Use a combination of traditional filtering and Semantic Search for the best results.
|
||||||
2. Use the thumbnail search type when searching for particular objects in the scene. Use the description search type when attempting to discern the intent of your object.
|
2. Use the thumbnail search type when searching for particular objects in the scene. Use the description search type when attempting to discern the intent of your object.
|
||||||
3. Because of how the AI models Frigate uses have been trained, the comparison between text and image embedding distances generally means that with multi-modal (`thumbnail` and `description`) searches, results matching `description` will appear first, even if a `thumbnail` embedding may be a better match. Play with the "Search Type" setting to help find what you are looking for. Note that if you are generating descriptions for specific objects or zones only, this may cause search results to prioritize the objects with descriptions even if the the ones without them are more relevant.
|
3. Because of how the AI models Frigate uses have been trained, the comparison between text and image embedding distances generally means that with multi-modal (`thumbnail` and `description`) searches, results matching `description` will appear first, even if a `thumbnail` embedding may be a better match. Play with the "Search Type" setting to help find what you are looking for. Note that if you are generating descriptions for specific objects or zones only, this may cause search results to prioritize the objects with descriptions even if the ones without them are more relevant.
|
||||||
4. Make your search language and tone closely match exactly what you're looking for. If you are using thumbnail search, **phrase your query as an image caption**. Searching for "red car" may not work as well as "red sedan driving down a residential street on a sunny day".
|
4. Make your search language and tone closely match exactly what you're looking for. If you are using thumbnail search, **phrase your query as an image caption**. Searching for "red car" may not work as well as "red sedan driving down a residential street on a sunny day".
|
||||||
5. Semantic search on thumbnails tends to return better results when matching large subjects that take up most of the frame. Small things like "cat" tend to not work well.
|
5. Semantic search on thumbnails tends to return better results when matching large subjects that take up most of the frame. Small things like "cat" tend to not work well.
|
||||||
6. Experiment! Find a tracked object you want to test and start typing keywords and phrases to see what works for you.
|
6. Experiment! Find a tracked object you want to test and start typing keywords and phrases to see what works for you.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ All of your exports live on the **Exports** page, reachable from the main naviga
|
|||||||
- **Rename** it, and
|
- **Rename** it, and
|
||||||
- **Delete** it: deleting is the only way an export is removed.
|
- **Delete** it: deleting is the only way an export is removed.
|
||||||
|
|
||||||
You can also select multiple exports at once to **delete** them in bulk, or to **add them to** (or **remove them from**) a [case](#cases).
|
You can also select multiple exports at once to **delete** them in bulk, or to **add them to** (or **remove them from**) a [case](#cases). To download multiple exports as a zip archive, add them to a **case** and use the Download button there.
|
||||||
|
|
||||||
## Cases
|
## Cases
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ You can optionally overlay live streaming statistics (stream type, bandwidth, la
|
|||||||
|
|
||||||
Right-clicking (or long-pressing) a camera tile opens a context menu with quick controls: an **audio volume** control for streams that support audio, **Mute / Unmute all cameras**, **show or hide streaming statistics**, the **debug view**, **notification** options, and, for admins, turning the camera on or off. If the audio control doesn't appear, see [Audio Support](/configuration/live#audio-support). Audio requires go2rtc configured with a compatible codec.
|
Right-clicking (or long-pressing) a camera tile opens a context menu with quick controls: an **audio volume** control for streams that support audio, **Mute / Unmute all cameras**, **show or hide streaming statistics**, the **debug view**, **notification** options, and, for admins, turning the camera on or off. If the audio control doesn't appear, see [Audio Support](/configuration/live#audio-support). Audio requires go2rtc configured with a compatible codec.
|
||||||
|
|
||||||
A **Low-bandwidth mode** notice may also appear in the context menu with a **Reset** option appears when Frigate has fallen back to the lower-quality jsmpeg stream. See the [Live view FAQ](/configuration/live#live-view-faq) for why this happens.
|
A **Low-bandwidth mode** notice may also appear in the context menu with a **Reset** option when Frigate has fallen back to the lower-quality jsmpeg stream. See the [Live view FAQ](/configuration/live#live-view-faq) for why this happens.
|
||||||
|
|
||||||
For non-default groups, the context menu also exposes **Streaming Settings** for that camera, which let you choose:
|
For non-default groups, the context menu also exposes **Streaming Settings** for that camera, which let you choose:
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const sidebars: SidebarsConfig = {
|
|||||||
],
|
],
|
||||||
Configuration: [
|
Configuration: [
|
||||||
"configuration/config",
|
"configuration/config",
|
||||||
|
"configuration/config_overrides",
|
||||||
{
|
{
|
||||||
type: "category",
|
type: "category",
|
||||||
label: "Detectors",
|
label: "Detectors",
|
||||||
@@ -165,6 +166,7 @@ const sidebars: SidebarsConfig = {
|
|||||||
],
|
],
|
||||||
Troubleshooting: [
|
Troubleshooting: [
|
||||||
"troubleshooting/faqs",
|
"troubleshooting/faqs",
|
||||||
|
"troubleshooting/common_errors",
|
||||||
"troubleshooting/go2rtc",
|
"troubleshooting/go2rtc",
|
||||||
"troubleshooting/recordings",
|
"troubleshooting/recordings",
|
||||||
"troubleshooting/dummy-camera",
|
"troubleshooting/dummy-camera",
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import Heading from "@theme/Heading";
|
||||||
|
import styles from "./styles.module.css";
|
||||||
|
|
||||||
|
// A single FAQ entry.
|
||||||
|
//
|
||||||
|
// The question is a real anchored heading (via @theme/Heading), so on desktop
|
||||||
|
// it gets the standard hover "#" hash link and the answer is always shown. On
|
||||||
|
// mobile the heading text is a button that toggles its answer, keeping long
|
||||||
|
// FAQ pages short. The desktop/mobile split is pure CSS (Docusaurus breakpoint:
|
||||||
|
// 996px), so there is no hydration flash. The answer is always rendered into
|
||||||
|
// the DOM, so search engines and the docs AI bot can read it regardless of
|
||||||
|
// layout or collapsed state. The heading id resolves deep links on both layouts
|
||||||
|
// and auto-expands the entry on mobile when it is the link target.
|
||||||
|
export default function FaqItem({ id, question, children }) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const openIfTargeted = () => {
|
||||||
|
if (window.location.hash === `#${id}`) {
|
||||||
|
setOpen(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
openIfTargeted();
|
||||||
|
window.addEventListener("hashchange", openIfTargeted);
|
||||||
|
return () => window.removeEventListener("hashchange", openIfTargeted);
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
const toggle = () => {
|
||||||
|
const next = !open;
|
||||||
|
setOpen(next);
|
||||||
|
// Reflect the entry in the URL like clicking the heading anchor, so an
|
||||||
|
// opened answer is shareable. Use replaceState to avoid history spam and
|
||||||
|
// an abrupt scroll. Clear it on close if it currently points here.
|
||||||
|
if (next) {
|
||||||
|
if (window.location.hash !== `#${id}`) {
|
||||||
|
window.history.replaceState(null, "", `#${id}`);
|
||||||
|
}
|
||||||
|
} else if (window.location.hash === `#${id}`) {
|
||||||
|
window.history.replaceState(
|
||||||
|
null,
|
||||||
|
"",
|
||||||
|
window.location.pathname + window.location.search,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.item} data-open={open || undefined}>
|
||||||
|
<Heading as="h4" id={id} className={styles.heading}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={styles.toggle}
|
||||||
|
aria-expanded={open}
|
||||||
|
aria-controls={`${id}-content`}
|
||||||
|
onClick={toggle}
|
||||||
|
>
|
||||||
|
<span className={styles.question}>{question}</span>
|
||||||
|
</button>
|
||||||
|
</Heading>
|
||||||
|
<div id={`${id}-content`} className={styles.content}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* FAQ entry: collapsible on mobile, static heading + expanded answer on
|
||||||
|
* desktop. The split is pure CSS (Docusaurus breakpoint: 996px) so there is
|
||||||
|
* no hydration flash. The answer is always rendered into the DOM, so search
|
||||||
|
* engines and the docs AI bot can read it regardless of layout or state.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.item {
|
||||||
|
scroll-margin-top: calc(var(--ifm-navbar-height) + 1rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.heading {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile: the heading text is a full-width clickable toggle row. */
|
||||||
|
.toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.85rem 0;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid var(--ifm-color-emphasis-200);
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
font: inherit;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle::before {
|
||||||
|
content: "";
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 0.5rem;
|
||||||
|
height: 0.5rem;
|
||||||
|
border-right: 2px solid currentColor;
|
||||||
|
border-bottom: 2px solid currentColor;
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
transition: transform var(--ifm-transition-fast, 200ms) ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item[data-open] .toggle::before {
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.question {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: none;
|
||||||
|
padding: 0 0 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item[data-open] .content {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the hover hash link on mobile (no hover; avoids a stray empty line). */
|
||||||
|
.heading :global(.hash-link) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Desktop: render as a normal expanded heading + answer. */
|
||||||
|
@media (min-width: 997px) {
|
||||||
|
.heading {
|
||||||
|
margin: 1.75rem 0 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
display: inline;
|
||||||
|
width: auto;
|
||||||
|
padding: 0;
|
||||||
|
border: none;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle::before {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: block;
|
||||||
|
padding: 0 0 0.5rem 1rem;
|
||||||
|
border-left: 2px solid var(--ifm-color-emphasis-200);
|
||||||
|
}
|
||||||
|
|
||||||
|
.heading :global(.hash-link) {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+5
@@ -8244,6 +8244,11 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
provider:
|
provider:
|
||||||
$ref: '#/components/schemas/GenAIProviderEnum'
|
$ref: '#/components/schemas/GenAIProviderEnum'
|
||||||
|
name:
|
||||||
|
anyOf:
|
||||||
|
- type: string
|
||||||
|
- type: 'null'
|
||||||
|
title: Name
|
||||||
api_key:
|
api_key:
|
||||||
anyOf:
|
anyOf:
|
||||||
- type: string
|
- type: string
|
||||||
|
|||||||
+16
-16
@@ -31,6 +31,7 @@ from frigate.api.auth import (
|
|||||||
get_allowed_cameras_for_filter,
|
get_allowed_cameras_for_filter,
|
||||||
require_role,
|
require_role,
|
||||||
)
|
)
|
||||||
|
from frigate.api.config_util import swap_runtime_config
|
||||||
from frigate.api.defs.query.app_query_parameters import AppTimelineHourlyQueryParameters
|
from frigate.api.defs.query.app_query_parameters import AppTimelineHourlyQueryParameters
|
||||||
from frigate.api.defs.request.app_body import (
|
from frigate.api.defs.request.app_body import (
|
||||||
AppConfigSetBody,
|
AppConfigSetBody,
|
||||||
@@ -195,7 +196,7 @@ def genai_models(request: Request):
|
|||||||
"before saving the configuration."
|
"before saving the configuration."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
async def genai_probe(body: GenAIProbeBody):
|
async def genai_probe(request: Request, body: GenAIProbeBody):
|
||||||
load_providers()
|
load_providers()
|
||||||
|
|
||||||
provider_cls = PROVIDERS.get(body.provider)
|
provider_cls = PROVIDERS.get(body.provider)
|
||||||
@@ -205,6 +206,13 @@ async def genai_probe(body: GenAIProbeBody):
|
|||||||
content={"success": False, "message": "Unknown provider"},
|
content={"success": False, "message": "Unknown provider"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
api_key = body.api_key
|
||||||
|
if api_key == REDACTED_CREDENTIAL_SENTINEL:
|
||||||
|
saved_cfg = (
|
||||||
|
request.app.frigate_config.genai.get(body.name) if body.name else None
|
||||||
|
)
|
||||||
|
api_key = saved_cfg.api_key if saved_cfg else None
|
||||||
|
|
||||||
# The OpenAI-compatible SDKs accept "timeout" as a constructor kwarg via
|
# The OpenAI-compatible SDKs accept "timeout" as a constructor kwarg via
|
||||||
# provider_options; other plugins use GenAIClient.timeout passed below.
|
# provider_options; other plugins use GenAIClient.timeout passed below.
|
||||||
# Don't inject timeout for Gemini — its HttpOptions interprets the value
|
# Don't inject timeout for Gemini — its HttpOptions interprets the value
|
||||||
@@ -216,7 +224,7 @@ async def genai_probe(body: GenAIProbeBody):
|
|||||||
try:
|
try:
|
||||||
transient_cfg = GenAIConfig(
|
transient_cfg = GenAIConfig(
|
||||||
provider=body.provider,
|
provider=body.provider,
|
||||||
api_key=body.api_key,
|
api_key=api_key,
|
||||||
base_url=body.base_url,
|
base_url=body.base_url,
|
||||||
provider_options=probe_provider_options,
|
provider_options=probe_provider_options,
|
||||||
# model is required by the schema but irrelevant for listing.
|
# model is required by the schema but irrelevant for listing.
|
||||||
@@ -915,19 +923,7 @@ def config_set(request: Request, body: AppConfigSetBody):
|
|||||||
|
|
||||||
if body.requires_restart == 0 or body.update_topic:
|
if body.requires_restart == 0 or body.update_topic:
|
||||||
old_config: FrigateConfig = request.app.frigate_config
|
old_config: FrigateConfig = request.app.frigate_config
|
||||||
request.app.frigate_config = config
|
swap_runtime_config(request.app, config)
|
||||||
request.app.genai_manager.update_config(config)
|
|
||||||
|
|
||||||
if request.app.profile_manager is not None:
|
|
||||||
request.app.profile_manager.update_config(config)
|
|
||||||
|
|
||||||
if request.app.stats_emitter is not None:
|
|
||||||
request.app.stats_emitter.config = config
|
|
||||||
|
|
||||||
if request.app.dispatcher is not None:
|
|
||||||
request.app.dispatcher.config = config
|
|
||||||
for comm in request.app.dispatcher.comms:
|
|
||||||
comm.config = config
|
|
||||||
|
|
||||||
if body.update_topic:
|
if body.update_topic:
|
||||||
if body.update_topic.startswith("config/cameras/"):
|
if body.update_topic.startswith("config/cameras/"):
|
||||||
@@ -971,7 +967,11 @@ def config_set(request: Request, body: AppConfigSetBody):
|
|||||||
content=(
|
content=(
|
||||||
{
|
{
|
||||||
"success": True,
|
"success": True,
|
||||||
"message": "Config successfully updated, restart to apply",
|
"message": (
|
||||||
|
"Config successfully updated"
|
||||||
|
if body.requires_restart == 0
|
||||||
|
else "Config successfully updated, restart to apply"
|
||||||
|
),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
status_code=200,
|
status_code=200,
|
||||||
|
|||||||
+13
-5
@@ -415,7 +415,7 @@ def create_encoded_jwt(user, role, expiration, secret):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def set_jwt_cookie(response: Response, cookie_name, encoded_jwt, expiration, secure):
|
def set_jwt_cookie(response: Response, cookie_name, encoded_jwt, max_age, secure):
|
||||||
# TODO: ideally this would set secure as well, but that requires TLS
|
# TODO: ideally this would set secure as well, but that requires TLS
|
||||||
# SameSite is intentionally left unset (browsers default to Lax). Setting
|
# SameSite is intentionally left unset (browsers default to Lax). Setting
|
||||||
# SameSite=Lax/Strict would stop the cookie from being sent in cross-origin
|
# SameSite=Lax/Strict would stop the cookie from being sent in cross-origin
|
||||||
@@ -427,7 +427,7 @@ def set_jwt_cookie(response: Response, cookie_name, encoded_jwt, expiration, sec
|
|||||||
key=cookie_name,
|
key=cookie_name,
|
||||||
value=encoded_jwt,
|
value=encoded_jwt,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
expires=expiration,
|
max_age=max_age,
|
||||||
secure=secure,
|
secure=secure,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -762,7 +762,7 @@ def auth(request: Request):
|
|||||||
success_response,
|
success_response,
|
||||||
JWT_COOKIE_NAME,
|
JWT_COOKIE_NAME,
|
||||||
new_encoded_jwt,
|
new_encoded_jwt,
|
||||||
new_expiration,
|
JWT_SESSION_LENGTH,
|
||||||
JWT_COOKIE_SECURE,
|
JWT_COOKIE_SECURE,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -875,7 +875,11 @@ def login(request: Request, body: AppPostLoginBody):
|
|||||||
encoded_jwt = create_encoded_jwt(user, role, expiration, request.app.jwt_token)
|
encoded_jwt = create_encoded_jwt(user, role, expiration, request.app.jwt_token)
|
||||||
response = Response("", 200)
|
response = Response("", 200)
|
||||||
set_jwt_cookie(
|
set_jwt_cookie(
|
||||||
response, JWT_COOKIE_NAME, encoded_jwt, expiration, JWT_COOKIE_SECURE
|
response,
|
||||||
|
JWT_COOKIE_NAME,
|
||||||
|
encoded_jwt,
|
||||||
|
JWT_SESSION_LENGTH,
|
||||||
|
JWT_COOKIE_SECURE,
|
||||||
)
|
)
|
||||||
# Clear admin_first_time_login flag after successful admin login so the
|
# Clear admin_first_time_login flag after successful admin login so the
|
||||||
# UI stops showing the first-time login documentation link.
|
# UI stops showing the first-time login documentation link.
|
||||||
@@ -1037,7 +1041,11 @@ async def update_password(
|
|||||||
)
|
)
|
||||||
# Set new JWT cookie on response
|
# Set new JWT cookie on response
|
||||||
set_jwt_cookie(
|
set_jwt_cookie(
|
||||||
response, JWT_COOKIE_NAME, encoded_jwt, expiration, JWT_COOKIE_SECURE
|
response,
|
||||||
|
JWT_COOKIE_NAME,
|
||||||
|
encoded_jwt,
|
||||||
|
JWT_SESSION_LENGTH,
|
||||||
|
JWT_COOKIE_SECURE,
|
||||||
)
|
)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from frigate.api.auth import (
|
|||||||
require_go2rtc_stream_access,
|
require_go2rtc_stream_access,
|
||||||
require_role,
|
require_role,
|
||||||
)
|
)
|
||||||
|
from frigate.api.config_util import swap_runtime_config
|
||||||
from frigate.api.defs.request.app_body import CameraSetBody
|
from frigate.api.defs.request.app_body import CameraSetBody
|
||||||
from frigate.api.defs.tags import Tags
|
from frigate.api.defs.tags import Tags
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
@@ -1254,9 +1255,14 @@ async def delete_camera(
|
|||||||
status_code=500,
|
status_code=500,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update runtime config
|
# rebind every collaborator to the new config and re-layer runtime
|
||||||
request.app.frigate_config = config
|
# toggles for the surviving cameras, same as /api/config/set
|
||||||
request.app.genai_manager.update_config(config)
|
swap_runtime_config(request.app, config)
|
||||||
|
|
||||||
|
# drop the deleted camera's persisted overrides so a camera later
|
||||||
|
# added under the same name doesn't inherit them
|
||||||
|
if request.app.dispatcher is not None:
|
||||||
|
request.app.dispatcher.clear_runtime_state_for_camera(camera_name)
|
||||||
|
|
||||||
# Publish removal to stop ffmpeg processes and clean up runtime state
|
# Publish removal to stop ffmpeg processes and clean up runtime state
|
||||||
request.app.config_publisher.publish_update(
|
request.app.config_publisher.publish_update(
|
||||||
|
|||||||
+28
-7
@@ -7,7 +7,7 @@ import operator
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from typing import Any
|
from typing import Any, Literal
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
from fastapi import APIRouter, Body, Depends, HTTPException, Request
|
from fastapi import APIRouter, Body, Depends, HTTPException, Request
|
||||||
@@ -37,6 +37,7 @@ from frigate.api.defs.response.chat_response import (
|
|||||||
from frigate.api.defs.tags import Tags
|
from frigate.api.defs.tags import Tags
|
||||||
from frigate.api.event import _build_attribute_filter_clause, events
|
from frigate.api.event import _build_attribute_filter_clause, events
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
|
from frigate.config.classification import SemanticSearchModelEnum
|
||||||
from frigate.genai.prompts import (
|
from frigate.genai.prompts import (
|
||||||
build_chat_system_prompt,
|
build_chat_system_prompt,
|
||||||
get_attribute_classifications,
|
get_attribute_classifications,
|
||||||
@@ -86,10 +87,23 @@ def get_tools(request: Request) -> JSONResponse:
|
|||||||
tools = get_tool_definitions(
|
tools = get_tool_definitions(
|
||||||
semantic_search_enabled=semantic_search_enabled,
|
semantic_search_enabled=semantic_search_enabled,
|
||||||
attribute_classifications=attribute_classifications,
|
attribute_classifications=attribute_classifications,
|
||||||
|
embeddings_language=_embeddings_language(config),
|
||||||
)
|
)
|
||||||
return JSONResponse(content={"tools": tools})
|
return JSONResponse(content={"tools": tools})
|
||||||
|
|
||||||
|
|
||||||
|
def _embeddings_language(config: FrigateConfig) -> Literal["english", "multi"]:
|
||||||
|
"""Return the language capability of the configured embeddings model.
|
||||||
|
|
||||||
|
JinaV1 is English-only; every other option (JinaV2 or a GenAI embeddings
|
||||||
|
provider) handles multiple languages.
|
||||||
|
"""
|
||||||
|
if config.semantic_search.model == SemanticSearchModelEnum.jinav1:
|
||||||
|
return "english"
|
||||||
|
|
||||||
|
return "multi"
|
||||||
|
|
||||||
|
|
||||||
def _resolve_zones(
|
def _resolve_zones(
|
||||||
zones: list[str],
|
zones: list[str],
|
||||||
config: FrigateConfig,
|
config: FrigateConfig,
|
||||||
@@ -98,11 +112,14 @@ def _resolve_zones(
|
|||||||
"""Map zone names to their canonical config keys, case-insensitively.
|
"""Map zone names to their canonical config keys, case-insensitively.
|
||||||
|
|
||||||
LLMs frequently echo a user's casing ("Front Yard") instead of the
|
LLMs frequently echo a user's casing ("Front Yard") instead of the
|
||||||
configured key ("front_yard"). The downstream zone filter is a SQLite GLOB
|
configured key ("front_yard"), or fall back to a zone's friendly name
|
||||||
over the JSON-encoded zones column, which is case-sensitive — so an
|
("Front Walkway") instead of its ID ("front_walk"). The downstream zone
|
||||||
unnormalized name silently returns zero matches. Build a lookup over the
|
filter is a SQLite GLOB over the JSON-encoded zones column, which stores
|
||||||
relevant cameras' configured zones and substitute when we find a match;
|
config keys and is case-sensitive — so an unnormalized name silently
|
||||||
unknown names pass through so behavior matches what the model asked for.
|
returns zero matches. Build a lookup over the relevant cameras' configured
|
||||||
|
zones, keyed by both the config key and the friendly name, and substitute
|
||||||
|
when we find a match; unknown names pass through so behavior matches what
|
||||||
|
the model asked for.
|
||||||
"""
|
"""
|
||||||
if not zones:
|
if not zones:
|
||||||
return zones
|
return zones
|
||||||
@@ -112,8 +129,11 @@ def _resolve_zones(
|
|||||||
camera_config = config.cameras.get(camera_id)
|
camera_config = config.cameras.get(camera_id)
|
||||||
if camera_config is None:
|
if camera_config is None:
|
||||||
continue
|
continue
|
||||||
for zone_name in camera_config.zones.keys():
|
for zone_name, zone_config in camera_config.zones.items():
|
||||||
lookup.setdefault(zone_name.lower(), zone_name)
|
lookup.setdefault(zone_name.lower(), zone_name)
|
||||||
|
lookup.setdefault(
|
||||||
|
zone_config.get_formatted_name(zone_name).lower(), zone_name
|
||||||
|
)
|
||||||
|
|
||||||
return [lookup.get(z.lower(), z) for z in zones]
|
return [lookup.get(z.lower(), z) for z in zones]
|
||||||
|
|
||||||
@@ -1134,6 +1154,7 @@ async def chat_completion(
|
|||||||
tools = get_tool_definitions(
|
tools = get_tool_definitions(
|
||||||
semantic_search_enabled=semantic_search_enabled,
|
semantic_search_enabled=semantic_search_enabled,
|
||||||
attribute_classifications=attribute_classifications,
|
attribute_classifications=attribute_classifications,
|
||||||
|
embeddings_language=_embeddings_language(config),
|
||||||
)
|
)
|
||||||
conversation = []
|
conversation = []
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
"""Shared helpers for applying a freshly parsed config to the running app."""
|
||||||
|
|
||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
from frigate.config import FrigateConfig
|
||||||
|
|
||||||
|
|
||||||
|
def swap_runtime_config(app: FastAPI, config: FrigateConfig) -> None:
|
||||||
|
"""Point every long-lived collaborator at a newly parsed config object.
|
||||||
|
|
||||||
|
Both /api/config/set and camera deletion re-parse yaml into a fresh
|
||||||
|
FrigateConfig and must rebind the same set of references, or the API and
|
||||||
|
the dispatcher drift onto different objects (the API reports one camera
|
||||||
|
state while the dispatcher acts on another). Runtime toggle overrides are
|
||||||
|
re-layered last: the swap rebuilt every camera from yaml, so without this a
|
||||||
|
camera the user turned off would silently come back on.
|
||||||
|
"""
|
||||||
|
app.frigate_config = config
|
||||||
|
app.genai_manager.update_config(config)
|
||||||
|
|
||||||
|
if app.profile_manager is not None:
|
||||||
|
app.profile_manager.update_config(config)
|
||||||
|
|
||||||
|
if app.stats_emitter is not None:
|
||||||
|
app.stats_emitter.config = config
|
||||||
|
|
||||||
|
if app.dispatcher is not None:
|
||||||
|
app.dispatcher.config = config
|
||||||
|
|
||||||
|
for comm in app.dispatcher.comms:
|
||||||
|
comm.config = config
|
||||||
|
|
||||||
|
# workers still hold the live toggle values, so correct only the
|
||||||
|
# config object here rather than re-broadcasting every override
|
||||||
|
app.dispatcher.reapply_runtime_state_to_config()
|
||||||
@@ -14,6 +14,7 @@ class AppConfigSetBody(BaseModel):
|
|||||||
|
|
||||||
class GenAIProbeBody(BaseModel):
|
class GenAIProbeBody(BaseModel):
|
||||||
provider: GenAIProviderEnum
|
provider: GenAIProviderEnum
|
||||||
|
name: str | None = None
|
||||||
api_key: str | None = None
|
api_key: str | None = None
|
||||||
base_url: str | None = None
|
base_url: str | None = None
|
||||||
provider_options: dict[str, Any] = Field(default_factory=dict)
|
provider_options: dict[str, Any] = Field(default_factory=dict)
|
||||||
|
|||||||
+15
-10
@@ -1538,15 +1538,18 @@ async def set_description(
|
|||||||
event.data["description"] = new_description
|
event.data["description"] = new_description
|
||||||
event.save()
|
event.save()
|
||||||
|
|
||||||
# If semantic search is enabled, update the index
|
context: EmbeddingsContext | None = request.app.embeddings
|
||||||
if request.app.frigate_config.semantic_search.enabled:
|
|
||||||
context: EmbeddingsContext = request.app.embeddings
|
if context is not None:
|
||||||
if len(new_description) > 0:
|
if len(new_description) > 0:
|
||||||
context.update_description(
|
# If semantic search is enabled, update the index
|
||||||
event_id,
|
if request.app.frigate_config.semantic_search.enabled:
|
||||||
new_description,
|
context.update_description(
|
||||||
)
|
event_id,
|
||||||
|
new_description,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
|
# embeddings are always cleaned up so they don't outlive their description
|
||||||
context.db.delete_embeddings_description(event_ids=[event_id])
|
context.db.delete_embeddings_description(event_ids=[event_id])
|
||||||
|
|
||||||
response_message = (
|
response_message = (
|
||||||
@@ -1675,9 +1678,11 @@ async def delete_single_event(event_id: str, request: Request) -> dict:
|
|||||||
event.delete_instance()
|
event.delete_instance()
|
||||||
Timeline.delete().where(Timeline.source_id == event_id).execute()
|
Timeline.delete().where(Timeline.source_id == event_id).execute()
|
||||||
|
|
||||||
# If semantic search is enabled, update the index
|
# embeddings are always cleaned up, even when semantic search is disabled,
|
||||||
if request.app.frigate_config.semantic_search.enabled:
|
# so that they don't outlive their events
|
||||||
context: EmbeddingsContext = request.app.embeddings
|
context: EmbeddingsContext | None = request.app.embeddings
|
||||||
|
|
||||||
|
if context is not None:
|
||||||
context.db.delete_embeddings_thumbnail(event_ids=[event_id])
|
context.db.delete_embeddings_thumbnail(event_ids=[event_id])
|
||||||
context.db.delete_embeddings_description(event_ids=[event_id])
|
context.db.delete_embeddings_description(event_ids=[event_id])
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -270,7 +270,7 @@ class FrigateApp:
|
|||||||
10
|
10
|
||||||
* len([c for c in self.config.cameras.values() if c.enabled_in_config]),
|
* len([c for c in self.config.cameras.values() if c.enabled_in_config]),
|
||||||
),
|
),
|
||||||
load_vec_extension=self.config.semantic_search.enabled,
|
load_vec_extension=True,
|
||||||
)
|
)
|
||||||
models = [
|
models = [
|
||||||
Event,
|
Event,
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ class CameraMaintainer(threading.Thread):
|
|||||||
|
|
||||||
if runtime:
|
if runtime:
|
||||||
self.camera_metrics[name] = CameraMetrics(self.metrics_manager)
|
self.camera_metrics[name] = CameraMetrics(self.metrics_manager)
|
||||||
self.ptz_metrics[name] = PTZMetrics(autotracker_enabled=False)
|
self.ptz_metrics[name] = PTZMetrics(
|
||||||
|
autotracker_enabled=config.onvif.autotracking.enabled
|
||||||
|
)
|
||||||
self.region_grids[name] = get_camera_regions_grid(
|
self.region_grids[name] = get_camera_regions_grid(
|
||||||
name,
|
name,
|
||||||
config.detect,
|
config.detect,
|
||||||
|
|||||||
@@ -111,9 +111,9 @@ class CameraState:
|
|||||||
# draw thicker box around ptz autotracked object
|
# draw thicker box around ptz autotracked object
|
||||||
if (
|
if (
|
||||||
self.camera_config.onvif.autotracking.enabled
|
self.camera_config.onvif.autotracking.enabled
|
||||||
and self.ptz_autotracker_thread.ptz_autotracker.autotracker_init[
|
and self.ptz_autotracker_thread.ptz_autotracker.autotracker_init.get(
|
||||||
self.name
|
self.name
|
||||||
]
|
)
|
||||||
and self.ptz_autotracker_thread.ptz_autotracker.tracked_object[
|
and self.ptz_autotracker_thread.ptz_autotracker.tracked_object[
|
||||||
self.name
|
self.name
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -404,38 +404,64 @@ class Dispatcher:
|
|||||||
for comm in self.comms:
|
for comm in self.comms:
|
||||||
comm.stop()
|
comm.stop()
|
||||||
|
|
||||||
def restore_runtime_state(self) -> None:
|
def apply_runtime_state(self) -> dict[str, dict[str, bool]]:
|
||||||
"""Replay persisted runtime overrides through the camera settings handlers.
|
"""Replay persisted runtime overrides through the camera settings handlers.
|
||||||
|
|
||||||
Called once after Frigate startup completes so processing threads can
|
Routing through the handlers (rather than mutating config directly) is
|
||||||
receive the resulting ``config_updater`` broadcasts. Unknown cameras
|
deliberate: they publish the ``config_updater`` broadcast and the
|
||||||
and topics are skipped; handler exceptions are logged and replay
|
retained MQTT state as a side effect, so worker processes and the UI
|
||||||
continues for remaining entries.
|
converge on the replayed value. Unknown cameras and topics are skipped;
|
||||||
|
handler exceptions are logged and replay continues for the rest.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The entries handed to a handler without raising, keyed by camera
|
||||||
|
then topic. A handler can still refuse the value internally (an ON
|
||||||
|
payload for a camera that is not enabled_in_config, for example),
|
||||||
|
so this is not proof the override took effect.
|
||||||
"""
|
"""
|
||||||
state = self._runtime_state.load()
|
state = self._runtime_state.load()
|
||||||
|
applied: dict[str, dict[str, bool]] = {}
|
||||||
|
|
||||||
for camera_name, features in state.items():
|
for camera_name, features in state.items():
|
||||||
if camera_name not in self.config.cameras:
|
if camera_name not in self.config.cameras:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for topic, value in features.items():
|
for topic, value in features.items():
|
||||||
handler = self._camera_settings_handlers.get(topic)
|
handler = self._camera_settings_handlers.get(topic)
|
||||||
|
|
||||||
if handler is None:
|
if handler is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
payload = "ON" if value else "OFF"
|
payload = "ON" if value else "OFF"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
handler(camera_name, payload)
|
handler(camera_name, payload)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
"Failed to restore runtime state %s.%s=%s",
|
"Failed to apply runtime state %s.%s=%s",
|
||||||
camera_name,
|
camera_name,
|
||||||
topic,
|
topic,
|
||||||
payload,
|
payload,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
applied.setdefault(camera_name, {})[topic] = value
|
||||||
|
|
||||||
|
return applied
|
||||||
|
|
||||||
|
def restore_runtime_state(self) -> None:
|
||||||
|
"""Replay persisted runtime overrides once Frigate startup completes.
|
||||||
|
|
||||||
|
Called after every ``config_updater`` subscriber is up so the resulting
|
||||||
|
broadcasts are not dropped by ZMQ PUB/SUB.
|
||||||
|
"""
|
||||||
|
for camera_name, features in self.apply_runtime_state().items():
|
||||||
|
for topic, value in features.items():
|
||||||
logger.info(
|
logger.info(
|
||||||
"Restored runtime state: %s.%s=%s",
|
"Restored runtime state: %s.%s=%s",
|
||||||
camera_name,
|
camera_name,
|
||||||
topic,
|
topic,
|
||||||
payload,
|
"ON" if value else "OFF",
|
||||||
)
|
)
|
||||||
|
|
||||||
def clear_runtime_state_for_yaml_keys(self, dotted_keys: Iterable[str]) -> None:
|
def clear_runtime_state_for_yaml_keys(self, dotted_keys: Iterable[str]) -> None:
|
||||||
@@ -458,6 +484,56 @@ class Dispatcher:
|
|||||||
"""
|
"""
|
||||||
self._runtime_state.clear_all()
|
self._runtime_state.clear_all()
|
||||||
|
|
||||||
|
def clear_runtime_state_for_camera(self, camera: str) -> None:
|
||||||
|
"""Drop all persisted runtime overrides for a deleted camera.
|
||||||
|
|
||||||
|
Called by camera deletion so a camera later added under the same name
|
||||||
|
does not inherit the removed camera's stale toggles.
|
||||||
|
"""
|
||||||
|
self._runtime_state.clear_camera(camera)
|
||||||
|
|
||||||
|
def reapply_runtime_state_to_config(self) -> None:
|
||||||
|
"""Re-apply persisted runtime overrides to the swapped-in config object.
|
||||||
|
|
||||||
|
After config/set (or a camera delete) parses fresh yaml and swaps the
|
||||||
|
config, the worker processes still hold the live toggle values and the
|
||||||
|
overrides are already on disk, so only the in-process config object is
|
||||||
|
out of date. Unlike apply_runtime_state (used at startup, where workers
|
||||||
|
must be told), this makes no ZMQ, MQTT, or disk writes, it just corrects
|
||||||
|
the config the API and dispatcher read.
|
||||||
|
|
||||||
|
The field mutations and gates mirror the _on_*_command handlers; keep
|
||||||
|
the two in sync if a tracked toggle is added or its gate changes.
|
||||||
|
"""
|
||||||
|
state = self._runtime_state.load()
|
||||||
|
|
||||||
|
for camera_name, features in state.items():
|
||||||
|
camera = self.config.cameras.get(camera_name)
|
||||||
|
|
||||||
|
if camera is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
for topic, value in features.items():
|
||||||
|
if topic == "enabled":
|
||||||
|
if value and not camera.enabled_in_config:
|
||||||
|
continue
|
||||||
|
camera.enabled = value
|
||||||
|
elif topic == "detect":
|
||||||
|
camera.detect.enabled = value
|
||||||
|
# detection requires motion, mirror the handler coupling
|
||||||
|
if value and not camera.motion.enabled:
|
||||||
|
camera.motion.enabled = True
|
||||||
|
elif topic == "snapshots":
|
||||||
|
camera.snapshots.enabled = value
|
||||||
|
elif topic == "recordings":
|
||||||
|
if value and not camera.record.enabled_in_config:
|
||||||
|
continue
|
||||||
|
camera.record.enabled = value
|
||||||
|
elif topic == "audio":
|
||||||
|
if value and not camera.audio.enabled_in_config:
|
||||||
|
continue
|
||||||
|
camera.audio.enabled = value
|
||||||
|
|
||||||
def _on_detect_command(self, camera_name: str, payload: str) -> None:
|
def _on_detect_command(self, camera_name: str, payload: str) -> None:
|
||||||
"""Callback for detect topic."""
|
"""Callback for detect topic."""
|
||||||
detect_settings = self.config.cameras[camera_name].detect
|
detect_settings = self.config.cameras[camera_name].detect
|
||||||
@@ -588,6 +664,10 @@ class Dispatcher:
|
|||||||
self.ptz_metrics[camera_name].start_time.value = 0
|
self.ptz_metrics[camera_name].start_time.value = 0
|
||||||
ptz_autotracker_settings.enabled = False
|
ptz_autotracker_settings.enabled = False
|
||||||
|
|
||||||
|
self.config_updater.publish_update(
|
||||||
|
CameraConfigUpdateTopic(CameraConfigUpdateEnum.autotracking, camera_name),
|
||||||
|
ptz_autotracker_settings,
|
||||||
|
)
|
||||||
self.publish(f"{camera_name}/ptz_autotracker/state", payload, retain=True)
|
self.publish(f"{camera_name}/ptz_autotracker/state", payload, retain=True)
|
||||||
|
|
||||||
def _on_motion_contour_area_command(self, camera_name: str, payload: int) -> None:
|
def _on_motion_contour_area_command(self, camera_name: str, payload: int) -> None:
|
||||||
|
|||||||
@@ -96,6 +96,25 @@ class RuntimeStatePersistence:
|
|||||||
except OSError:
|
except OSError:
|
||||||
logger.exception("Failed to clear runtime state")
|
logger.exception("Failed to clear runtime state")
|
||||||
|
|
||||||
|
def clear_camera(self, camera: str) -> None:
|
||||||
|
"""Drop every stored override for a single camera.
|
||||||
|
|
||||||
|
Called when a camera is deleted so a camera later added under the same
|
||||||
|
name does not inherit the removed camera's stale toggles.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with FileLock(self._lock_path, timeout=self._lock_timeout):
|
||||||
|
data = self._read_locked()
|
||||||
|
cameras = data.get("cameras")
|
||||||
|
if not isinstance(cameras, dict) or camera not in cameras:
|
||||||
|
return
|
||||||
|
del cameras[camera]
|
||||||
|
self._write_locked(data)
|
||||||
|
except Timeout:
|
||||||
|
logger.error("Timed out clearing runtime state for camera")
|
||||||
|
except OSError:
|
||||||
|
logger.exception("Failed to clear runtime state for camera")
|
||||||
|
|
||||||
def clear_for_yaml_keys(self, dotted_keys: Iterable[str]) -> None:
|
def clear_for_yaml_keys(self, dotted_keys: Iterable[str]) -> None:
|
||||||
"""Remove stored entries whose YAML key was just rewritten.
|
"""Remove stored entries whose YAML key was just rewritten.
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ from frigate.const import (
|
|||||||
EXPIRE_AUDIO_ACTIVITY,
|
EXPIRE_AUDIO_ACTIVITY,
|
||||||
INSERT_MANY_RECORDINGS,
|
INSERT_MANY_RECORDINGS,
|
||||||
INSERT_PREVIEW,
|
INSERT_PREVIEW,
|
||||||
NOTIFICATION_TEST,
|
|
||||||
REQUEST_REGION_GRID,
|
REQUEST_REGION_GRID,
|
||||||
UPDATE_AUDIO_ACTIVITY,
|
UPDATE_AUDIO_ACTIVITY,
|
||||||
UPDATE_AUDIO_TRANSCRIPTION_STATE,
|
UPDATE_AUDIO_TRANSCRIPTION_STATE,
|
||||||
@@ -57,7 +56,6 @@ _WS_BLOCKED_TOPICS = frozenset(
|
|||||||
UPDATE_EMBEDDINGS_REINDEX_PROGRESS,
|
UPDATE_EMBEDDINGS_REINDEX_PROGRESS,
|
||||||
UPDATE_BIRDSEYE_LAYOUT,
|
UPDATE_BIRDSEYE_LAYOUT,
|
||||||
UPDATE_AUDIO_TRANSCRIPTION_STATE,
|
UPDATE_AUDIO_TRANSCRIPTION_STATE,
|
||||||
NOTIFICATION_TEST,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class CameraConfigUpdateEnum(str, Enum):
|
|||||||
add = "add" # for adding a camera
|
add = "add" # for adding a camera
|
||||||
audio = "audio"
|
audio = "audio"
|
||||||
audio_transcription = "audio_transcription"
|
audio_transcription = "audio_transcription"
|
||||||
|
autotracking = "autotracking" # ptz autotracking only, without an onvif reinit
|
||||||
birdseye = "birdseye"
|
birdseye = "birdseye"
|
||||||
detect = "detect"
|
detect = "detect"
|
||||||
enabled = "enabled"
|
enabled = "enabled"
|
||||||
@@ -145,6 +146,8 @@ class CameraConfigUpdateSubscriber:
|
|||||||
config.snapshots = updated_config
|
config.snapshots = updated_config
|
||||||
elif update_type == CameraConfigUpdateEnum.onvif:
|
elif update_type == CameraConfigUpdateEnum.onvif:
|
||||||
config.onvif = updated_config
|
config.onvif = updated_config
|
||||||
|
elif update_type == CameraConfigUpdateEnum.autotracking:
|
||||||
|
config.onvif.autotracking = updated_config
|
||||||
elif update_type == CameraConfigUpdateEnum.timestamp_style:
|
elif update_type == CameraConfigUpdateEnum.timestamp_style:
|
||||||
config.timestamp_style = updated_config
|
config.timestamp_style = updated_config
|
||||||
elif update_type == CameraConfigUpdateEnum.zones:
|
elif update_type == CameraConfigUpdateEnum.zones:
|
||||||
|
|||||||
@@ -400,6 +400,9 @@ def verify_objects_track(
|
|||||||
)
|
)
|
||||||
camera_config.objects.track = valid_objects
|
camera_config.objects.track = valid_objects
|
||||||
|
|
||||||
|
for label in invalid_objects:
|
||||||
|
camera_config.objects.filters.pop(label, None)
|
||||||
|
|
||||||
|
|
||||||
def verify_lpr_and_face(
|
def verify_lpr_and_face(
|
||||||
frigate_config: FrigateConfig, camera_config: CameraConfig
|
frigate_config: FrigateConfig, camera_config: CameraConfig
|
||||||
@@ -637,7 +640,7 @@ 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
|
||||||
|
|
||||||
# validate genai: each role (tools, vision, embeddings) at most once
|
# validate genai: each role (chat, descriptions, embeddings) 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():
|
||||||
for role in genai_cfg.roles:
|
for role in genai_cfg.roles:
|
||||||
|
|||||||
@@ -141,6 +141,11 @@ class ProfileManager:
|
|||||||
Preserves active profile state: re-snapshots base configs from the new
|
Preserves active profile state: re-snapshots base configs from the new
|
||||||
(freshly parsed) config, then re-applies profile overrides if a profile
|
(freshly parsed) config, then re-applies profile overrides if a profile
|
||||||
was active.
|
was active.
|
||||||
|
|
||||||
|
Deliberately does not clear the dispatcher's runtime overrides. This is
|
||||||
|
the config-save path, not a profile switch: the save only invalidates
|
||||||
|
the toggles it rewrote in yaml, which /api/config/set already clears by
|
||||||
|
key. The broad wipe belongs to activate_profile alone.
|
||||||
"""
|
"""
|
||||||
current_active = self.config.active_profile
|
current_active = self.config.active_profile
|
||||||
self.config = new_config
|
self.config = new_config
|
||||||
@@ -164,10 +169,6 @@ class ProfileManager:
|
|||||||
self.config.active_profile = None
|
self.config.active_profile = None
|
||||||
self._persist_active_profile(None)
|
self._persist_active_profile(None)
|
||||||
|
|
||||||
# drop all runtime overrides so they don't replay stale values on restart
|
|
||||||
if self.dispatcher is not None:
|
|
||||||
self.dispatcher.clear_runtime_state()
|
|
||||||
|
|
||||||
def activate_profile(
|
def activate_profile(
|
||||||
self,
|
self,
|
||||||
profile_name: str | None,
|
profile_name: str | None,
|
||||||
|
|||||||
@@ -288,6 +288,10 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
|
max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if face_frame.size == 0:
|
||||||
|
logger.debug(f"Empty face crop for {id}")
|
||||||
|
return
|
||||||
|
|
||||||
res = self.recognizer.classify(face_frame)
|
res = self.recognizer.classify(face_frame)
|
||||||
|
|
||||||
if not res:
|
if not res:
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
import re
|
import logging
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
import regex
|
||||||
from playhouse.sqliteq import SqliteQueueDatabase
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
REGEXP_TIMEOUT_SECONDS = 1.0
|
||||||
|
|
||||||
|
|
||||||
class SqliteVecQueueDatabase(SqliteQueueDatabase):
|
class SqliteVecQueueDatabase(SqliteQueueDatabase):
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -26,27 +31,55 @@ class SqliteVecQueueDatabase(SqliteQueueDatabase):
|
|||||||
|
|
||||||
def _load_vec_extension(self, conn: sqlite3.Connection) -> None:
|
def _load_vec_extension(self, conn: sqlite3.Connection) -> None:
|
||||||
conn.enable_load_extension(True)
|
conn.enable_load_extension(True)
|
||||||
conn.load_extension(self.sqlite_vec_path)
|
|
||||||
conn.enable_load_extension(False)
|
try:
|
||||||
|
conn.load_extension(self.sqlite_vec_path)
|
||||||
|
except conn.OperationalError:
|
||||||
|
logger.error("Unable to load the sqlite-vec extension")
|
||||||
|
self.load_vec_extension = False
|
||||||
|
finally:
|
||||||
|
conn.enable_load_extension(False)
|
||||||
|
|
||||||
def _register_regexp(self, conn: sqlite3.Connection) -> None:
|
def _register_regexp(self, conn: sqlite3.Connection) -> None:
|
||||||
def regexp(expr: str, item: str | None) -> bool:
|
def regexp(expr: str, item: str | None) -> bool:
|
||||||
if item is None:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
return re.search(expr, item) is not None
|
return (
|
||||||
except re.error:
|
regex.search(expr, item, timeout=REGEXP_TIMEOUT_SECONDS) is not None
|
||||||
|
)
|
||||||
|
except (regex.error, TimeoutError):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
conn.create_function("REGEXP", 2, regexp)
|
conn.create_function("REGEXP", 2, regexp)
|
||||||
|
|
||||||
def delete_embeddings_thumbnail(self, event_ids: list[str]) -> None:
|
def _delete_embeddings(self, table: str, event_ids: list[str]) -> None:
|
||||||
|
"""Delete embeddings for the given events, if the table exists.
|
||||||
|
|
||||||
|
Embeddings outlive the events they belong to when semantic search is
|
||||||
|
disabled, so deletes are attempted regardless of the current config.
|
||||||
|
"""
|
||||||
|
if not event_ids or not self.load_vec_extension:
|
||||||
|
return
|
||||||
|
|
||||||
|
# the embeddings tables are only created once semantic search has run
|
||||||
|
cursor = self.execute_sql(
|
||||||
|
"SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",
|
||||||
|
(table,),
|
||||||
|
)
|
||||||
|
|
||||||
|
if cursor.fetchone() is None:
|
||||||
|
logger.debug("Skipping %s cleanup, table does not exist", table)
|
||||||
|
return
|
||||||
|
|
||||||
ids = ",".join(["?" for _ in event_ids])
|
ids = ",".join(["?" for _ in event_ids])
|
||||||
self.execute_sql(f"DELETE FROM vec_thumbnails WHERE id IN ({ids})", event_ids)
|
self.execute_sql(f"DELETE FROM {table} WHERE id IN ({ids})", event_ids)
|
||||||
|
|
||||||
|
def delete_embeddings_thumbnail(self, event_ids: list[str]) -> None:
|
||||||
|
self._delete_embeddings("vec_thumbnails", event_ids)
|
||||||
|
|
||||||
def delete_embeddings_description(self, event_ids: list[str]) -> None:
|
def delete_embeddings_description(self, event_ids: list[str]) -> None:
|
||||||
ids = ",".join(["?" for _ in event_ids])
|
self._delete_embeddings("vec_descriptions", event_ids)
|
||||||
self.execute_sql(f"DELETE FROM vec_descriptions WHERE id IN ({ids})", event_ids)
|
|
||||||
|
|
||||||
def drop_embeddings_tables(self) -> None:
|
def drop_embeddings_tables(self) -> None:
|
||||||
self.execute_sql("""
|
self.execute_sql("""
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ from frigate.config.camera.updater import (
|
|||||||
CameraConfigUpdateTopic,
|
CameraConfigUpdateTopic,
|
||||||
)
|
)
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
CLIPS_DIR,
|
|
||||||
RECORD_DIR,
|
|
||||||
REPLAY_CAMERA_PREFIX,
|
REPLAY_CAMERA_PREFIX,
|
||||||
REPLAY_DIR,
|
REPLAY_DIR,
|
||||||
THUMB_DIR,
|
THUMB_DIR,
|
||||||
@@ -331,12 +329,14 @@ def cleanup_replay_cameras() -> None:
|
|||||||
"""
|
"""
|
||||||
stale_cameras: set[str] = set()
|
stale_cameras: set[str] = set()
|
||||||
|
|
||||||
# Scan filesystem for leftover replay artifacts to derive camera names
|
# Derive stale camera names from THUMB_DIR (per-camera dirs) and
|
||||||
for dir_path in [RECORD_DIR, CLIPS_DIR, THUMB_DIR]:
|
# REPLAY_DIR (the session's source clip); both listings are bounded by
|
||||||
if os.path.isdir(dir_path):
|
# camera count. cleanup_camera_files below removes any remaining
|
||||||
for entry in os.listdir(dir_path):
|
# per-camera artifacts (snapshots, thumbnails, LPR images, etc.) by name.
|
||||||
if entry.startswith(REPLAY_CAMERA_PREFIX):
|
if os.path.isdir(THUMB_DIR):
|
||||||
stale_cameras.add(entry)
|
for entry in os.listdir(THUMB_DIR):
|
||||||
|
if entry.startswith(REPLAY_CAMERA_PREFIX):
|
||||||
|
stale_cameras.add(entry)
|
||||||
|
|
||||||
if os.path.isdir(REPLAY_DIR):
|
if os.path.isdir(REPLAY_DIR):
|
||||||
for entry in os.listdir(REPLAY_DIR):
|
for entry in os.listdir(REPLAY_DIR):
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class ModelConfig(BaseModel):
|
|||||||
model_type: ModelTypeEnum = Field(
|
model_type: ModelTypeEnum = Field(
|
||||||
default=ModelTypeEnum.ssd,
|
default=ModelTypeEnum.ssd,
|
||||||
title="Object Detection Model Type",
|
title="Object Detection Model Type",
|
||||||
description="Detector model architecture type (ssd, yolox, yolonas) used by some detectors for optimization.",
|
description="Detector model architecture type (ssd, yolox, yolonas, yolo-generic, rfdetr, dfine) used by some detectors for optimization.",
|
||||||
)
|
)
|
||||||
_merged_labelmap: dict[int, str] | None = PrivateAttr()
|
_merged_labelmap: dict[int, str] | None = PrivateAttr()
|
||||||
_colormap: dict[int, tuple[int, int, int]] = PrivateAttr()
|
_colormap: dict[int, tuple[int, int, int]] = PrivateAttr()
|
||||||
|
|||||||
@@ -200,6 +200,9 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for model_config in self.config.classification.custom.values():
|
for model_config in self.config.classification.custom.values():
|
||||||
|
if not model_config.enabled:
|
||||||
|
continue
|
||||||
|
|
||||||
self.realtime_processors.append(
|
self.realtime_processors.append(
|
||||||
CustomStateClassificationProcessor(
|
CustomStateClassificationProcessor(
|
||||||
self.config, model_config, self.requestor, self.metrics
|
self.config, model_config, self.requestor, self.metrics
|
||||||
@@ -332,6 +335,25 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
for processor in self.post_processors:
|
for processor in self.post_processors:
|
||||||
processor.update_config(topic, payload)
|
processor.update_config(topic, payload)
|
||||||
|
|
||||||
|
def _remove_custom_classification_processor(self, model_name: str) -> None:
|
||||||
|
"""Shut down and drop any running processor for a custom model."""
|
||||||
|
remaining = []
|
||||||
|
for processor in self.realtime_processors:
|
||||||
|
if (
|
||||||
|
isinstance(
|
||||||
|
processor,
|
||||||
|
(
|
||||||
|
CustomStateClassificationProcessor,
|
||||||
|
CustomObjectClassificationProcessor,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
and processor.model_config.name == model_name
|
||||||
|
):
|
||||||
|
processor.shutdown()
|
||||||
|
else:
|
||||||
|
remaining.append(processor)
|
||||||
|
self.realtime_processors = remaining
|
||||||
|
|
||||||
def _handle_custom_classification_update(
|
def _handle_custom_classification_update(
|
||||||
self, topic: str, model_config: Any
|
self, topic: str, model_config: Any
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -339,23 +361,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
model_name = topic.split("/")[-1]
|
model_name = topic.split("/")[-1]
|
||||||
|
|
||||||
if model_config is None:
|
if model_config is None:
|
||||||
remaining = []
|
self._remove_custom_classification_processor(model_name)
|
||||||
for processor in self.realtime_processors:
|
|
||||||
if (
|
|
||||||
isinstance(
|
|
||||||
processor,
|
|
||||||
(
|
|
||||||
CustomStateClassificationProcessor,
|
|
||||||
CustomObjectClassificationProcessor,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
and processor.model_config.name == model_name
|
|
||||||
):
|
|
||||||
processor.shutdown()
|
|
||||||
else:
|
|
||||||
remaining.append(processor)
|
|
||||||
self.realtime_processors = remaining
|
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully removed classification processor for model: {model_name}"
|
f"Successfully removed classification processor for model: {model_name}"
|
||||||
)
|
)
|
||||||
@@ -363,20 +369,29 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
self.config.classification.custom[model_name] = model_config
|
self.config.classification.custom[model_name] = model_config
|
||||||
|
|
||||||
# Check if processor already exists
|
# A disabled model must not run; tear down any existing processor and
|
||||||
|
# do not register a new one.
|
||||||
|
if not model_config.enabled:
|
||||||
|
self._remove_custom_classification_processor(model_name)
|
||||||
|
logger.info(f"Disabled classification processor for model: {model_name}")
|
||||||
|
return
|
||||||
|
|
||||||
for processor in self.realtime_processors:
|
for processor in self.realtime_processors:
|
||||||
if isinstance(
|
if (
|
||||||
processor,
|
isinstance(
|
||||||
(
|
processor,
|
||||||
CustomStateClassificationProcessor,
|
(
|
||||||
CustomObjectClassificationProcessor,
|
CustomStateClassificationProcessor,
|
||||||
),
|
CustomObjectClassificationProcessor,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
and processor.model_config.name == model_name
|
||||||
):
|
):
|
||||||
if processor.model_config.name == model_name:
|
processor.model_config = model_config
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Classification processor for model {model_name} already exists, skipping"
|
f"Updated config for classification processor: {model_name}"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if model_config.state_config is not None:
|
if model_config.state_config is not None:
|
||||||
processor = CustomStateClassificationProcessor(
|
processor = CustomStateClassificationProcessor(
|
||||||
@@ -702,7 +717,11 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
and "license_plate" not in camera_config.objects.track
|
and "license_plate" not in camera_config.objects.track
|
||||||
)
|
)
|
||||||
|
|
||||||
if not dedicated_lpr_enabled and len(self.config.classification.custom) == 0:
|
has_enabled_custom = any(
|
||||||
|
c.enabled for c in self.config.classification.custom.values()
|
||||||
|
)
|
||||||
|
|
||||||
|
if not dedicated_lpr_enabled and not has_enabled_custom:
|
||||||
# no active features that use this data
|
# no active features that use this data
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ class BaseEmbedding(ABC):
|
|||||||
def _preprocess_inputs(self, raw_inputs: Any) -> Any:
|
def _preprocess_inputs(self, raw_inputs: Any) -> Any:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _bgr_to_rgb(frame: Any) -> Any:
|
||||||
|
if isinstance(frame, np.ndarray) and frame.ndim == 3:
|
||||||
|
return np.ascontiguousarray(frame[:, :, ::-1])
|
||||||
|
return frame
|
||||||
|
|
||||||
def _process_image(self, image, output: str = "RGB") -> Image.Image:
|
def _process_image(self, image, output: str = "RGB") -> Image.Image:
|
||||||
if isinstance(image, str):
|
if isinstance(image, str):
|
||||||
if image.startswith("http"):
|
if image.startswith("http"):
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class FaceNetEmbedding(BaseEmbedding):
|
|||||||
self.tensor_output_details = self.runner.get_output_details()
|
self.tensor_output_details = self.runner.get_output_details()
|
||||||
|
|
||||||
def _preprocess_inputs(self, raw_inputs):
|
def _preprocess_inputs(self, raw_inputs):
|
||||||
pil = self._process_image(raw_inputs[0])
|
pil = self._process_image(self._bgr_to_rgb(raw_inputs[0]))
|
||||||
|
|
||||||
# handle images larger than input size
|
# handle images larger than input size
|
||||||
width, height = pil.size
|
width, height = pil.size
|
||||||
@@ -159,7 +159,7 @@ class ArcfaceEmbedding(BaseEmbedding):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _preprocess_inputs(self, raw_inputs):
|
def _preprocess_inputs(self, raw_inputs):
|
||||||
pil = self._process_image(raw_inputs[0])
|
pil = self._process_image(self._bgr_to_rgb(raw_inputs[0]))
|
||||||
|
|
||||||
# handle images larger than input size
|
# handle images larger than input size
|
||||||
width, height = pil.size
|
width, height = pil.size
|
||||||
|
|||||||
@@ -366,9 +366,10 @@ class EventCleanup(threading.Thread):
|
|||||||
logger.debug(f"Deleting {len(chunk)} events from the database")
|
logger.debug(f"Deleting {len(chunk)} events from the database")
|
||||||
Event.delete().where(Event.id << chunk).execute()
|
Event.delete().where(Event.id << chunk).execute()
|
||||||
|
|
||||||
if self.config.semantic_search.enabled:
|
# embeddings are always cleaned up, even when semantic search
|
||||||
self.db.delete_embeddings_description(event_ids=chunk)
|
# is disabled, so that they don't outlive their events
|
||||||
self.db.delete_embeddings_thumbnail(event_ids=chunk)
|
self.db.delete_embeddings_description(event_ids=chunk)
|
||||||
logger.debug(f"Deleted {len(ids_to_delete)} embeddings")
|
self.db.delete_embeddings_thumbnail(event_ids=chunk)
|
||||||
|
logger.debug(f"Deleted {len(chunk)} embeddings")
|
||||||
|
|
||||||
logger.info("Exiting event cleanup...")
|
logger.info("Exiting event cleanup...")
|
||||||
|
|||||||
@@ -150,7 +150,11 @@ PRESETS_HW_ACCEL_SCALE["preset-rk-h265"] = PRESETS_HW_ACCEL_SCALE[FFMPEG_HWACCEL
|
|||||||
PRESETS_HW_ACCEL_ENCODE_BIRDSEYE = {
|
PRESETS_HW_ACCEL_ENCODE_BIRDSEYE = {
|
||||||
"preset-rpi-64-h264": "{0} -hide_banner {1} -c:v h264_v4l2m2m {2}",
|
"preset-rpi-64-h264": "{0} -hide_banner {1} -c:v h264_v4l2m2m {2}",
|
||||||
"preset-rpi-64-h265": "{0} -hide_banner {1} -c:v hevc_v4l2m2m {2}",
|
"preset-rpi-64-h265": "{0} -hide_banner {1} -c:v hevc_v4l2m2m {2}",
|
||||||
FFMPEG_HWACCEL_VAAPI: "{0} -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device {3} {1} -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0 -an -vf format=vaapi|nv12,hwupload {2}",
|
# -vaapi_device is required in addition to -hwaccel_device: this is the only
|
||||||
|
# birdseye preset that uses hwupload, and ffmpeg 8 initializes filters before
|
||||||
|
# the decoder creates a device, so hwupload cannot see an -hwaccel_device one.
|
||||||
|
# See https://github.com/AlexxIT/go2rtc/issues/1984
|
||||||
|
FFMPEG_HWACCEL_VAAPI: "{0} -hide_banner -vaapi_device {3} -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device {3} {1} -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0 -an -vf format=vaapi|nv12,hwupload {2}",
|
||||||
"preset-intel-qsv-h264": "{0} -hide_banner {1} -c:v h264_qsv -g 50 -bf 0 -profile:v high -level:v 4.1 -async_depth:v 1 {2}",
|
"preset-intel-qsv-h264": "{0} -hide_banner {1} -c:v h264_qsv -g 50 -bf 0 -profile:v high -level:v 4.1 -async_depth:v 1 {2}",
|
||||||
"preset-intel-qsv-h265": "{0} -hide_banner {1} -c:v h264_qsv -g 50 -bf 0 -profile:v main -level:v 4.1 -async_depth:v 1 {2}",
|
"preset-intel-qsv-h265": "{0} -hide_banner {1} -c:v h264_qsv -g 50 -bf 0 -profile:v main -level:v 4.1 -async_depth:v 1 {2}",
|
||||||
FFMPEG_HWACCEL_NVIDIA: "{0} -hide_banner {1} -c:v h264_nvenc -g 50 -profile:v high -level:v auto -preset:v p2 -tune:v ll {2}",
|
FFMPEG_HWACCEL_NVIDIA: "{0} -hide_banner {1} -c:v h264_nvenc -g 50 -profile:v high -level:v auto -preset:v p2 -tune:v ll {2}",
|
||||||
|
|||||||
@@ -281,6 +281,11 @@ class GenAIClient:
|
|||||||
"""Whether the configured model exposes a per-request thinking toggle."""
|
"""Whether the configured model exposes a per-request thinking toggle."""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supports_embeddings(self) -> bool:
|
||||||
|
"""Whether the configured model can generate embeddings via embed()."""
|
||||||
|
return False
|
||||||
|
|
||||||
def list_models(self) -> list[str]:
|
def list_models(self) -> list[str]:
|
||||||
"""Return the list of model names available from this provider.
|
"""Return the list of model names available from this provider.
|
||||||
|
|
||||||
|
|||||||
@@ -121,5 +121,6 @@ class GenAIClientManager:
|
|||||||
"models": client.list_models(),
|
"models": client.list_models(),
|
||||||
"roles": [r.value for r in genai_cfg.roles],
|
"roles": [r.value for r in genai_cfg.roles],
|
||||||
"supports_toggleable_thinking": client.supports_toggleable_thinking,
|
"supports_toggleable_thinking": client.supports_toggleable_thinking,
|
||||||
|
"supports_embeddings": client.supports_embeddings,
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -38,6 +38,37 @@ def _encode_thought_signature(signature: bytes | None) -> str | None:
|
|||||||
return base64.b64encode(signature).decode("ascii")
|
return base64.b64encode(signature).decode("ascii")
|
||||||
|
|
||||||
|
|
||||||
|
def _decode_data_uri(url: str) -> tuple[str, bytes] | None:
|
||||||
|
"""Decode a ``data:`` URI into ``(mime_type, bytes)``; None if not a data URI."""
|
||||||
|
if not isinstance(url, str) or not url.startswith("data:"):
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
header, b64 = url.split(",", 1)
|
||||||
|
mime = header[len("data:") :].split(";")[0] or "image/jpeg"
|
||||||
|
return mime, base64.b64decode(b64)
|
||||||
|
except (ValueError, binascii.Error):
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _parts_from_content(content: Any) -> list[types.Part]:
|
||||||
|
"""Convert OpenAI-style message content (str or multimodal list) to Gemini parts."""
|
||||||
|
if isinstance(content, list):
|
||||||
|
parts: list[types.Part] = []
|
||||||
|
for item in content:
|
||||||
|
if not isinstance(item, dict):
|
||||||
|
continue
|
||||||
|
if item.get("type") == "text":
|
||||||
|
parts.append(types.Part.from_text(text=item.get("text") or ""))
|
||||||
|
elif item.get("type") == "image_url":
|
||||||
|
decoded = _decode_data_uri((item.get("image_url") or {}).get("url", ""))
|
||||||
|
if decoded is not None:
|
||||||
|
mime, data = decoded
|
||||||
|
parts.append(types.Part.from_bytes(data=data, mime_type=mime))
|
||||||
|
# Gemini rejects empty parts; fall back to a single space.
|
||||||
|
return parts or [types.Part.from_text(text=" ")]
|
||||||
|
return [types.Part.from_text(text=content or "")]
|
||||||
|
|
||||||
|
|
||||||
def _stats_from_gemini_usage(usage: Any) -> dict[str, Any] | None:
|
def _stats_from_gemini_usage(usage: Any) -> dict[str, Any] | None:
|
||||||
"""Build a stats dict from a Gemini usage_metadata object."""
|
"""Build a stats dict from a Gemini usage_metadata object."""
|
||||||
prompt_tokens = getattr(usage, "prompt_token_count", None)
|
prompt_tokens = getattr(usage, "prompt_token_count", None)
|
||||||
@@ -227,9 +258,7 @@ class GeminiClient(GenAIClient):
|
|||||||
)
|
)
|
||||||
else: # user
|
else: # user
|
||||||
gemini_messages.append(
|
gemini_messages.append(
|
||||||
types.Content(
|
types.Content(role="user", parts=_parts_from_content(content))
|
||||||
role="user", parts=[types.Part.from_text(text=content)]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Convert tools to Gemini format
|
# Convert tools to Gemini format
|
||||||
@@ -485,9 +514,7 @@ class GeminiClient(GenAIClient):
|
|||||||
)
|
)
|
||||||
else: # user
|
else: # user
|
||||||
gemini_messages.append(
|
gemini_messages.append(
|
||||||
types.Content(
|
types.Content(role="user", parts=_parts_from_content(content))
|
||||||
role="user", parts=[types.Part.from_text(text=content)]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Convert tools to Gemini format
|
# Convert tools to Gemini format
|
||||||
@@ -553,7 +580,7 @@ class GeminiClient(GenAIClient):
|
|||||||
# Use streaming API
|
# Use streaming API
|
||||||
content_parts: list[str] = []
|
content_parts: list[str] = []
|
||||||
reasoning_parts: list[str] = []
|
reasoning_parts: list[str] = []
|
||||||
tool_calls_by_index: dict[int, dict[str, Any]] = {}
|
tool_calls_accum: list[dict[str, Any]] = []
|
||||||
finish_reason = "stop"
|
finish_reason = "stop"
|
||||||
usage_stats: dict[str, Any] | None = None
|
usage_stats: dict[str, Any] | None = None
|
||||||
|
|
||||||
@@ -600,7 +627,11 @@ class GeminiClient(GenAIClient):
|
|||||||
content_parts.append(part.text)
|
content_parts.append(part.text)
|
||||||
yield ("content_delta", part.text)
|
yield ("content_delta", part.text)
|
||||||
elif part.function_call:
|
elif part.function_call:
|
||||||
# Handle function call
|
# Gemini streams complete function calls (not partial
|
||||||
|
# argument deltas), so each part is a distinct tool
|
||||||
|
# call. Append rather than accumulate by name — the
|
||||||
|
# latter concatenated parallel/repeated calls into one
|
||||||
|
# invalid arguments string (e.g. `{...}{...}`).
|
||||||
try:
|
try:
|
||||||
arguments = (
|
arguments = (
|
||||||
dict(part.function_call.args)
|
dict(part.function_call.args)
|
||||||
@@ -610,40 +641,16 @@ class GeminiClient(GenAIClient):
|
|||||||
except Exception:
|
except Exception:
|
||||||
arguments = {}
|
arguments = {}
|
||||||
|
|
||||||
# Store tool call
|
tool_calls_accum.append(
|
||||||
tool_call_id = part.function_call.name or ""
|
{
|
||||||
tool_call_name = part.function_call.name or ""
|
"id": part.function_call.name or "",
|
||||||
|
"name": part.function_call.name or "",
|
||||||
# Check if we already have this tool call
|
"arguments": arguments,
|
||||||
found_index = None
|
"thought_signature": getattr(
|
||||||
for idx, tc in tool_calls_by_index.items():
|
part, "thought_signature", None
|
||||||
if tc["name"] == tool_call_name:
|
),
|
||||||
found_index = idx
|
|
||||||
break
|
|
||||||
|
|
||||||
if found_index is None:
|
|
||||||
found_index = len(tool_calls_by_index)
|
|
||||||
tool_calls_by_index[found_index] = {
|
|
||||||
"id": tool_call_id,
|
|
||||||
"name": tool_call_name,
|
|
||||||
"arguments": "",
|
|
||||||
"thought_signature": None,
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
# Accumulate arguments
|
|
||||||
if arguments:
|
|
||||||
tool_calls_by_index[found_index]["arguments"] += (
|
|
||||||
json.dumps(arguments)
|
|
||||||
if isinstance(arguments, dict)
|
|
||||||
else str(arguments)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Capture latest thought_signature for this call
|
|
||||||
chunk_sig = getattr(part, "thought_signature", None)
|
|
||||||
if chunk_sig:
|
|
||||||
tool_calls_by_index[found_index][
|
|
||||||
"thought_signature"
|
|
||||||
] = chunk_sig
|
|
||||||
|
|
||||||
# Build final message
|
# Build final message
|
||||||
full_content = "".join(content_parts).strip() or None
|
full_content = "".join(content_parts).strip() or None
|
||||||
@@ -651,25 +658,20 @@ class GeminiClient(GenAIClient):
|
|||||||
|
|
||||||
# Convert tool calls to list format
|
# Convert tool calls to list format
|
||||||
tool_calls_list = None
|
tool_calls_list = None
|
||||||
if tool_calls_by_index:
|
if tool_calls_accum:
|
||||||
tool_calls_list = []
|
tool_calls_list = [
|
||||||
for tc in tool_calls_by_index.values():
|
{
|
||||||
try:
|
"id": tc["id"],
|
||||||
# Try to parse accumulated arguments as JSON
|
"name": tc["name"],
|
||||||
parsed_args = json.loads(tc["arguments"])
|
"arguments": tc["arguments"]
|
||||||
except (json.JSONDecodeError, Exception):
|
if isinstance(tc["arguments"], dict)
|
||||||
parsed_args = tc["arguments"]
|
else {},
|
||||||
|
"thought_signature": _encode_thought_signature(
|
||||||
tool_calls_list.append(
|
tc.get("thought_signature")
|
||||||
{
|
),
|
||||||
"id": tc["id"],
|
}
|
||||||
"name": tc["name"],
|
for tc in tool_calls_accum
|
||||||
"arguments": parsed_args,
|
]
|
||||||
"thought_signature": _encode_thought_signature(
|
|
||||||
tc.get("thought_signature")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
finish_reason = "tool_calls"
|
finish_reason = "tool_calls"
|
||||||
|
|
||||||
if usage_stats is not None:
|
if usage_stats is not None:
|
||||||
|
|||||||
@@ -76,29 +76,6 @@ def _parse_launch_arg(args: list[str], flag: str) -> str | None:
|
|||||||
return args[idx + 1]
|
return args[idx + 1]
|
||||||
|
|
||||||
|
|
||||||
def _fetch_llama_props(base_url: str, model: str) -> dict[str, Any]:
|
|
||||||
"""Fetch /props from a llama.cpp server, with llama-swap fallback.
|
|
||||||
|
|
||||||
Raises the underlying RequestException if both endpoints fail; callers
|
|
||||||
decide how to surface the failure.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
response = requests.get(
|
|
||||||
f"{base_url}/props",
|
|
||||||
params={"model": model},
|
|
||||||
timeout=10,
|
|
||||||
)
|
|
||||||
response.raise_for_status()
|
|
||||||
return cast(dict[str, Any], response.json())
|
|
||||||
except Exception:
|
|
||||||
response = requests.get(
|
|
||||||
f"{base_url}/upstream/{model}/props",
|
|
||||||
timeout=10,
|
|
||||||
)
|
|
||||||
response.raise_for_status()
|
|
||||||
return cast(dict[str, Any], response.json())
|
|
||||||
|
|
||||||
|
|
||||||
def _to_jpeg(img_bytes: bytes) -> bytes | None:
|
def _to_jpeg(img_bytes: bytes) -> bytes | None:
|
||||||
"""Convert image bytes to JPEG. llama.cpp/STB does not support WebP."""
|
"""Convert image bytes to JPEG. llama.cpp/STB does not support WebP."""
|
||||||
try:
|
try:
|
||||||
@@ -128,6 +105,48 @@ class LlamaCppClient(GenAIClient):
|
|||||||
_text_baseline_tokens: int | None
|
_text_baseline_tokens: int | None
|
||||||
_media_marker: str
|
_media_marker: str
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supports_embeddings(self) -> bool:
|
||||||
|
"""llama.cpp exposes an /embeddings endpoint for any loaded model."""
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _auth_headers(self) -> dict | None:
|
||||||
|
"""Bearer auth header when an API key is configured, else None."""
|
||||||
|
if self.genai_config.api_key:
|
||||||
|
return {"Authorization": "Bearer " + self.genai_config.api_key}
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _get(self, url: str, **kwargs: Any) -> requests.Response:
|
||||||
|
"""GET with the configured auth headers injected."""
|
||||||
|
return requests.get(url, headers=self._auth_headers(), **kwargs)
|
||||||
|
|
||||||
|
def _post(self, url: str, **kwargs: Any) -> requests.Response:
|
||||||
|
"""POST with the configured auth headers injected."""
|
||||||
|
return requests.post(url, headers=self._auth_headers(), **kwargs)
|
||||||
|
|
||||||
|
def _fetch_llama_props(self, base_url: str, model: str) -> dict[str, Any]:
|
||||||
|
"""Fetch /props from a llama.cpp server, with llama-swap fallback.
|
||||||
|
|
||||||
|
Raises the underlying RequestException if both endpoints fail; callers
|
||||||
|
decide how to surface the failure.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
response = self._get(
|
||||||
|
f"{base_url}/props",
|
||||||
|
params={"model": model},
|
||||||
|
timeout=10,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
return cast(dict[str, Any], response.json())
|
||||||
|
except Exception:
|
||||||
|
response = self._get(
|
||||||
|
f"{base_url}/upstream/{model}/props",
|
||||||
|
timeout=10,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
return cast(dict[str, Any], response.json())
|
||||||
|
|
||||||
def _init_provider(self) -> str | None:
|
def _init_provider(self) -> str | None:
|
||||||
"""Initialize the client and query model metadata from the server."""
|
"""Initialize the client and query model metadata from the server."""
|
||||||
self.provider_options = {
|
self.provider_options = {
|
||||||
@@ -173,7 +192,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
logger.info(
|
logger.info(
|
||||||
"llama.cpp model '%s' initialized — context: %s, vision: %s, audio: %s, tools: %s, reasoning: %s",
|
"llama.cpp model '%s' initialized — context: %s, vision: %s, audio: %s, tools: %s, reasoning: %s",
|
||||||
configured_model,
|
configured_model,
|
||||||
self._context_size or "unknown",
|
self.get_context_size(),
|
||||||
self._supports_vision,
|
self._supports_vision,
|
||||||
self._supports_audio,
|
self._supports_audio,
|
||||||
self._supports_tools,
|
self._supports_tools,
|
||||||
@@ -211,7 +230,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
|
|
||||||
model_entry: dict[str, Any] | None = None
|
model_entry: dict[str, Any] | None = None
|
||||||
try:
|
try:
|
||||||
response = requests.get(f"{base_url}/v1/models", timeout=10)
|
response = self._get(f"{base_url}/v1/models", timeout=10)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
models_data = response.json()
|
models_data = response.json()
|
||||||
|
|
||||||
@@ -272,7 +291,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
info["supports_tools"] = True
|
info["supports_tools"] = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
props = _fetch_llama_props(base_url, configured_model)
|
props = self._fetch_llama_props(base_url, configured_model)
|
||||||
|
|
||||||
if info["context_size"] is None:
|
if info["context_size"] is None:
|
||||||
default_settings = props.get("default_generation_settings", {})
|
default_settings = props.get("default_generation_settings", {})
|
||||||
@@ -358,7 +377,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
if self.supports_toggleable_thinking:
|
if self.supports_toggleable_thinking:
|
||||||
payload["chat_template_kwargs"] = {"enable_thinking": enable_thinking}
|
payload["chat_template_kwargs"] = {"enable_thinking": enable_thinking}
|
||||||
|
|
||||||
response = requests.post(
|
response = self._post(
|
||||||
f"{self.provider}/v1/chat/completions",
|
f"{self.provider}/v1/chat/completions",
|
||||||
json=payload,
|
json=payload,
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
@@ -408,7 +427,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
if base_url is None:
|
if base_url is None:
|
||||||
return []
|
return []
|
||||||
try:
|
try:
|
||||||
response = requests.get(f"{base_url}/v1/models", timeout=10)
|
response = self._get(f"{base_url}/v1/models", timeout=10)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
models = []
|
models = []
|
||||||
for m in response.json().get("data", []):
|
for m in response.json().get("data", []):
|
||||||
@@ -511,7 +530,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
"messages": [{"role": "user", "content": content}],
|
"messages": [{"role": "user", "content": content}],
|
||||||
"max_tokens": 1,
|
"max_tokens": 1,
|
||||||
}
|
}
|
||||||
response = requests.post(
|
response = self._post(
|
||||||
f"{self.provider}/v1/chat/completions",
|
f"{self.provider}/v1/chat/completions",
|
||||||
json=payload,
|
json=payload,
|
||||||
timeout=60,
|
timeout=60,
|
||||||
@@ -621,7 +640,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
if self.provider is None:
|
if self.provider is None:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
props = _fetch_llama_props(self.provider, self.genai_config.model)
|
props = self._fetch_llama_props(self.provider, self.genai_config.model)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Failed to refresh llama.cpp media marker: %s", e)
|
logger.warning("Failed to refresh llama.cpp media marker: %s", e)
|
||||||
return False
|
return False
|
||||||
@@ -682,7 +701,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
return content
|
return content
|
||||||
|
|
||||||
def post_embeddings() -> requests.Response:
|
def post_embeddings() -> requests.Response:
|
||||||
return requests.post(
|
return self._post(
|
||||||
f"{self.provider}/embeddings",
|
f"{self.provider}/embeddings",
|
||||||
json={"model": self.genai_config.model, "content": build_content()},
|
json={"model": self.genai_config.model, "content": build_content()},
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
@@ -786,7 +805,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
stream=False,
|
stream=False,
|
||||||
enable_thinking=enable_thinking,
|
enable_thinking=enable_thinking,
|
||||||
)
|
)
|
||||||
response = requests.post(
|
response = self._post(
|
||||||
f"{self.provider}/v1/chat/completions",
|
f"{self.provider}/v1/chat/completions",
|
||||||
json=payload,
|
json=payload,
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
@@ -867,6 +886,7 @@ class LlamaCppClient(GenAIClient):
|
|||||||
"POST",
|
"POST",
|
||||||
f"{self.provider}/v1/chat/completions",
|
f"{self.provider}/v1/chat/completions",
|
||||||
json=payload,
|
json=payload,
|
||||||
|
headers=self._auth_headers(),
|
||||||
) as response:
|
) as response:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
async for line in response.aiter_lines():
|
async for line in response.aiter_lines():
|
||||||
|
|||||||
@@ -423,9 +423,18 @@ class OpenAIClient(GenAIClient):
|
|||||||
for tc in tool_calls_by_index.values():
|
for tc in tool_calls_by_index.values():
|
||||||
try:
|
try:
|
||||||
# Parse accumulated arguments as JSON
|
# Parse accumulated arguments as JSON
|
||||||
parsed_args = json.loads(tc["arguments"])
|
parsed_args = json.loads(tc["arguments"] or "{}")
|
||||||
except (json.JSONDecodeError, Exception):
|
except (json.JSONDecodeError, ValueError):
|
||||||
parsed_args = tc["arguments"]
|
logger.warning(
|
||||||
|
"Failed to parse streamed tool call arguments for %s",
|
||||||
|
tc["name"],
|
||||||
|
)
|
||||||
|
parsed_args = {}
|
||||||
|
|
||||||
|
# Downstream (ToolCall model) requires a dict; never leak a
|
||||||
|
# partial/invalid arguments string.
|
||||||
|
if not isinstance(parsed_args, dict):
|
||||||
|
parsed_args = {}
|
||||||
|
|
||||||
tool_calls_list.append(
|
tool_calls_list.append(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ transport.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from typing import Any
|
from typing import Any, Literal
|
||||||
|
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
|
||||||
@@ -249,6 +249,7 @@ def get_attribute_classifications(config: FrigateConfig) -> list[dict[str, Any]]
|
|||||||
def get_tool_definitions(
|
def get_tool_definitions(
|
||||||
semantic_search_enabled: bool = False,
|
semantic_search_enabled: bool = False,
|
||||||
attribute_classifications: list[dict[str, Any]] | None = None,
|
attribute_classifications: list[dict[str, Any]] | None = None,
|
||||||
|
embeddings_language: Literal["english", "multi"] = "multi",
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
Get OpenAI-compatible tool definitions for Frigate.
|
Get OpenAI-compatible tool definitions for Frigate.
|
||||||
@@ -258,7 +259,9 @@ def get_tool_definitions(
|
|||||||
tool exposes an additional `semantic_query` parameter for descriptive
|
tool exposes an additional `semantic_query` parameter for descriptive
|
||||||
queries (e.g. "person riding a lawn mower") and find_similar_objects is
|
queries (e.g. "person riding a lawn mower") and find_similar_objects is
|
||||||
included. When attribute classification models are configured, an
|
included. When attribute classification models are configured, an
|
||||||
`attribute` parameter is exposed for filtering by their labels.
|
`attribute` parameter is exposed for filtering by their labels. When the
|
||||||
|
embeddings model only understands English (JinaV1), the `semantic_query`
|
||||||
|
description instructs the model to write the query in English.
|
||||||
"""
|
"""
|
||||||
search_objects_properties: dict[str, Any] = {
|
search_objects_properties: dict[str, Any] = {
|
||||||
"camera": {
|
"camera": {
|
||||||
@@ -349,6 +352,14 @@ def get_tool_definitions(
|
|||||||
"When set, combine with label/time/camera/zone filters as "
|
"When set, combine with label/time/camera/zone filters as "
|
||||||
"usual (e.g. label='person', semantic_query='riding a lawn "
|
"usual (e.g. label='person', semantic_query='riding a lawn "
|
||||||
"mower', after='2024-05-01T00:00:00Z')."
|
"mower', after='2024-05-01T00:00:00Z')."
|
||||||
|
+ (
|
||||||
|
" The configured embeddings model only understands "
|
||||||
|
"English, so always write semantic_query in English, "
|
||||||
|
"translating the user's description if they phrased it "
|
||||||
|
"in another language."
|
||||||
|
if embeddings_language == "english"
|
||||||
|
else ""
|
||||||
|
)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,14 +693,17 @@ def build_chat_system_prompt(
|
|||||||
if camera_config.friendly_name
|
if camera_config.friendly_name
|
||||||
else camera_id.replace("_", " ").title()
|
else camera_id.replace("_", " ").title()
|
||||||
)
|
)
|
||||||
zone_names = list(camera_config.zones.keys())
|
zone_descriptors = [
|
||||||
|
f"{zone_config.get_formatted_name(zone_name)} (ID: {zone_name})"
|
||||||
|
for zone_name, zone_config in camera_config.zones.items()
|
||||||
|
]
|
||||||
if not has_speed_zone:
|
if not has_speed_zone:
|
||||||
has_speed_zone = any(
|
has_speed_zone = any(
|
||||||
zone.distances for zone in camera_config.zones.values()
|
zone.distances for zone in camera_config.zones.values()
|
||||||
)
|
)
|
||||||
if zone_names:
|
if zone_descriptors:
|
||||||
cameras_info.append(
|
cameras_info.append(
|
||||||
f" - {friendly_name} (ID: {camera_id}, zones: {', '.join(zone_names)})"
|
f" - {friendly_name} (ID: {camera_id}, zones: {', '.join(zone_descriptors)})"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
cameras_info.append(f" - {friendly_name} (ID: {camera_id})")
|
cameras_info.append(f" - {friendly_name} (ID: {camera_id})")
|
||||||
@@ -699,7 +713,7 @@ def build_chat_system_prompt(
|
|||||||
cameras_section = (
|
cameras_section = (
|
||||||
"\n\nAvailable cameras:\n"
|
"\n\nAvailable cameras:\n"
|
||||||
+ "\n".join(cameras_info)
|
+ "\n".join(cameras_info)
|
||||||
+ "\n\nWhen users refer to cameras by their friendly name (e.g., 'Back Deck Camera'), use the corresponding camera ID (e.g., 'back_deck_cam') in tool calls."
|
+ "\n\nWhen users refer to cameras or zones by their friendly name (e.g., 'Back Deck Camera', 'Front Walkway'), use the corresponding ID (e.g., 'back_deck_cam', 'front_walk') in tool calls. Tool results also identify zones by their ID, so when presenting cameras or zones back to the user, translate the ID to its friendly name."
|
||||||
)
|
)
|
||||||
|
|
||||||
speed_units_section = ""
|
speed_units_section = ""
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ class BirdsEyeFrameManager:
|
|||||||
|
|
||||||
self.camera_layout: list[Any] = []
|
self.camera_layout: list[Any] = []
|
||||||
self.active_cameras: set[str] = set()
|
self.active_cameras: set[str] = set()
|
||||||
|
self.layout_camera_order: list[str] = []
|
||||||
self.last_output_time = 0.0
|
self.last_output_time = 0.0
|
||||||
|
|
||||||
def add_camera(self, cam: str) -> None:
|
def add_camera(self, cam: str) -> None:
|
||||||
@@ -372,6 +373,13 @@ class BirdsEyeFrameManager:
|
|||||||
if cam in self.cameras:
|
if cam in self.cameras:
|
||||||
del self.cameras[cam]
|
del self.cameras[cam]
|
||||||
|
|
||||||
|
def sort_cameras(self, cameras: set[str]) -> list[str]:
|
||||||
|
"""Sort cameras by birdseye order, falling back to name when tied."""
|
||||||
|
return sorted(
|
||||||
|
cameras,
|
||||||
|
key=lambda camera: (self.config.cameras[camera].birdseye.order, camera),
|
||||||
|
)
|
||||||
|
|
||||||
def clear_frame(self) -> None:
|
def clear_frame(self) -> None:
|
||||||
logger.debug("Clearing the birdseye frame")
|
logger.debug("Clearing the birdseye frame")
|
||||||
self.frame[:] = self.blank_frame
|
self.frame[:] = self.blank_frame
|
||||||
@@ -482,6 +490,7 @@ class BirdsEyeFrameManager:
|
|||||||
# if the layout needs to be cleared
|
# if the layout needs to be cleared
|
||||||
self.camera_layout = []
|
self.camera_layout = []
|
||||||
self.active_cameras = set()
|
self.active_cameras = set()
|
||||||
|
self.layout_camera_order = []
|
||||||
self.clear_frame()
|
self.clear_frame()
|
||||||
frame_changed = True
|
frame_changed = True
|
||||||
layout_changed = True
|
layout_changed = True
|
||||||
@@ -500,21 +509,21 @@ class BirdsEyeFrameManager:
|
|||||||
else:
|
else:
|
||||||
reset_layout = True
|
reset_layout = True
|
||||||
|
|
||||||
|
sorted_active_cameras = self.sort_cameras(active_cameras)
|
||||||
|
|
||||||
|
if not reset_layout and sorted_active_cameras != self.layout_camera_order:
|
||||||
|
logger.debug("Birdseye camera order changed")
|
||||||
|
reset_layout = True
|
||||||
|
|
||||||
if reset_layout:
|
if reset_layout:
|
||||||
logger.debug("Resetting Birdseye layout...")
|
logger.debug("Resetting Birdseye layout...")
|
||||||
self.clear_frame()
|
self.clear_frame()
|
||||||
self.active_cameras = active_cameras
|
self.active_cameras = active_cameras
|
||||||
|
self.layout_camera_order = sorted_active_cameras
|
||||||
layout_changed = True # Layout is changing due to reset
|
layout_changed = True # Layout is changing due to reset
|
||||||
# this also converts added_cameras from a set to a list since we need
|
# this also converts added_cameras from a set to a list since we need
|
||||||
# to pop elements in order
|
# to pop elements in order
|
||||||
active_cameras_to_add = sorted(
|
active_cameras_to_add = sorted_active_cameras
|
||||||
active_cameras,
|
|
||||||
# sort cameras by order and by name if the order is the same
|
|
||||||
key=lambda active_camera: (
|
|
||||||
self.config.cameras[active_camera].birdseye.order,
|
|
||||||
active_camera,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
if len(active_cameras) == 1:
|
if len(active_cameras) == 1:
|
||||||
# show single camera as fullscreen
|
# show single camera as fullscreen
|
||||||
camera = active_cameras_to_add[0]
|
camera = active_cameras_to_add[0]
|
||||||
@@ -780,6 +789,7 @@ class BirdsEyeFrameManager:
|
|||||||
frame_changed, layout_changed = False, False
|
frame_changed, layout_changed = False, False
|
||||||
self.active_cameras = set()
|
self.active_cameras = set()
|
||||||
self.camera_layout = []
|
self.camera_layout = []
|
||||||
|
self.layout_camera_order = []
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|
||||||
# if the frame was updated or the fps is too low, send frame
|
# if the frame was updated or the fps is too low, send frame
|
||||||
|
|||||||
@@ -159,6 +159,8 @@ class FFMpegConverter(threading.Thread):
|
|||||||
f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}"
|
f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Path(self.path).parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
p = sp.run(
|
p = sp.run(
|
||||||
self.ffmpeg_cmd.split(" "),
|
self.ffmpeg_cmd.split(" "),
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ from norfair.camera_motion import (
|
|||||||
from frigate.camera import PTZMetrics
|
from frigate.camera import PTZMetrics
|
||||||
from frigate.comms.dispatcher import Dispatcher
|
from frigate.comms.dispatcher import Dispatcher
|
||||||
from frigate.config import CameraConfig, FrigateConfig, ZoomingModeEnum
|
from frigate.config import CameraConfig, FrigateConfig, ZoomingModeEnum
|
||||||
|
from frigate.config.camera.updater import (
|
||||||
|
CameraConfigUpdateEnum,
|
||||||
|
CameraConfigUpdateSubscriber,
|
||||||
|
)
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
AUTOTRACKING_MAX_AREA_RATIO,
|
AUTOTRACKING_MAX_AREA_RATIO,
|
||||||
AUTOTRACKING_MAX_MOVE_METRICS,
|
AUTOTRACKING_MAX_MOVE_METRICS,
|
||||||
@@ -194,7 +198,9 @@ class PtzAutoTrackerThread(threading.Thread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while not self.stop_event.wait(1):
|
while not self.stop_event.wait(1):
|
||||||
for camera, camera_config in self.config.cameras.items():
|
self.ptz_autotracker.check_for_updates()
|
||||||
|
|
||||||
|
for camera, camera_config in list(self.config.cameras.items()):
|
||||||
if not camera_config.enabled:
|
if not camera_config.enabled:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -211,6 +217,7 @@ class PtzAutoTrackerThread(threading.Thread):
|
|||||||
self.ptz_autotracker.tracked_object[camera] = None
|
self.ptz_autotracker.tracked_object[camera] = None
|
||||||
self.ptz_autotracker.tracked_object_history[camera].clear()
|
self.ptz_autotracker.tracked_object_history[camera].clear()
|
||||||
|
|
||||||
|
self.ptz_autotracker.config_subscriber.stop()
|
||||||
logger.info("Exiting autotracker...")
|
logger.info("Exiting autotracker...")
|
||||||
|
|
||||||
|
|
||||||
@@ -244,6 +251,16 @@ class PtzAutoTracker:
|
|||||||
self.zoom_time: dict[str, float] = {}
|
self.zoom_time: dict[str, float] = {}
|
||||||
self.zoom_factor: dict[str, object] = {}
|
self.zoom_factor: dict[str, object] = {}
|
||||||
|
|
||||||
|
self.config_subscriber = CameraConfigUpdateSubscriber(
|
||||||
|
self.config,
|
||||||
|
self.config.cameras,
|
||||||
|
[
|
||||||
|
CameraConfigUpdateEnum.add,
|
||||||
|
CameraConfigUpdateEnum.autotracking,
|
||||||
|
CameraConfigUpdateEnum.onvif,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# if cam is set to autotrack, onvif should be set up
|
# if cam is set to autotrack, onvif should be set up
|
||||||
for camera, camera_config in self.config.cameras.items():
|
for camera, camera_config in self.config.cameras.items():
|
||||||
if not camera_config.enabled:
|
if not camera_config.enabled:
|
||||||
@@ -260,6 +277,29 @@ class PtzAutoTracker:
|
|||||||
# Wait for the coroutine to complete
|
# Wait for the coroutine to complete
|
||||||
future.result()
|
future.result()
|
||||||
|
|
||||||
|
def check_for_updates(self) -> None:
|
||||||
|
"""Apply camera config updates and mirror autotracking state to ptz metrics.
|
||||||
|
|
||||||
|
The camera processes read autotracker_enabled rather than the config, so it
|
||||||
|
has to follow every path that can change autotracking, not just the mqtt
|
||||||
|
toggle that writes it directly.
|
||||||
|
"""
|
||||||
|
updates = self.config_subscriber.check_for_updates()
|
||||||
|
|
||||||
|
for cameras in updates.values():
|
||||||
|
for camera in cameras:
|
||||||
|
camera_config = self.config.cameras.get(camera)
|
||||||
|
metrics = self.ptz_metrics.get(camera)
|
||||||
|
|
||||||
|
# a camera added at runtime gets its metrics from the maintainer on
|
||||||
|
# another thread, which seeds them from this same config value
|
||||||
|
if camera_config is None or metrics is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
metrics.autotracker_enabled.value = (
|
||||||
|
camera_config.onvif.autotracking.enabled
|
||||||
|
)
|
||||||
|
|
||||||
async def _autotracker_setup(self, camera_config: CameraConfig, camera: str):
|
async def _autotracker_setup(self, camera_config: CameraConfig, camera: str):
|
||||||
logger.debug(f"{camera}: Autotracker init")
|
logger.debug(f"{camera}: Autotracker init")
|
||||||
|
|
||||||
@@ -1365,7 +1405,7 @@ class PtzAutoTracker:
|
|||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
|
|
||||||
if camera_config.onvif.autotracking.enabled:
|
if camera_config.onvif.autotracking.enabled:
|
||||||
if not self.autotracker_init[camera]:
|
if not self.autotracker_init.get(camera):
|
||||||
future = asyncio.run_coroutine_threadsafe(
|
future = asyncio.run_coroutine_threadsafe(
|
||||||
self._autotracker_setup(camera_config, camera), self.onvif.loop
|
self._autotracker_setup(camera_config, camera), self.onvif.loop
|
||||||
)
|
)
|
||||||
@@ -1483,9 +1523,11 @@ class PtzAutoTracker:
|
|||||||
}
|
}
|
||||||
|
|
||||||
async def camera_maintenance(self, camera):
|
async def camera_maintenance(self, camera):
|
||||||
# bail and don't check anything if we're calibrating or tracking an object
|
# bail and don't check anything if we're not set up yet, calibrating, or
|
||||||
|
# tracking an object. a camera enabled at runtime has no autotracker_init
|
||||||
|
# entry until autotrack_object sets it up
|
||||||
if (
|
if (
|
||||||
not self.autotracker_init[camera]
|
not self.autotracker_init.get(camera)
|
||||||
or self.calibrating[camera]
|
or self.calibrating[camera]
|
||||||
or self.tracked_object[camera] is not None
|
or self.tracked_object[camera] is not None
|
||||||
):
|
):
|
||||||
|
|||||||
+10
-9
@@ -344,16 +344,17 @@ class OnvifController:
|
|||||||
autotracking_config.enabled_in_config and autotracking_config.enabled
|
autotracking_config.enabled_in_config and autotracking_config.enabled
|
||||||
)
|
)
|
||||||
|
|
||||||
# autotracking-only: status request and service capabilities
|
# these are local and cost nothing to build, and autotracking can be enabled
|
||||||
if autotracking_enabled:
|
# after a camera is initialized, so always create them rather than baking the
|
||||||
status_request = ptz.create_type("GetStatus")
|
# current config value into init state
|
||||||
status_request.ProfileToken = profile.token
|
status_request = ptz.create_type("GetStatus")
|
||||||
self.cams[camera_name]["status_request"] = status_request
|
status_request.ProfileToken = profile.token
|
||||||
|
self.cams[camera_name]["status_request"] = status_request
|
||||||
|
|
||||||
service_capabilities_request = ptz.create_type("GetServiceCapabilities")
|
service_capabilities_request = ptz.create_type("GetServiceCapabilities")
|
||||||
self.cams[camera_name]["service_capabilities_request"] = (
|
self.cams[camera_name]["service_capabilities_request"] = (
|
||||||
service_capabilities_request
|
service_capabilities_request
|
||||||
)
|
)
|
||||||
|
|
||||||
# setup relative move request when FOV relative movement is supported
|
# setup relative move request when FOV relative movement is supported
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -115,9 +115,11 @@ class PendingReviewSegment:
|
|||||||
if self._frame is not None:
|
if self._frame is not None:
|
||||||
self.thumb_time = datetime.datetime.now().timestamp()
|
self.thumb_time = datetime.datetime.now().timestamp()
|
||||||
self.has_frame = True
|
self.has_frame = True
|
||||||
cv2.imwrite(
|
Path(self.frame_path).parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if not cv2.imwrite(
|
||||||
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
||||||
)
|
):
|
||||||
|
logger.error("Failed to write review thumbnail to %s", self.frame_path)
|
||||||
|
|
||||||
def save_full_frame(self, camera_config: CameraConfig, frame: np.ndarray) -> None:
|
def save_full_frame(self, camera_config: CameraConfig, frame: np.ndarray) -> None:
|
||||||
color_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
|
color_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
|
||||||
@@ -128,9 +130,11 @@ class PendingReviewSegment:
|
|||||||
|
|
||||||
if self._frame is not None:
|
if self._frame is not None:
|
||||||
self.has_frame = True
|
self.has_frame = True
|
||||||
cv2.imwrite(
|
Path(self.frame_path).parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if not cv2.imwrite(
|
||||||
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
||||||
)
|
):
|
||||||
|
logger.error("Failed to write review thumbnail to %s", self.frame_path)
|
||||||
|
|
||||||
def get_data(self, ended: bool) -> dict:
|
def get_data(self, ended: bool) -> dict:
|
||||||
end_time = None
|
end_time = None
|
||||||
@@ -374,6 +378,16 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
"""Forcibly end the pending segment for a camera."""
|
"""Forcibly end the pending segment for a camera."""
|
||||||
segment = self.active_review_segments.get(camera)
|
segment = self.active_review_segments.get(camera)
|
||||||
if segment:
|
if segment:
|
||||||
|
if self.indefinite_events.get(camera):
|
||||||
|
self.indefinite_events[camera] = {}
|
||||||
|
now = datetime.datetime.now().timestamp()
|
||||||
|
|
||||||
|
if segment.last_alert_time == sys.maxsize:
|
||||||
|
segment.last_alert_time = now
|
||||||
|
|
||||||
|
if segment.last_detection_time == sys.maxsize:
|
||||||
|
segment.last_detection_time = now
|
||||||
|
|
||||||
prev_data = segment.get_data(False)
|
prev_data = segment.get_data(False)
|
||||||
return self._publish_segment_end(segment, prev_data)
|
return self._publish_segment_end(segment, prev_data)
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -132,6 +132,77 @@ class TestHttpApp(BaseTestHttp):
|
|||||||
"models": ["fake-model-a", "fake-model-b"],
|
"models": ["fake-model-a", "fake-model-b"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def test_genai_probe_resolves_sentinel_to_saved_api_key(self):
|
||||||
|
# After a save the UI's api_key field holds the redaction sentinel;
|
||||||
|
# the probe must substitute the saved key for the named entry instead
|
||||||
|
# of sending the literal sentinel to the provider (GH discussion 23754).
|
||||||
|
probed_keys: list[str | None] = []
|
||||||
|
|
||||||
|
class CapturingClient(GenAIClient):
|
||||||
|
def list_models(self):
|
||||||
|
probed_keys.append(self.genai_config.api_key)
|
||||||
|
return ["fake-model"]
|
||||||
|
|
||||||
|
self.minimal_config["genai"] = {
|
||||||
|
"llm": {
|
||||||
|
"provider": "openai",
|
||||||
|
"api_key": "sk-saved",
|
||||||
|
"base_url": "https://example.invalid",
|
||||||
|
"model": "fake-model",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app = super().create_app()
|
||||||
|
|
||||||
|
with (
|
||||||
|
AuthTestClient(app) as client,
|
||||||
|
patch.dict(
|
||||||
|
frigate.genai.PROVIDERS,
|
||||||
|
{GenAIProviderEnum.openai: CapturingClient},
|
||||||
|
),
|
||||||
|
):
|
||||||
|
response = client.post(
|
||||||
|
"/genai/probe",
|
||||||
|
json={
|
||||||
|
"provider": "openai",
|
||||||
|
"name": "llm",
|
||||||
|
"api_key": REDACTED_CREDENTIAL_SENTINEL,
|
||||||
|
"base_url": "https://example.invalid",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json()["success"] is True
|
||||||
|
assert probed_keys == ["sk-saved"]
|
||||||
|
|
||||||
|
def test_genai_probe_sentinel_without_saved_entry_sends_no_key(self):
|
||||||
|
# If the sentinel arrives for an entry that has no saved config, the
|
||||||
|
# probe must drop the key entirely rather than leak the sentinel.
|
||||||
|
probed_keys: list[str | None] = []
|
||||||
|
|
||||||
|
class CapturingClient(GenAIClient):
|
||||||
|
def list_models(self):
|
||||||
|
probed_keys.append(self.genai_config.api_key)
|
||||||
|
return ["fake-model"]
|
||||||
|
|
||||||
|
app = super().create_app()
|
||||||
|
|
||||||
|
with (
|
||||||
|
AuthTestClient(app) as client,
|
||||||
|
patch.dict(
|
||||||
|
frigate.genai.PROVIDERS,
|
||||||
|
{GenAIProviderEnum.openai: CapturingClient},
|
||||||
|
),
|
||||||
|
):
|
||||||
|
response = client.post(
|
||||||
|
"/genai/probe",
|
||||||
|
json={
|
||||||
|
"provider": "openai",
|
||||||
|
"name": "llm",
|
||||||
|
"api_key": REDACTED_CREDENTIAL_SENTINEL,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert probed_keys == [None]
|
||||||
|
|
||||||
def test_genai_probe_empty_list_is_treated_as_failure(self):
|
def test_genai_probe_empty_list_is_treated_as_failure(self):
|
||||||
# The plugin's list_models() returns [] on connection failure rather
|
# The plugin's list_models() returns [] on connection failure rather
|
||||||
# than raising. The endpoint should surface that as success=false so
|
# than raising. The endpoint should surface that as success=false so
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
"""Tests for the camera delete endpoint's runtime config handling."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import MagicMock, Mock, patch
|
||||||
|
|
||||||
|
import ruamel.yaml
|
||||||
|
|
||||||
|
from frigate.config import FrigateConfig
|
||||||
|
from frigate.config.camera.updater import CameraConfigUpdatePublisher
|
||||||
|
from frigate.models import Event, Recordings, ReviewSegment
|
||||||
|
from frigate.test.http_api.base_http_test import AuthTestClient, BaseTestHttp
|
||||||
|
|
||||||
|
|
||||||
|
class TestDeleteCameraRuntimeConfig(BaseTestHttp):
|
||||||
|
"""Deleting a camera must keep the API and dispatcher on the same config."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp(models=[Event, Recordings, ReviewSegment])
|
||||||
|
self.minimal_config = {
|
||||||
|
"mqtt": {"host": "mqtt"},
|
||||||
|
"cameras": {
|
||||||
|
"front_door": {
|
||||||
|
"ffmpeg": {
|
||||||
|
"inputs": [
|
||||||
|
{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"detect": {"height": 1080, "width": 1920, "fps": 5},
|
||||||
|
},
|
||||||
|
"back_yard": {
|
||||||
|
"ffmpeg": {
|
||||||
|
"inputs": [
|
||||||
|
{"path": "rtsp://10.0.0.2:554/video", "roles": ["detect"]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"detect": {"height": 720, "width": 1280, "fps": 10},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _write_config_file(self):
|
||||||
|
yaml = ruamel.yaml.YAML()
|
||||||
|
f = tempfile.NamedTemporaryFile(mode="w", suffix=".yml", delete=False)
|
||||||
|
yaml.dump(self.minimal_config, f)
|
||||||
|
f.close()
|
||||||
|
return f.name
|
||||||
|
|
||||||
|
def _create_app_with_dispatcher(self, dispatcher):
|
||||||
|
from fastapi import Request
|
||||||
|
|
||||||
|
from frigate.api.auth import get_allowed_cameras_for_filter, get_current_user
|
||||||
|
from frigate.api.fastapi_app import create_fastapi_app
|
||||||
|
|
||||||
|
mock_publisher = Mock(spec=CameraConfigUpdatePublisher)
|
||||||
|
mock_publisher.publisher = MagicMock()
|
||||||
|
|
||||||
|
app = create_fastapi_app(
|
||||||
|
FrigateConfig(**self.minimal_config),
|
||||||
|
self.db,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
mock_publisher,
|
||||||
|
None,
|
||||||
|
dispatcher=dispatcher,
|
||||||
|
enforce_default_admin=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
async def mock_get_current_user(request: Request):
|
||||||
|
return {
|
||||||
|
"username": request.headers.get("remote-user"),
|
||||||
|
"role": request.headers.get("remote-role"),
|
||||||
|
}
|
||||||
|
|
||||||
|
async def mock_get_allowed_cameras_for_filter(request: Request):
|
||||||
|
return list(self.minimal_config.get("cameras", {}).keys())
|
||||||
|
|
||||||
|
app.dependency_overrides[get_current_user] = mock_get_current_user
|
||||||
|
app.dependency_overrides[get_allowed_cameras_for_filter] = (
|
||||||
|
mock_get_allowed_cameras_for_filter
|
||||||
|
)
|
||||||
|
|
||||||
|
return app, mock_publisher
|
||||||
|
|
||||||
|
@patch("frigate.api.camera.requests.delete")
|
||||||
|
@patch("frigate.api.camera.cleanup_camera_files")
|
||||||
|
@patch("frigate.api.camera.cleanup_camera_db")
|
||||||
|
@patch("frigate.api.camera.find_config_file")
|
||||||
|
def test_delete_syncs_dispatcher_and_prunes_runtime_state(
|
||||||
|
self, mock_find_config, mock_cleanup_db, mock_cleanup_files, mock_go2rtc_delete
|
||||||
|
):
|
||||||
|
"""Deleting a camera swaps every config reference and prunes its state."""
|
||||||
|
config_path = self._write_config_file()
|
||||||
|
mock_find_config.return_value = config_path
|
||||||
|
mock_cleanup_db.return_value = ({}, [])
|
||||||
|
|
||||||
|
dispatcher = MagicMock()
|
||||||
|
dispatcher.comms = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
app, _ = self._create_app_with_dispatcher(dispatcher)
|
||||||
|
|
||||||
|
with AuthTestClient(app) as client:
|
||||||
|
resp = client.delete("/cameras/front_door")
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
self.assertTrue(resp.json()["success"])
|
||||||
|
|
||||||
|
# the dispatcher must be moved onto the same new object the API
|
||||||
|
# now serves, and that object must no longer contain the camera
|
||||||
|
self.assertIs(dispatcher.config, app.frigate_config)
|
||||||
|
self.assertNotIn("front_door", dispatcher.config.cameras)
|
||||||
|
self.assertIn("back_yard", dispatcher.config.cameras)
|
||||||
|
|
||||||
|
# surviving cameras' overrides are re-layered onto the new object
|
||||||
|
dispatcher.reapply_runtime_state_to_config.assert_called_once_with()
|
||||||
|
|
||||||
|
# the deleted camera's persisted overrides are pruned
|
||||||
|
dispatcher.clear_runtime_state_for_camera.assert_called_once_with(
|
||||||
|
"front_door"
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
os.unlink(config_path)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
@@ -91,6 +91,123 @@ class TestConfigSetWildcardPropagation(BaseTestHttp):
|
|||||||
|
|
||||||
return app, mock_publisher
|
return app, mock_publisher
|
||||||
|
|
||||||
|
def _create_app_with_dispatcher(self, dispatcher):
|
||||||
|
"""Create app with a mocked config publisher and a real-ish dispatcher."""
|
||||||
|
from fastapi import Request
|
||||||
|
|
||||||
|
from frigate.api.auth import get_allowed_cameras_for_filter, get_current_user
|
||||||
|
from frigate.api.fastapi_app import create_fastapi_app
|
||||||
|
|
||||||
|
mock_publisher = Mock(spec=CameraConfigUpdatePublisher)
|
||||||
|
mock_publisher.publisher = MagicMock()
|
||||||
|
|
||||||
|
app = create_fastapi_app(
|
||||||
|
FrigateConfig(**self.minimal_config),
|
||||||
|
self.db,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
mock_publisher,
|
||||||
|
None,
|
||||||
|
dispatcher=dispatcher,
|
||||||
|
enforce_default_admin=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
async def mock_get_current_user(request: Request):
|
||||||
|
username = request.headers.get("remote-user")
|
||||||
|
role = request.headers.get("remote-role")
|
||||||
|
return {"username": username, "role": role}
|
||||||
|
|
||||||
|
async def mock_get_allowed_cameras_for_filter(request: Request):
|
||||||
|
return list(self.minimal_config.get("cameras", {}).keys())
|
||||||
|
|
||||||
|
app.dependency_overrides[get_current_user] = mock_get_current_user
|
||||||
|
app.dependency_overrides[get_allowed_cameras_for_filter] = (
|
||||||
|
mock_get_allowed_cameras_for_filter
|
||||||
|
)
|
||||||
|
|
||||||
|
return app, mock_publisher
|
||||||
|
|
||||||
|
@patch("frigate.api.app.find_config_file")
|
||||||
|
def test_runtime_disabled_camera_survives_unrelated_save(self, mock_find_config):
|
||||||
|
"""A camera turned off at runtime stays off when another camera is saved."""
|
||||||
|
config_path = self._write_config_file()
|
||||||
|
mock_find_config.return_value = config_path
|
||||||
|
|
||||||
|
dispatcher = MagicMock()
|
||||||
|
dispatcher.comms = []
|
||||||
|
|
||||||
|
# front_door was turned off via the UI: the override is on disk, and
|
||||||
|
# yaml still says enabled: true. Stand in for the real replay, which
|
||||||
|
# reads dispatcher.config - the object the endpoint just swapped in.
|
||||||
|
def fake_reapply():
|
||||||
|
dispatcher.config.cameras["front_door"].enabled = False
|
||||||
|
|
||||||
|
dispatcher.reapply_runtime_state_to_config.side_effect = fake_reapply
|
||||||
|
|
||||||
|
try:
|
||||||
|
app, _ = self._create_app_with_dispatcher(dispatcher)
|
||||||
|
|
||||||
|
with AuthTestClient(app) as client:
|
||||||
|
resp = client.put(
|
||||||
|
"/config/set",
|
||||||
|
json={
|
||||||
|
"config_data": {
|
||||||
|
"cameras": {"back_yard": {"detect": {"fps": 7}}}
|
||||||
|
},
|
||||||
|
"requires_restart": 0,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
self.assertTrue(resp.json()["success"])
|
||||||
|
|
||||||
|
# the swap must be repaired: the new config object the API and
|
||||||
|
# dispatcher now share has to still show front_door as off
|
||||||
|
dispatcher.reapply_runtime_state_to_config.assert_called_once_with()
|
||||||
|
self.assertFalse(app.frigate_config.cameras["front_door"].enabled)
|
||||||
|
self.assertIs(dispatcher.config, app.frigate_config)
|
||||||
|
|
||||||
|
# yaml-wins ordering: the surgical clear for rewritten keys
|
||||||
|
# must run before the replay, or a save that rewrote a toggle
|
||||||
|
# would have its old override resurrected
|
||||||
|
call_names = [name for name, _, _ in dispatcher.mock_calls]
|
||||||
|
self.assertLess(
|
||||||
|
call_names.index("clear_runtime_state_for_yaml_keys"),
|
||||||
|
call_names.index("reapply_runtime_state_to_config"),
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
os.unlink(config_path)
|
||||||
|
|
||||||
|
@patch("frigate.api.app.find_config_file")
|
||||||
|
def test_no_reapply_when_config_is_not_swapped(self, mock_find_config):
|
||||||
|
"""A restart-required save with no update topic never swaps, so no replay."""
|
||||||
|
config_path = self._write_config_file()
|
||||||
|
mock_find_config.return_value = config_path
|
||||||
|
|
||||||
|
dispatcher = MagicMock()
|
||||||
|
dispatcher.comms = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
app, _ = self._create_app_with_dispatcher(dispatcher)
|
||||||
|
|
||||||
|
with AuthTestClient(app) as client:
|
||||||
|
resp = client.put(
|
||||||
|
"/config/set",
|
||||||
|
json={
|
||||||
|
"config_data": {"mqtt": {"host": "other"}},
|
||||||
|
"requires_restart": 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
dispatcher.reapply_runtime_state_to_config.assert_not_called()
|
||||||
|
finally:
|
||||||
|
os.unlink(config_path)
|
||||||
|
|
||||||
def _write_config_file(self):
|
def _write_config_file(self):
|
||||||
"""Write the minimal config to a temp YAML file and return the path."""
|
"""Write the minimal config to a temp YAML file and return the path."""
|
||||||
yaml = ruamel.yaml.YAML()
|
yaml = ruamel.yaml.YAML()
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user