Commit Graph

1878 Commits

Author SHA1 Message Date
Andrew Reiter
325205740b
Check ffmpeg version instead of checking for presence of BTBN_PATH (#7023)
* Check ffmpeg version instead of checking for presence of BTBN_PATH

* Query ffmpeg version in s6 run script instead of subprocessing in every import

* Define LIBAVFORMAT_VERSION_MAJOR in devcontainer too

* Formatting

* Default ffmpeg version to current btbn version so unit tests pass
2023-07-06 07:35:26 -05:00
Andrew Reiter
f30ba25444
Reduce framerate before downscaling (#7022)
* Reduce framerate before downscaling

It is cheaper to drop frames and downscale those that remain than it is
to downscale all frames and then drop some of them. This is achieved
with the filter chain `-cv fps=FPS,scale=W:H`, and perhaps was the
original intention. The plain `-r` and `-s` flags do not execute in
order though - they each put themselves at the *end* of the filterchain,
so `-r FPS -s WxH` actually applies the scale filter first, and then the
rate filter.

This fix can halve the CPU used by the detect ffmpeg process.

* Bring back hard rate limits
2023-07-06 07:31:17 -05:00
Nicolas Mowen
339b6944f1
Force birdseye cameras into standard aspect ratios (#7026)
* Force birdseye cameras into standard aspect ratios

* Clarify comment

* Formatting

* Actually use the calculated aspect ratio when building the layout

* Fix Y aspect

* Force canvas into known aspect ratio as well

* Save canvas size and don't recalculate

* Cache coefficients that are used for different size layouts

* Further optimize calculations to not be done multiple times
2023-07-06 07:30:05 -05:00
Nicolas Mowen
0f68fbc8db
Use pre capture for custom events (#7038)
* Use pre capture for custom events

* Formatting
2023-07-06 07:26:53 -05:00
Nicolas Mowen
998bffe706
Fix min region size not being divisible by 4 (#7040)
* Fix min region size not being divisible by 4

* Simplify half calculation
2023-07-06 07:25:37 -05:00
Sergey Krashevich
12d4a47e3d
End audio event and update detections if successful, otherwise log a warning if ending audio event fails with a specific status code (#6984) 2023-07-03 09:50:25 -05:00
Sergey Krashevich
1171f01683
Refactor camera rendering logic in System component to only render enabled cameras (#6992) 2023-07-03 09:49:14 -05:00
Sergey Krashevich
f905704479
UI: add audio process stats to System page (#6993)
* Add audio process PID to the list of processes and log the start of the audio process

* Update audio process PID key in processes dictionary to "audioDetector" instead of "audio".
2023-07-03 09:48:29 -05:00
Nicolas Mowen
58c6ef1e12
Add designator when events are from the api (#6997)
* Add designator when events are custom

* Add type field and set via API
2023-07-03 09:48:00 -05:00
Nicolas Mowen
83edf9574e
Scale birdseye layout up to max size after it has been calculated (#6825)
* Scale layout up to max size after it has been calculated

* Limit portrait cameras to taking up 2 rows

* Fix bug

* Fix birdsye not removing cameras once objects are no longer visible

* Fix lint
2023-07-02 07:45:45 -05:00
Nicolas Mowen
c25367221e
Fix audio events not being ended (#6981)
* Fix audio events not being ended

* Fix audio events not being ended correctly

* Clean up debug code
2023-07-01 16:33:47 -05:00
Nicolas Mowen
7ee17c7af8
Fix small audio events details (#6978)
* Fix missed audio details

* Add mqtt docs

* Delete instead of setting to None
2023-07-01 11:19:14 -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
Bernt Christian Egeland
f1dc3a639c
fixed TimeAgo abbreviation (#6977)
* fixed TimeAgo abbreviation

* Update web/src/components/TimeAgo.tsx

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

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-07-01 08:16:19 -05:00
Blake Blackshear
2f401bd8da
update deps (#6973)
* update web deps

* update python deps
2023-07-01 07:47:16 -05:00
Nicolas Mowen
f3f9b36e07
Fix bad check on np.array (#6968) 2023-06-30 07:06:38 -06:00
Nicolas Mowen
0a8249d6fb
Fix Bad Resize For Camera Snapshot (#6797)
* Catch cases where incorrect size is requested

* Set a default if calculated height is incorrect
2023-06-30 07:34:10 -05:00
Sergey Krashevich
b6fce8f0bb
Integrate ccache into libusb and nginx build scripts for improved build speed (#6886)
* Add ccache to libusb and nginx build scripts

* Add ccache support to Dockerfile for faster builds

* Add ccache to PATH and use it for compiling nginx with Makefile in build_nginx.sh script
2023-06-30 07:28:48 -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
Nicolas Mowen
d2a2643cd6
Apply zone filter before inertia (#6854)
* Apply zone filter before intertia

* Formatting
2023-06-30 07:15:55 -05:00
Nicolas Mowen
bd17e7d824
Show object attributes when hovering or tapping timeline bounding box (#6879)
* Show overlay when hovering on timeline box

* Make it work with mobile too

* Fix lint

* Fix ratio

* Update web/src/components/TimelineEventOverlay.jsx

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

* Show overlay when hovering on timeline box

* Make it work with mobile too

* Fix lint

* Fix ratio

* Remove label and make overlay respect selected theme

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-06-30 07:15:19 -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
Nicolas Mowen
9137f1594b
Remove legacy recordings file cleanup (#6947)
* Remove legacy recordings file cleanup

* Remove unused
2023-06-30 07:13:00 -05:00
Cody Cutrer
ef14a43930
optimize frame-per-second calculations (#6887)
* optimize frame-per-second calculations

FPS is never calculated over differing periods for even given
counter. By only storing timestamps within the period that is
used, we avoid having to iterate 1000 entries every time it's
re-calculated (multiple times per second). 1000 entries would
normally only be needed if something is running at 100fps. A
more common speed - anywhere from 5 to 30fps, only needs 50
to 300 entries.

This isn't a huge improvement in the grand scheme, but when motion
detection is disabled, it takes nearly as much time in a flamegraph
as actually transferring the video frame.

* fix python checks
2023-06-28 05:55:53 -05:00
Cody Cutrer
ee4a133655
actually keep track of skipped frames (#6889)
* actually keep track of skipped frames

fixes #6863

* fix black errors
2023-06-28 05:53:28 -05:00
Nicolas Mowen
ece070fee1
Load labels dynamically for event filters (#6896)
* Load labels dynamically to include custom events and audio, do not include attribute labels

* Formatting

* Fix sorting

* Also filter tracked object list on camera page

* isort

* Don't fail before load
2023-06-28 05:51:53 -05:00
spacebares
3d40ed5d47
fix tooltip not showing if too far left (#6909) 2023-06-28 05:45:54 -05:00
Sergey Krashevich
e640981cc4
Performance: multiprocessing improvement (#6936)
* Add faster-fifo dependency for improved performance

* isort
2023-06-28 05:39: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
Nicolas Mowen
09cc4251f0
Fix dict getting overwritten (#6830) 2023-06-17 10:31:35 -05:00
Blake Blackshear
793fe251b9
Label attributes (#6829)
* pass attribute labels as attributes

* add label attrs to events and snapshots

* incorporate area of license_plate and face into snapshot selection

* populate sublabels for cars with logos
2023-06-17 09:56:22 -05:00
Nicolas Mowen
2be2050d57
Don't fail to save segment when cv2 fails (#6823)
* Don't fail when cv2 fails

* Clean up exception handling
2023-06-17 09:56:00 -05:00
Nicolas Mowen
0996883a98
Add docs for annotation offset (#6824) 2023-06-16 18:00:49 -06:00
Nicolas Mowen
b66810247e
Optimize stacked recordings (#6809)
* Make camera recordings mover asynchronous

* Formatting

* Move to using cv2 instead of external ffmpeg process

* Use ffprobe if cv2 failed

* Formatting

* Fix bad access

* Formatting

* Update frigate/record/maintainer.py

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

* Update name of caller

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-06-16 07:09:13 -06:00
Nicolas Mowen
0592cedcde
Rewrite birdseye auto layout (#6818)
* Prefer horizontal layout to vertical

* Rewrite birdseye to use aspect ratios instead of resolutions as layout configurator

* Improve layout with slightly larger than 16:9 cameras

* Remove manual 2 camera layout

* Lint

* Remove log
2023-06-16 07:35:36 -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
Sergey Krashevich
3efa77f302
Round the timestamp value read from .vacuum file to prevent potential errors caused by float values (#6800) 2023-06-14 17:19:26 -05:00
Nicolas Mowen
ff1b5c87aa
Fix stream name not being used for MSE (#6796) 2023-06-14 06:49:32 -06:00
Sergey Krashevich
a8f282515f
Bugfix: Refactor date and time initialization in Export.jsx (#6794)
* Refactor date and time initialization in Export.jsx to use local timezone

* Update error message to include specific reason for failure in Export.jsx
2023-06-14 07:32:36 -05:00
Nicolas Mowen
7e5abe7a65
Optimize Birdseye layout for portrait cameras (#6779)
* Handle vertical cameras more optimally in 2 camera layout

* Optimize portrait layout for 3+ cams

* Remove logging
2023-06-12 17:39:12 -05:00
Nicolas Mowen
ec4d79eafc
Fix bug in intersection logic (#6780)
* Fix bug in intersection logic

* Fix isort

* Remove unrelated test

* Formatting

* Fix type in test
2023-06-12 17:38:22 -05:00
Nicolas Mowen
ff90db30e6
Various Bug Fixes (#6768)
* Fix birdseye infinite loop

* Fix division by zero
2023-06-12 06:06:02 -04:00
Sergey Krashevich
dfd574beeb
Refactor storage stats calculation to use powers of 2 for more accurate values (#6765)
* "Refactor storage stats calculation to use powers of 2 for more accurate values"

* replace 1000000 to 2^20

* Refactor storage unit size display to use binary prefixes

This commit updates the display of storage unit sizes in both the camera storage stats and the Storage component in the web UI to use binary prefixes (MiB and GiB) instead of decimal prefixes (MB and GB). This provides more accurate and consistent representation of storage sizes
2023-06-11 14:49:13 -05:00
Bernt Christian Egeland
b359ff1b8e
[Feature] Add timepicker to calendar (#5183)
* added timepicker as children to calendar

* new timepicker component

* Add timepicker

* new timePicker component

* timepicker as calendar child

* hover:border and rounded

* adjusted width

* complete rework

* more code comments

* memorization

* preselect hover, transition

* numberOfDaysSelected has minimum of 1

* prefill hours when component mounts

* persist hours when component mount

* accommodate for the new timePicker

* add reset state

* scroll into view

* reuse before, after

* fix LastDayInRange when a time is selected

* do not add hours if before is zero

* use hours instead of days

* useeffect to reset hour. check timerange before scroll

* scroll to last element, not first
2023-06-11 14:48:45 -05:00
Nicolas Mowen
0f1cf67b91
Fix birdseye optimistic approach (#6764) 2023-06-11 08:47:34 -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
Sergey Krashevich
5c27cb7e9b
Optimization of Sync Records: Implementing Pagination and Temporary Table (#6585)
* Update pull_request.yml

* Add temporary table for deletion and use pagination to process recordings in chunks for deletion of recordings with missing files

* move RecordingsToDelete class to models.py

* recording cleanup: bugfixes

* Update cleanup.py

* improve log message in cleanup.py

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

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-06-11 08:01:50 -05:00
Sergey Krashevich
7459a1cdde
Enhancement: Add Date and Time Inputs to Export Component with Time Validation (#6750)
* Add date and time inputs to Export component and ensure end time is larger than start time

* Update web/src/routes/Export.jsx

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

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-06-11 08:01:16 -05:00