Event and clip information is managed in a sqlite database at /media/frigate/clips/frigate.db. If that database is deleted, clips will be orphaned and will need to be cleaned up manually. They also won't show up in the Media Browser within Home Assistant.
If you are storing your clips on a network share (SMB, NFS, etc), you may get a database is locked error message on startup. You can customize the location of the database in the config if necessary.
This may need to be in a custom location if network storage is used for clips.
The input and output parameters need to be adjusted for MJPEG cameras
input_args:
--avoid_negative_ts
- make_zero
--fflags
- nobuffer
--flags
- low_delay
--strict
- experimental
--fflags
- +genpts+discardcorrupt
--r
-"3"# <---- adjust depending on your desired frame rate from the mjpeg image
--use_wallclock_as_timestamps
-"1"
Note that mjpeg cameras require encoding the video into h264 for clips, recording, and rtmp roles. This will use significantly more CPU than if the cameras supported h264 feeds directly.
The default config will look for a USB Coral device. If you do not have a Coral, you will need to configure a CPU detector. If you have PCI or multiple Coral devices, you need to configure your detector devices in the config file. When using multiple detectors, they run in dedicated processes, but pull from a common queue of requested detections across all cameras.
Tune your object filters to adjust false positives: min_area, max_area, min_score, threshold.
For object filters in your configuration, any single detection below min_score will be ignored as a false positive. threshold is based on the median of the history of scores (padded to 3 values) for a tracked object. Consider the following frames when min_score is set to 0.6 and threshold is set to 0.85:
Frame
Current Score
Score History
Computed Score
Detected Object
1
0.7
0.0, 0, 0.7
0.0
No
2
0.55
0.0, 0.7, 0.0
0.0
No
3
0.85
0.7, 0.0, 0.85
0.7
No
4
0.90
0.7, 0.85, 0.95, 0.90
0.875
Yes
5
0.88
0.7, 0.85, 0.95, 0.90, 0.88
0.88
Yes
6
0.95
0.7, 0.85, 0.95, 0.90, 0.88, 0.95
0.89
Yes
In frame 2, the score is below the min_score value, so frigate ignores it and it becomes a 0.0. The computed score is the median of the score history (padding to at least 3 values), and only when that computed score crosses the threshold is the object marked as a true positive. That happens in frame 4 in the example.
For HassOS installations, the default location for the config file is /config/frigate.yml.
For all other installations, the default location for the config file is '/config/config.yml'. This can be overridden with the CONFIG_FILE environment variable. Camera specific ffmpeg parameters are documented here.
It is recommended to start with a minimal configuration and add to it:
Each of your cameras must be configured. The following is the minimum required to register a camera in Frigate. Check the camera configuration page for a complete list of options.
Can be overridden at the camera level. 24/7 recordings can be enabled and are stored at /media/frigate/recordings. The folder structure for the recordings is YYYY-MM/DD/HH/<camera_name>/MM.SS.mp4. These recordings are written directly from your camera stream without re-encoding and are available in Home Assistant's media browser. Each camera supports a configurable retention policy in the config.
caution
Previous versions of frigate included -vsync drop in input parameters. This is not compatible with FFmpeg's segment feature and must be removed from your input parameters if you have overrides set.
This setting, for example, allows Frigate to consume my 10-15fps camera streams on
my relatively low powered Haswell machine with relatively low cpu usage.
The labelmap can be customized to your needs. A common reason to do this is to combine multiple object types that are easily confused when you don't need to be as granular such as car/truck. You must retain the same number of labels, but you can change the names. To change:
-
+
diff --git a/configuration/optimizing/index.html b/configuration/optimizing/index.html
index a676e8f5b..9fafa9710 100644
--- a/configuration/optimizing/index.html
+++ b/configuration/optimizing/index.html
@@ -8,7 +8,7 @@
Optimizing performance | Frigate
-
+
@@ -25,7 +25,7 @@
NOTICE: If you are using the addon, ensure you turn off Protection mode for hardware acceleration.
AMD/ATI GPUs (Radeon HD 2000 and newer GPUs) via libva-mesa-driver (https://trac.ffmpeg.org/wiki/Hardware/QuickSync)
Note: You also need to set LIBVA_DRIVER_NAME=radeonsi as an environment variable on the container.
ffmpeg:
hwaccel_args:
--hwaccel
- vaapi
--hwaccel_device
- /dev/dri/renderD128
Nvidia GPU based decoding via NVDEC is supported, but requires special configuration. See the nvidia NVDEC documentation for more details.
This repository holds the Home Assistant Addon, for use with Home Assistant OS and compatible installations. It is the piece that allows you to run Frigate from your Home Assistant Supervisor tab.
This repository holds the custom integration that allows your Home Assistant installation to automatically create entities for your Frigate instance, whether you run that with the addon or in a separate Docker instance.
The Web UI requires an instance of Frigate to interact with for all of its data. You can either run an instance locally (recommended) or attach to a separate instance accessible on your network.
To run the local instance, follow the core development instructions.
If you won't be making any changes to the Frigate HTTP API, you can attach the web development server to any Frigate instance on your network. Skip this step and go to 3a.
3a. Run the development server against a non-local instance#
To run the development server against a non-local instance, you will need to provide an environment variable, SNOWPACK_PUBLIC_API_HOST that tells the web application how to connect to the Frigate API:
cd web && SNOWPACK_PUBLIC_API_HOST=http://<ip-address-to-your-frigate-instance>:5000 npm run start
Ensure lint passes. This command will ensure basic conformance to styles, applying as many automatic fixes as possible, including Prettier formatting.
npm run lint
Add to unit tests and ensure they pass. As much as possible, you should strive to increase test coverage whenever making changes. This will help ensure features do not accidentally become broken in the future.
npm run test
Test in different browsers. Firefox, Chrome, and Safari all have different quirks that make them unique targets to interact with.
Cameras that output H.264 video and AAC audio will offer the most compatibility with all features of Frigate and Home Assistant. It is also helpful if your camera supports multiple substreams to allow different resolutions to be used for detection, streaming, clips, and recordings without re-encoding.
Many people have powerful enough NAS devices or home servers to also run docker. There is a Unraid Community App.
To install make sure you have the community app plugin here. Then search for "Frigate" in the apps section within Unraid - you can see the online store here
A complete and local NVR designed for Home Assistant with AI object detection. Uses OpenCV and Tensorflow to perform realtime object detection locally for IP cameras.
Use of a Google Coral Accelerator is optional, but highly recommended. The Coral will outperform even the best CPUs and can process 100+ FPS with very little overhead.
Frigate is a Docker container that can be run on any Docker host including as a HassOS Addon. See instructions below for installing the HassOS addon.
For Home Assistant users, there is also a custom component (aka integration). This custom component adds tighter integration with Home Assistant by automatically setting up camera entities, sensors, media browser for clips and recordings, and a public API to simplify notifications.
Note that HassOS Addons and custom components are different things. If you are already running Frigate with Docker directly, you do not need the Addon since the Addon would run another instance of Frigate.
The default shm-size of 64m is fine for setups with 3 or less 1080p cameras. If frigate is exiting with "Bus error" messages, it could be because you have too many high resolution cameras and you need to specify a higher shm size.
You can calculate the necessary shm-size for each camera with the following formula:
The shm size cannot be set per container for Home Assistant Addons. You must set default-shm-size in /etc/docker/daemon.json to increase the default shm size. This will increase the shm size for all of your docker containers. This may or may not cause issues with your setup. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
For ideal performance, Frigate needs access to underlying hardware for the Coral and GPU devices for ffmpeg decoding. Running Frigate in a VM on top of Proxmox, ESXi, Virtualbox, etc. is not recommended. The virtualization layer typically introduces a sizable amount of overhead for communication with Coral devices.
How can I get sound or audio in my clips and recordings?#
By default, Frigate removes audio from clips and recordings to reduce the likelihood of failing for invalid data. If you would like to include audio, you need to override the output args to remove -an for where you want to include audio. The recommended audio codec is aac. Not all audio codecs are supported by RTMP, so you may need to re-encode your audio with -c:a aac. The default ffmpeg args are shown here.
My mjpeg stream or snapshots look green and crazy#
This almost always means that the width/height defined for your camera are not correct. Double check the resolution with vlc or another player. Also make sure you don't have the width and height values backwards.
I have clips and snapshots in my clips folder, but I can't view them in the Web UI.#
This is usually caused one of two things:
The permissions on the parent folder don't have execute and nginx returns a 403 error you can see in the browser logs
In this case, try mounting a volume to /media/frigate inside the container instead of /media/frigate/clips.
Your cameras do not send h264 encoded video and the mp4 files are not playable in the browser
"[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5639eeb6e140] moov atom not found"#
These messages in the logs are expected in certain situations. Frigate checks the integrity of the video cache before assembling clips. Occasionally these cached files will be invalid and cleaned up automatically.
If you see repeated "On connect called" messages in your config, check for another instance of frigate. This happens when multiple frigate containers are trying to connect to mqtt with the same client_id.
An mjpeg stream for debugging. Keep in mind the mjpeg endpoint is for debugging only and will put additional load on the system when in use.
Accepts the following query string parameters:
param
Type
Description
fps
int
Frame rate
h
int
Height in pixels
bbox
int
Show bounding boxes for detected objects (0 or 1)
timestamp
int
Print the timestamp in the upper left (0 or 1)
zones
int
Draw the zones on the image (0 or 1)
mask
int
Overlay the mask on the image (0 or 1)
motion
int
Draw blue boxes for areas with detected motion (0 or 1)
regions
int
Draw green boxes for areas where object detection was run (0 or 1)
You can access a higher resolution mjpeg stream by appending h=height-in-pixels to the endpoint. For example http://localhost:5000/api/back?h=1080. You can also increase the FPS by appending fps=frame-rate to the URL such as http://localhost:5000/api/back?fps=10 or both with ?fps=10&h=1000.
Returns a thumbnail for the event id optimized for notifications. Works while the event is in progress and after completion. Passing ?format=android will convert the thumbnail to 2:1 aspect ratio.
Returns the snapshot image for the event id. Works while the event is in progress and after completion.
Accepts the following query string parameters, but they are only applied when an event is in progress. After the event is completed, the saved snapshot is returned from disk without modification:
The best way to integrate with Home Assistant is to use the official integration. When configuring the integration, you will be asked for the Host of your frigate instance. This value should be the url you use to access Frigate in the browser and will look like http://<host>:5000/. If you are using HassOS with the addon, the host should be http://ccab4aaf-frigate:5000 (or http://ccab4aaf-frigate-beta:5000 if your are using the beta version of the addon). Home Assistant needs access to port 5000 (api) and 1935 (rtmp) for all features. The integration will setup the following entities within Home Assistant:
Frigate publishes event information in the form of a change feed via MQTT. This allows lots of customization for notifications to meet your needs. Event changes are published with before and after information as shown here.
Note that some people may not want to expose frigate to the web, so you can leverage the HA API that frigate custom_integration ties into (which is exposed to the web, and thus can be used for mobile notifications etc):
To load an image taken by frigate from Home Assistants API see below:
Here is a simple example of a notification automation of events which will update the existing notification for each change. This means the image you see in the notification will update as frigate finds a "better" image.
automation:
-alias: Notify of events
trigger:
platform: mqtt
topic: frigate/events
action:
-service: notify.mobile_app_pixel_3
data_template:
message:'A {{trigger.payload_json["after"]["label"]}} was detected.'