Frigate NVR Version 0.12. Now with go2rtc.
I have been using Frigate for a year or more (I forget how long) and it has been fantastic. I integrate it with Home Assistant so I can get all the smartness of both platforms. The latest version of Frigate NVR is out with new features, including the switch to go2rtc 1.2.0. I will take you through the major updates, starting with a docker install of Frigate.
The Install
I will assume you are familiar with Docker and have already installed a version of Docker that uses docker-compose as that is the method we will use to define our environment. This is my docker-compose.yaml file.
version: "3.9"
services:
frigate:
container_name: frigate
privileged: true # this may not be necessary for all setups
restart: unless-stopped
image: ghcr.io/blakeblackshear/frigate:stable
shm_size: "64mb" # update for your cameras based on calculation above
devices:
- /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
- /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
- /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
- /home/mostlychris/frigate/config.yml:/config/config.yml:ro
- /media/frigateUSBSSD:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "5000:5000"
- "1935:1935" # RTMP feeds
- "8554:8554" # Birdseye In v 0.12
environment:
FRIGATE_RTSP_PASSWORD: {mypassword}
Let me point out the "image" line above. You will need to make sure that points to the image that you want to install. If you want the latest, just use ':stable' at the end of the image line. If you want to specify version 0.12, use the image here:ghcr.io/blakeblackshear/frigate:0.12.0
One issue that give me much grief was setting up volumes so make sure your volumes are mapped correctly in the docker-compose file.
In addition to your docker-compose.yaml file, you will also need a config.yml file in the same directory. You can see my complete config file at the end of this article.
Once your docker-compose.yaml is set up for your environment and you have a config.yml file, issue the command
docker-compose -up
If all goes well, the latest stable version (or version you specify) of Frigate will be pulled and a Frigate Docker container created and started. If there are any issues, you will see those in the output. The most common issue is a config file misconfiguration.
Notable Breaking Changes
- As noted above, when choosing the version of Frigate you will need to use github container registry instead of Dockerhub -- ghcr.io/blakeblackshear/frigate:stable
- If you are using the Home Assistant integration, you need to be running version 4.0.0 of that integration
- Due to changes in the database, make sure you make a backup copy of the database in case you need to roll back.
- Changes to how the recording segments are stored could cause problems accessing the files directly if configured for past versions.
- More breaking changes can be found on the Frigate github page.
New Features
- Frigate now deletes the oldest recording segments to make room for new recordings if the storage gets below 1 hour left.
- go2rtc 1.2.0 is now part of the Frigate bundle. There are some config file options that need to be set to use this. RTMP is now deprecated in favor of go2rtc. Additionally, go2rtc enables MSE and WebRTC live view options. This gives full-framerate, low-latency live views with supported audio.
- Birdseye restreaming is supported at rtsp://frigate_ip:8554/birdseye. This requires port 8554 to be mapped. Running Birdseye in restream mode does increase CPU usage. So far, I haven't found it useful since I have automations that bring up cameras when detection happens.
New Pages
The debug page is now the System page with links to vainfo and ffprobe data.
The storage page shows an overview of memory and storage, as well as per-camera bandwidth details.
The logs are now in the UI. Logs for Frigate, go2rtc, and Nginx are provided.
The config editor is now available in the UI. This allows editing of the config file without having to log into the server directly. NOTE: The file permissions will need to be set to allow writing to the file. My docker-compose file has that set as ":ro" so I will need to update that so it can be written to.
MQTT is Optional
You no longer need to enable MQTT for Frigate to function unless you are using the Home Assistant integration. I still use MQTT to trigger alerts and interact with my smart home setup so I think it is still valuable. For those that don't use it, Frigate won't die if you don't have MQTT configured correctly
Support for New Detectors
Frigate now supports OpenVINO on Intel CPU, GPU, and VPU hardware. It also now supports TensorRT using NVidia GPUs. You must use the -tensorrt tag suffix to pull an image that has the needed libraries for this.ghcr.io/blakeblackshear/frigate:0.12.0-tensorrt
If you can't find a Google Coral TPU (and many can't) this gives additional options for image processing and detection.
These are just the highlights of version 0.12. A LOT of work has gone into making Frigate what it is today. Thanks to Blake and all the contributors who have helped along the way. There is much more detail and a few other things I didn't cover on the Frigate github page.
Be sure to watch my video on this article for more hands-on and whatever else I might decide to ramble on about.
My full Frigate config file
ui:
use_experimental: false
live_mode: mse
mqtt:
host: 172.16.1.121
port: 1883
topic_prefix: frigate
client_id: frigate
user: {mqtt user}
password: {mqtt password}
stats_interval: 300
record:
expire_interval: 10
go2rtc:
streams:
driveway:
- rtsp://user:pass@172.16.1.26:554/cam/realmonitor?channel=1&subtype=0
driveway_sub:
- rtsp://user:pass@172.16.1.26:554/cam/realmonitor?channel=1&subtype=1
front_porch:
- rtsp://user:pass@172.16.1.27:554/cam/realmonitor?channel=1&subtype=0
front_porch_sub:
- rtsp://user:pass@172.16.1.27:554/cam/realmonitor?channel=1&subtype=1
garage:
- rtsp://user:pass@172.16.1.33:554/cam/realmonitor?channel=1&subtype=0
garage_sub:
- rtsp://user:pass@172.16.1.33:554/cam/realmonitor?channel=1&subtype=1
back_porch:
- rtsp://user:pass@172.16.1.29:554/Streaming/Channels/101
back_porch_sub:
- rtsp://user:pass@172.16.1.29:554/Streaming/Channels/102
deck:
- rtsp://user:pass@172.16.1.28:554/Streaming/Channels/101
deck_sub:
- rtsp://user:pass@172.16.1.28:554/Streaming/Channels/102
timestamp_style:
# Optional: Position of the timestamp (default: shown below)
# "tl" (top left), "tr" (top right), "bl" (bottom left), "br" (bottom right)
position: "tl"
# Optional: Format specifier conform to the Python package "datetime" (default: shown below)
# Additional Examples:
# german: "%d.%m.%Y %H:%M:%S"
format: "%m/%d/%Y %H:%M:%S"
# Optional: Color of font
color:
# All Required when color is specified (default: shown below)
red: 255
green: 255
blue: 255
# Optional: Line thickness of font (default: shown below)
thickness: 2
# Optional: Effect of lettering (default: shown below)
# None (No effect),
# "solid" (solid background in inverse color of font)
# "shadow" (shadow for font)
effect: shadow
cameras:
driveway:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/driveway_sub
input_args: preset-rtsp-restream
roles:
- detect
- path: rtsp://127.0.0.1:8554/driveway
input_args: preset-rtsp-restream
roles:
- record
detect:
width: 640
height: 480
fps: 5
objects:
track:
- person
- dog
- bicycle
- cat
filters:
person:
min_score: 0.4
threshold: 0.5
min_area: 700
snapshots:
enabled: true
timestamp: true
bounding_box: true
required_zones:
- drivewayclose_in
- driveway_whole_area
crop: True
height: 500
retain:
default: 3
zones:
drivewayclose_in:
coordinates: 0,480,429,480,443,335,460,173,263,133,88,120,36,212,0,279
objects:
- person
- dog
- cat
- bicycle
driveway_whole_area:
coordinates: 404,0,640,54,640,480,640,480,640,358,640,480,261,480,0,480,0,225,138,39
objects:
- person
- cat
- dog
- bicycle
motion:
mask:
- 2,465,328,468,330,432,5,431
- 72,43,154,0,0,0,0,129
threshold: 20
contour_area: 15
record:
enabled: True
retain:
days: 2
#mode: active_objects
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 10
front_porch:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/front_porch_sub
input_args: preset-rtsp-restream
roles:
- detect
- path: rtsp://127.0.0.1:8554/front_porch
input_args: preset-rtsp-restream
roles:
- record
output_args:
record: preset-record-generic-audio-aac
detect:
width: 640
height: 480
fps: 5
objects:
track:
- person
- dog
- bicycle
- cat
mask:
- 0,480,198,480,200,449,0,451
- 640,0,640,36,640,111,608,135,485,96,504,0
- 439,200,441,324,512,320,532,261,554,188,540,129,451,134
- 370,0,356,100,291,79,292,0
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: True
height: 500
required_zones:
- front_porch_close_in
retain:
default: 5
motion:
mask:
- 0,480,191,480,193,450,0,449
- 445,264,530,264,529,141,481,132
zones:
front_porch_close_in:
coordinates: 45,480,362,480,640,480,640,213,554,145,501,149,460,136,408,141,348,70,253,64,149,28,42,44
record:
enabled: True
retain:
days: 2
events:
retain:
default: 4
mode: active_objects
required_zones:
- front_porch_close_in
pre_capture: 3
post_capture: 10
back_porch:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/back_porch_sub
input_args: preset-rtsp-restream
roles:
- detect
- path: rtsp://127.0.0.1:8554/back_porch
input_args: preset-rtsp-restream
roles:
- record
detect:
width: 640
height: 480
fps: 6
objects:
track:
- person
- dog
- cat
- bird
- mouse
filters:
cat:
min_score: 0.3
threshold: 0.5
dog:
min_score: 0.3
threshold: 0.5
mask:
- 23,480,333,480,333,442,26,440
- 640,95,640,0,464,0
- 258,211,323,246,357,142,274,140
- 383,342,457,365,477,261,401,232
- 425,131,553,227,640,251,640,213,607,176,460,88
snapshots:
enabled: true
timestamp: false
bounding_box: true
retain:
default: 3
motion:
mask:
- 337,480,341,437,0,433,0,480,40,480
zones:
deck_area:
coordinates: 0,284,0,457,207,480,474,480,640,480,540,406,392,259,253,106,166,31,108,49,0,72
record:
enabled: True
retain:
days: 0
events:
retain:
default: 3
mode: motion
pre_capture: 5
post_capture: 15
deck:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/deck_sub
input_args: preset-rtsp-restream
roles:
- detect
- path: rtsp://127.0.0.1:8554/deck
input_args: preset-rtsp-restream
roles:
- record
detect:
width: 640
height: 480
fps: 6
objects:
track:
- person
- dog
- bird
- mouse
filters:
cat:
min_score: 0.3
threshold: 0.5
dog:
min_score: 0.3
threshold: 0.5
person:
mask:
- 79,385,107,480,287,480,259,313,107,268
- 294,82,396,93,411,57,295,44
enabled: true
timestamp: false
bounding_box: true
retain:
default: 4
motion:
mask:
- 374,480,640,480,640,442,372,442
record:
enabled: True
retain:
days: 0
events:
retain:
default: 3
mode: motion
pre_capture: 5
post_capture: 15
garage:
ffmpeg:
inputs:
- path: rtsp://user:pass@172.16.1.33:554/cam/realmonitor?channel=1&subtype=1
roles:
- detect
- path: rtsp://user:pass@172.16.1.33:554/cam/realmonitor?channel=1&subtype=0
roles:
- record
output_args:
record: preset-record-generic-audio-aac
detect:
width: 640
height: 480
fps: 5
objects:
track:
- person
- dog
- cat
snapshots:
enabled: true
timestamp: false
bounding_box: true
retain:
default: 3
record:
enabled: True
retain:
days: 0
events:
retain:
default: 3
mode: active_objects
pre_capture: 5
post_capture: 15
motion:
mask:
- 352,93,477,95,554,99,640,94,640,0,343,0
- 457,480,640,480,640,445,453,444
detectors:
coral:
type: edgetpu
device: usb
rtmp:
enabled: false
birdseye:
enabled: True
restream: False
width: 1280
height: 720
quality: 1
mode: objects
live:
height: 640
quality: 1