Commit Graph

214 Commits

Author SHA1 Message Date
Nicolas Mowen
7d157dfeb0
Set max value for pre_capture (#8656) 2023-11-18 15:37:06 -06:00
Nicolas Mowen
2da99c2308
Improve periodic sync reliability and make it optional (#8647)
* Improve recordings sync reliability

* Cleanup

* Formatting

* Make logs consistent

* Make syncing optional
2023-11-18 06:06:00 -06:00
Josh Hawkins
7b520e8a9d
use enabled_in_config for switch in HA integration (#8630) 2023-11-16 01:25:48 +00:00
Nicolas Mowen
89dd114da1
Write recording segments to cache with timezone info (#8468)
* Store recording segments with timezone info

* Don't use _

* Use different separator due to timezone
2023-11-05 14:30:29 -06:00
Blake Blackshear
0dd3dd23aa
add support for docker secrets (#8409)
* add support for docker secrets

* check for directory first
2023-11-02 05:35:30 -05:00
tpjanssen
8a9b26df4e
Visit camera directly from system page (#8405)
* Visit camera directly from system page

* Processed all feedback

* Changed button caption
2023-11-01 07:08:59 -06:00
Josh Hawkins
af24eb7dbf
Autotracking tweaks (#8400)
* optimize motion and velocity estimation

* change recommended fps and fix config validate

* remove unneeded var

* process at most 3 objects per second

* fix test
2023-11-01 06:12:43 -05:00
Nicolas Mowen
ba603c1937
Make initialization configurable (#8392) 2023-10-30 20:26:31 -04:00
Shaun Berryman
36c1e00a6b
MQTT: Birdseye enabled/disabled and mode change support (#8291)
* support enabled and mode change for birdseye via mqtt

* resolve feedback from PR review
https://github.com/blakeblackshear/frigate/pull/8291#discussion_r1370083613

* change birdseye mode topic to set

* type in the docs

* these commented out lines should have never been in here
2023-10-26 06:20:55 -05:00
Josh Hawkins
9df5927ac5
Autotracking bugfixes and zooming updates (#8103)
* zoom in/out in search for lost objects

* predicted box should not be empty

* clean up and update zoom logic

* only zoom if enabled

* more cleanup

* check for valid velocity when zooming

* only try absolute zoom in if obj area has changed

* zoom logic

* don't enqueue lost object zoom if already at limit

* don't disable motion boxes during ptz moves

* velocity threshold based on move coefficients

* fix area zoom logic

* disable debug zoom

* don't process objects if ptz moving

* recalc with exponent

* change exponent

* remove lost object zooming

* increase distance threshold for stationary object

* increase distance threshold constant

* only zoom out if nonzero

* camera name in all debug logging

* add camera name to debug logging

* camera variable name consistency

* update calibration behavior and docs

* docs and better zooming

* more sensible target values

* docs wording

* fix velocity threshold variable

* zooming tweaks and remove iou for current objects

* debug and docs

* get valid velocity

* include zero

* additional debug statements

* add zoom hysteresis

* zoom on initial move if relative

* only update target box if we actually zoom

* merge dev

* use getattr instead of get

* increase distance threshold

* reverse logic

* get_camera_status after preset move to store zoom

* final tweaks and docs

* use constants and catch possible debug exception

* adjust zoom factor exponent

* don't run motion estimation when calling preset

* adjust dimension threshold

* use numpy for velocity estimate calcs

* more numpy conversion

* fix numpy shapes

* numpy zeros dimension

* more zoom out conditions

* fix velocity bug

* ensure init has been called in debug view

* ensure onvif init if enabling by mqtt

* change default hysteresis values

* recalc relative zoom value

* zoom out value

* try to zoom when object isn't moving

* try zoom when tracked object is not moving

* don't try to zoom every time

* negate zoom out condition when needed

* hysteresis constants for absolute zooming

* update zoom conditions

* don't recalc target box on zoom only

* zoom out if above area threshold

* don't print zooming debug for stationary obj

* revamp zooming to use area moving average

* zooming tweaks and expose property

* limit zoom with max target box

* use calibration to determine zoom levels

* zoom logic fix

* docs

* add tapo c200 camera

* fix initial absolute zoom

* small zoom logic fix

* better invalid velocity checks

* fix test

* really fix test this time
2023-10-22 12:59:13 -04:00
Nicolas Mowen
9a4f970337
Set default min score for attributes labels to 0.7 (#8001)
* Set min score for attributes to 0.7

* Allow other fields to be set
2023-09-30 07:38:15 -05:00
Josh Hawkins
ead03c381b
Autotracking improvements and bugfixes (#7984)
* add zoom factor and catch motion exception

* reword error message

* check euclidean distance of estimate points

* use numpy for euclidean distance

* config entry

* use zoom factor and zoom based on velocity

* move debug inside try

* change log type to info

* logger level warning

* docs

* exception handling
2023-09-28 18:21:37 -05:00
Josh Hawkins
27144eb0b9
Autotracker: Basic zooming and moves with velocity estimation (#7713)
* don't zoom if camera doesn't support it

* basic zooming

* make zooming configurable

* zooming docs

* optional zooming in camera status

* Use absolute instead of relative zooming

* increase edge threshold

* zoom considering object area

* bugfixes

* catch onvif zooming errors

* relative zooming option for dahua/amcrest cams

* docs

* docs

* don't make small movements

* remove old logger statement

* fix small movements

* use enum in config for zooming

* fix formatting

* empty move queue first

* clear tracked object before waiting for stop

* use velocity estimation for movements

* docs updates

* add tests

* typos

* recalc every 50 moves

* adjust zoom based on estimate box if calibrated

* tweaks for fast objects and large movements

* use real time for calibration and add info logging

* docs updates

* remove area scale

* Add example video to docs

* zooming font header size the same as the others

* log an error if a ptz doesn't report a MoveStatus

* debug logging for onvif service capabilities

* ensure camera supports ONVIF MoveStatus
2023-09-27 06:19:10 -05:00
Nicolas Mowen
7d0216b8fb
Improve default timelapse args and make timelapse customizable (#7840)
* Add args to ignore audio and only process keyframes

* Add timelapse args to config

* Update docs

* Formatting

* Fix spacing

* Fix formatting

* add example of math for pts
2023-09-21 06:20:05 -06:00
Nicolas Mowen
fd9196ae3e
add note about network bandwidth permissions and don't set interfaces by default (#7813)
* add note about network bandwidth permissions

* Update default net int

* Set default network interfaces to empty

* Don't read interfaces if none are set

* Formatting

* Add stderr output
2023-09-21 05:26:22 -05:00
Nicolas Mowen
5d30944d6e
Add fire alarm to default audio labels (#7854)
* Add fire alarm to default audio list

* Update docs for default audio label list

* Update audio detectors with default label list
2023-09-21 05:23:26 -05:00
Nicolas Mowen
9a1c8b2cc4
Remove maximum inertia constraint (#7890) 2023-09-21 05:20:26 -05:00
Sergey Krashevich
731743c7e5
Refactor AudioTfl class to accept the number of detection threads as a parameter in the constructor, and update the usage of the num_threads attribute accordingly (#7588) 2023-09-01 07:00:11 -05:00
Nicolas Mowen
761daf46ea
Refactor Recordings (#7275)
* Run ffmpeg sub process & video_properties as async

* Run recording cleanup in the main process

* More cleanup

* Use inter process communication to write recordings into the DB

* Formatting
2023-07-26 05:55:08 -05:00
Andrew Reiter
a96a951e23
Nvidia Jetson ffmpeg + TensorRT support (#6458)
* Non-Jetson changes

Required for later commits:
- Allow base image to be overridden (and don't assume its WORKDIR)
- Ensure python3.9
- Map hwaccel decode presets as strings instead of lists
Not required:
- Fix existing documentation
- Simplify hwaccel scale logic

* Prepare for multi-arch tensorrt build

* Add tensorrt images for Jetson boards

* Add Jetson ffmpeg hwaccel

* Update docs

* Add CODEOWNERS

* CI

* Change default model from yolov7-tiny-416 to yolov7-320

In my experience the tiny models perform markedly worse without being
much faster

* fixup! Update docs
2023-07-26 05:50:41 -05:00
Nicolas Mowen
c5b8d13beb
Save audio scores and add audio filter config (#7185)
* Send and save score for external events

* Add audio filters config

* Fix access

* Add docs

* Cleanup
2023-07-17 06:07:15 -05:00
Nicolas Mowen
8e584cf844
Add option for enabling sync recordings (#7169) 2023-07-15 08:38:21 -05:00
Nicolas Mowen
598ae98bfe
Fix incorrect import in Config (#7157) 2023-07-14 06:32:17 -06:00
Sergey Krashevich
ce3a544ecd
Feature: automatic camera resolution configuration (#6810)
* Add auto configuration for height, width and fps in detect role

* Add auto-configuration for detect width, height, and fps for input roles with detect in the CameraConfig class in config.py

* Refactor code to retrieve video properties from input stream in CameraConfig class and add optional parameter to retrieve video duration in get_video_properties function

* format

* Set default detect dimensions to 1280x720 and update DetectConfig to use the defaults

* Revert "Set default detect dimensions to 1280x720 and update DetectConfig to use the defaults"

This reverts commit a1aed0414d.

* Add default detect dimensions if autoconfiguration failed and log a warning message

* fix warn message spelling on frigate/config.py

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>

* Ensure detect height and width are not None before using them in camera configuration

* docs: initial commit

* rename streamInfo to stream_info

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>

* Apply suggestions from code review

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>

* Update docs

* handle case then get_video_properties returns 0x0 dimension

* Set detect resolution based on stream properties if available, else apply default values

* Update FrigateConfig to set default values for stream_info if resolution detection fails

* Update camera detection dimensions based on stream information if available

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-07-14 06:56:03 -05:00
Nicolas Mowen
f37f034b6a
Only run audio detection when audio is above noise threshold (#7078)
* Only run audio detection when audio is above noise threshold

* Formatting

* Fix event parsing

* Update frigate/events/audio.py

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-07-08 07:16:24 -05:00
Josh Hawkins
88fc0fac8f
Basic PTZ object autotracking functionality (#6913)
* Basic functionality

* Threaded motion estimator

* Revert "Threaded motion estimator"

This reverts commit 3171801607.

* Don't detect motion when ptz is moving

* fix motion logic

* fix mypy error

* Add threaded queue for movement for slower ptzs

* Move queues per camera

* Move autotracker start to app.py

* iou value for tracked object

* mqtt callback

* tracked object should be initially motionless

* only draw thicker box if autotracking is enabled

* Init if enabled when initially disabled in config

* Fix init

* Thread names

* Always use motion estimator

* docs

* clarify fov support

* remove size ratio

* use mp event instead of value for ptz status

* update autotrack at half fps

* fix merge conflict

* fix event type for mypy

* clean up

* Clean up

* remove unused code

* merge conflict fix

* docs: update link to object_detectors page

* Update docs/docs/configuration/autotracking.md

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>

* clarify wording

* pass actual instances directly

* default return preset

* fix type

* Error message when onvif init fails

* disable autotracking if onvif init fails

* disable autotracking if onvif init fails

* ptz module

* verify required_zones in config

* update util after dev merge

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-07-08 07:04:47 -05:00
Nicolas Mowen
baf671b764
Cleanup and organize utils (#7033)
* Force birdseye cameras into standard aspect ratios

* Organize utils

* Update tests

* Formatting

* Isort

* Fix tests

* Cleanup

* isort
2023-07-06 09:28:50 -05:00
Nicolas Mowen
c3b313a70d
Audio events (#6848)
* Initial audio classification model implementation

* fix mypy

* Keep audio labelmap local

* Cleanup

* Start adding config for audio

* Add the detector

* Add audio detection process keypoints

* Build out base config

* Load labelmap correctly

* Fix config bugs

* Start audio process

* Fix startup issues

* Try to cleanup restarting

* Add ffmpeg input args

* Get audio detection working

* Save event to db

* End events if not heard for 30 seconds

* Use not heard config

* Stop ffmpeg when shutting down

* Fixes

* End events correctly

* Use api instead of event queue to save audio events

* Get events working

* Close threads when stop event is sent

* remove unused

* Only start audio process if at least one camera is enabled

* Add const for float

* Cleanup labelmap

* Add audio icon in frontend

* Add ability to toggle audio with mqtt

* Set initial audio value

* Fix audio enabling

* Close logpipe

* Isort

* Formatting

* Fix web tests

* Fix web tests

* Handle cases where args are a string

* Remove log

* Cleanup process close

* Use correct field

* Simplify if statement

* Use var for localhost

* Add audio detectors docs

* Add restream docs to mention audio detection

* Add full config docs

* Fix links to other docs

---------

Co-authored-by: Jason Hunter <hunterjm@gmail.com>
2023-07-01 08:18:33 -05:00
Blake Blackshear
d51197eaa2
use a different method for blur and contrast to reduce CPU (#6940)
* use a different method for blur and contrast to reduce CPU

* blur with radius instead

* use faster interpolation for motion

* improve contrast based on averages

* increase default threshold to 30

* ensure mask is applied after contrast improvement

* update opencv

* update benchmark script
2023-06-30 07:27:31 -05:00
spacebares
ed0d2be321
configurable ffmpeg timeout (#6897)
* configurable ffmpeg timeout

* configurable ffmpeg healthcheck interval

rename timeout to healthcheck_interval
only grab config value once

* configurable ffmpeg retry interval

rename healthcheck_interval to retry_interval

* add retry_interval to docs

- update retry_interval text in config.py
2023-06-30 07:14:39 -05:00
Blake Blackshear
9e531b0b5b
reduce grid size for contrast improvement (#6870) 2023-06-21 08:38:51 -05:00
Blake Blackshear
7c1568fcb9
use clahe for contrast improvement (#6835)
* use clahe for contrast improvement

* update tests
2023-06-18 11:56:41 -05:00
Blake Blackshear
ca7853c087
Fix max_frames, improve stationary objects in masked areas (#6815)
* fix issue with max_frames

* dont consider stationary until the threshold

* require a stationary interval

* try to fix formatter issues
2023-06-16 07:32:43 -05:00
Blake Blackshear
d81dd60fef
Improve motion detection and region selection (#6741)
* refactor existing motion detector

* implement and use cnt bgsub

* pass fps to motion detector

* create a simplified motion detector

* lightning detection

* update default motion config

* lint imports

* use estimated boxes for regions

* use improved motion detector

* update test

* use a different strategy for clustering motion and object boxes

* increase alpha during calibration

* simplify object consolidation

* add some reasonable constraints to the estimated box

* adjust cluster boundary to 10%

* refactor

* add disabled debug code

* fix variable scope
2023-06-11 08:45:11 -05:00
Nicolas Mowen
32569842d3
Option to enable / disable stats that require external processes (#6615)
* Add option for network bandwidth and only calculate if enabled

* Don't show network bandwidth in system stats page if not enabled

* Formatting

* Hide other rows as well

* Add docs

* Add config options for AMD and Intel GPU stats

* Fix stats access

* Update docs

* Use correct bool syntax

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-06-11 08:26:34 -05:00
Nicolas Mowen
b160abac0d
Ability to configure min frames for zone presence (#6680)
* Objects need to be in zones multiple times to be considered present in the zone

* Add a field to configure inertia per zone

* Formatting

* Use correct default method

* Clarify zone presence behavior

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-06-11 08:00:53 -05:00
Sergey Krashevich
8d941e5e26
Add function to get physical interfaces for bandwidth calculation (#6618)
* Add function to get physical interfaces for bandwidth calculation in get_bandwidth_stats() function

* Add telemetry configuration option for enabled network interfaces, with default values for monitoring bandwidth stats for camera ffmpeg processes, go2rtc, and object detectors. Also add support for FrigateConfig in set_bandwidth_stats function to get bandwidth stats for specified network interfaces
2023-06-11 07:34:03 -05:00
Martin Weinelt
ab50d0b006
Add isort and ruff linter (#6575)
* Add isort and ruff linter

Both linters are pretty common among modern python code bases.

The isort tool provides stable sorting and grouping, as well as pruning
of unused imports.

Ruff is a modern linter, that is very fast due to being written in rust.
It can detect many common issues in a python codebase.

Removes the pylint dev requirement, since ruff replaces it.

* treewide: fix issues detected by ruff

* treewide: fix bare except clauses

* .devcontainer: Set up isort

* treewide: optimize imports

* treewide: apply black

* treewide: make regex patterns raw strings

This is necessary for escape sequences to be properly recognized.
2023-05-29 05:31:17 -05:00
Blake Blackshear
42f3ee3de5 sync master 2023-05-19 05:47:49 -05:00
Nicolas Mowen
5951a740d2
Prevent recordings from being turned on if disabled in config (#6444)
* Prevent enabling recordings if not enabled in config

* Fix conflict

* Fix spacing

* Update wording

* Update wording

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-05-15 07:36:26 -05:00
Blake Blackshear
9bf98f908d
add plus integration for models (#6328) 2023-04-30 13:32:36 -05:00
Nicolas Mowen
b48f6d750f
Add annotation support (#6288) 2023-04-28 06:02:06 -05:00
Alin Balutoiu
83006eeb65
Add option to have cameras sorted inside the Birdseye stream (#5450)
* Add option to sort cameras inside Birdseye

* Make default order to be sorted alphabetically

* Add docs for sorting cameras

* Update index.md for cameras

* Remove irelevant comments
2023-04-26 19:29:01 -05:00
Nicolas Mowen
43ade86796
Support Controlling PTZ Cameras Via WebUI (#4715)
* Add support for ptz commands via websocket

* Fix startup issues

* Fix bugs

* Set config manually

* Add more commands

* Add presets

* Add zooming

* Fixes

* Set name

* Cleanup

* Add ability to set presets from UI

* Add ability to set preset from UI

* Cleanup for errors

* Ui tweaks

* Add visual design for pan / tilt

* Add pan/tilt support

* Support zooming

* Try to set wsdl

* Fix duplicate logs

* Catch auth errors

* Don't init onvif for disabled cameras

* Fix layout sizing

* Don't comment out

* Fix formatting

* Add ability to control camera with keyboard shortcuts

* Disallow user selection

* Fix mobile pressing

* Remove logs

* Substitute onvif password

* Add ptz controls ot birdseye

* Put wsdl back

* Add padding

* Formatting

* Catch onvif error

* Optimize layout for mobile and web

* Place ptz controls next to birdseye view in large layout

* Fix pt support

* Center text titles

* Update tests

* Update docs

* Write camera docs for PTZ

* Add MQTT docs for PTZ

* Add ptz info docs for http

* Fix test

* Make half width when full screen

* Fix preset panel logic

* Fix parsing

* Update mqtt.md

* Catch preset error

* Add onvif example to docs

* Remove template example from main camera docs
2023-04-26 06:08:53 -05:00
Blake Blackshear
0d16bd0144
False positives (#6217)
* add false positive submission

* switch timeline events to x,y,w,h

* update docs

* fix type checks

* convert to upsert

* fix config test
2023-04-24 07:24:28 -05:00
Felipe Santos
cdd8e6fd4e
Migrate default database path from /media/frigate to /config (#5219)
* Migrate db path to /config

* Ensure oneshot runs

* Put logic inside of Frigate's run

* Use new db default path in code

* Fix missing config dir

* Upgrade yq to 4.33.3
2023-04-23 11:35:40 -05:00
Nicolas Mowen
6986949d84
Remove deprecated retain_days config (#5952) 2023-04-09 11:23:34 -05:00
Blake Blackshear
2d9556f5f3
set threads to 2 (#5747) 2023-03-17 17:14:57 -05:00
Blake Blackshear
750bf0e79a
Revert "Update ffmpeg args with low risk improvements (#5519)" (#5715)
This reverts commit 52459bf348.
2023-03-14 08:25:27 -05:00
Nicolas Mowen
318240c14c
Add docs for time / date styling (#5572)
* Add docs for time / date styling

* Convert 12hour time format option to enum

* Change option in web

* Add docs with examples

* Fix errors in docs

* Fix mismatched names
2023-02-26 09:37:18 -06:00