Commit Graph

877 Commits

Author SHA1 Message Date
Blake Blackshear
c6445898ce default periodic checks to never 2022-02-18 21:18:26 -06:00
Blake Blackshear
f1ddd0e6f7 scan the frame on startup 2022-02-18 21:18:26 -06:00
Blake Blackshear
db369a5b7f require a position change to be an active object 2022-02-18 21:18:26 -06:00
Blake Blackshear
87cd618998 randomize the region multiplier for variation 2022-02-18 21:18:26 -06:00
Blake Blackshear
338e4004d4 improve method for determining position
compares the centroid to a history of bounding boxes
2022-02-18 21:18:26 -06:00
Blake Blackshear
675f21e23a if recording not on disk, delete from db and return 2022-02-18 21:18:26 -06:00
Blake Blackshear
4d2d11193f cleanup clean snapshots on event deletion too 2022-02-18 21:18:26 -06:00
Blake Blackshear
69aaf1f8e6 require url safe camera names 2022-02-18 21:18:26 -06:00
Yuriy Sannikov
6eecb6780e Run python unit tests in a github actions (#2589)
* tox tests initial commit

* run tests in the Dockerfile during the build phase

* remove local tests

Co-authored-by: YS <ys@gm.com>
2022-02-18 21:18:26 -06:00
Yuriy Sannikov
80627e4989 safe refactoring (#2552)
Co-authored-by: YS <ys@gm.com>
2022-02-18 21:18:26 -06:00
TJ Horner
9e987fdebc Change JPEG mime type (#2543) 2022-02-18 21:18:26 -06:00
Blake Blackshear
e6292c719d disable disk sync on startup 2022-02-18 21:18:26 -06:00
Blake Blackshear
2c91e7853c check for apex dir 2022-02-18 21:18:26 -06:00
Ryan McLean
1e7f196e5c #2117 change entered_zones from set to list so that they are not automatically alphabetically ordered (#2212) 2022-02-18 21:18:26 -06:00
Justin Goette
f91f4f0053 Allow for ".yaml" (#2244)
* allow for ".yaml"

* remove unused import
2022-02-18 21:18:26 -06:00
Matt Clayton
8b2622a234 Add temperature of coral tpu to telemetry mqtt message 2022-02-18 21:18:26 -06:00
Blake Blackshear
ec3c15e4a7 expire overlapping segments based on mode 2022-02-18 21:18:26 -06:00
Blake Blackshear
188b202836 store objects and motion counts in the db 2022-02-18 21:18:26 -06:00
Blake Blackshear
01e607a14e warn when retention mismatch 2022-02-18 21:18:26 -06:00
Blake Blackshear
5b164b72dc refactor segment stats logic 2022-02-18 21:18:26 -06:00
Blake Blackshear
dcf65febba switch to retain config instead of retain_days 2022-02-18 21:18:26 -06:00
Blake Blackshear
56a2d4e64d pass processed tracked objects 2022-02-18 21:18:26 -06:00
Blake Blackshear
ef214fb80a retain frame data for recording maintenance 2022-02-18 21:18:26 -06:00
Blake Blackshear
689af4ff87 sync recordings with disk once on startup 2022-02-18 21:18:26 -06:00
Blake Blackshear
4ab0927de8 no need to expire recordings every minute 2022-02-18 21:18:26 -06:00
Blake Blackshear
014e6fc909 ensure cache copies when events have ended 2022-02-18 21:18:26 -06:00
Blake Blackshear
6832575643 cleanup missing files from database once per hour 2022-02-18 21:18:26 -06:00
Blake Blackshear
07ad2d97b1 handle missing file edge case 2022-02-18 21:18:26 -06:00
Blake Blackshear
039f1a522e log error messages on vod endpoints 2022-02-18 21:18:26 -06:00
Blake Blackshear
24e2f84231 ensure duration > 0 for segments 2022-02-18 21:18:26 -06:00
Blake Blackshear
c50e9d48bf ensure stationary interval is greater than 0 2022-02-18 21:18:26 -06:00
Blake Blackshear
173eaabddf add duration to cache 2022-02-18 21:18:26 -06:00
Blake Blackshear
a748b70da1 avoid running ffprobe for each segment multiple times 2022-02-18 21:18:26 -06:00
Blake Blackshear
8eabe5dd41 warn if no wait time 2022-02-18 21:18:26 -06:00
Blake Blackshear
114415b5e1 keep 5 segments in cache 2022-02-18 21:18:26 -06:00
Blake Blackshear
ba55b5a6db better cache handling 2022-02-18 21:18:26 -06:00
Blake Blackshear
7533f2a8ab avoid proactive messages with retain_days 0 and handle first pass 2022-02-18 21:18:26 -06:00
Blake Blackshear
543a8a1712 avoid divide by zero 2022-02-18 21:18:26 -06:00
Blake Blackshear
9b23ff597c revert switch to b/w frame prep 2022-02-18 21:18:26 -06:00
Blake Blackshear
b2ce1edd5a fix default motion comment 2022-02-18 21:18:26 -06:00
Blake Blackshear
a0235b7da4 more robust cache management 2022-02-18 21:18:26 -06:00
Blake Blackshear
34bc6a6457 error handling for the recording maintainer 2022-02-18 21:18:26 -06:00
Blake Blackshear
273076e7f4 don't modify ffmpeg_cmd object 2022-02-18 21:18:26 -06:00
Blake Blackshear
b29b311e92 fix ffmpeg config for env vars 2022-02-18 21:18:26 -06:00
Blake Blackshear
5a9e82c4b0 create ffmpeg commands on startup 2022-02-18 21:18:26 -06:00
Blake Blackshear
0695bb097d revamp process clip 2022-02-18 21:18:26 -06:00
Blake Blackshear
294c79a271 no longer make motion settings dynamic 2022-02-18 21:18:26 -06:00
Blake Blackshear
e351e132f5 remove min frame height of 180 and increase contour area 2022-02-18 21:18:26 -06:00
Blake Blackshear
258215a3ae consolidate regions 2022-02-18 21:18:26 -06:00
Blake Blackshear
08ddfc100f improve contrast 2022-02-18 21:18:26 -06:00
Blake Blackshear
8ab6cba521 check for overlapping motion boxes 2022-02-18 21:18:26 -06:00
Blake Blackshear
eb16de7395 config option for stationary detection interval 2022-02-18 21:18:26 -06:00
Blake Blackshear
dde0498ed3 drop high overlap detections 2022-02-18 21:18:26 -06:00
Blake Blackshear
75c8570913 reduce detection rate for stationary objects 2022-02-18 21:18:26 -06:00
Blake Blackshear
e36099a342 improve box merging and keep tracking 2022-02-18 21:18:26 -06:00
Blake Blackshear
2f2329ba44 only save recordings when an event is in progress 2022-02-18 21:18:26 -06:00
Blake Blackshear
26ae6084ea fix rtmp again 2021-10-24 13:53:43 -05:00
Blake Blackshear
a67b8ab84d validate with runtime config (fixes #2055) 2021-10-23 08:21:15 -05:00
Blake Blackshear
4cf55ad8e2 Revert switch to mpegts format and audio default 2021-10-23 08:21:15 -05:00
Blake Blackshear
b0e0abe385 improve performance of cache loop 2021-10-23 08:21:15 -05:00
Blake Blackshear
4916e1cd1d hide banner for ffmpeg conversion 2021-10-23 08:21:15 -05:00
Blake Blackshear
cd87f3e6f4 fix old style recording cleanup 2021-10-23 08:21:15 -05:00
Blake Blackshear
2e494477a6 backwards compatibility for segment_type 2021-10-16 10:36:13 -05:00
Blake Blackshear
86a741b6e6 assign roles when single input and consolidate validation 2021-10-16 07:46:39 -05:00
Blake Blackshear
f738275d21 yell about config validation errors
for the people in the back
2021-10-16 07:17:36 -05:00
Blake Blackshear
e297e02800 store audio by default 2021-10-16 06:06:49 -05:00
Blake Blackshear
b2e05afff2 prevent oldest recording from being deleted 2021-10-15 21:56:03 -05:00
Blake Blackshear
c809494c98 switch to mpegts format for cache and create mp4 with faststart 2021-10-15 21:08:43 -05:00
Blake Blackshear
ef82c5c691 fix expiration when event spans the exire date 2021-10-15 07:30:55 -05:00
Blake Blackshear
5669f4c161 fix logo used for birdseye 2021-10-05 18:40:46 -05:00
Blake Blackshear
de811b7018 delete clean snapshot when duplicate 2021-10-02 06:59:02 -05:00
Blake Blackshear
7bf7365f6c better log message when corrupt segment detected 2021-10-02 06:58:29 -05:00
Blake Blackshear
e8e778c6d4 instantiate area field 2021-09-26 09:43:31 -05:00
Blake Blackshear
1d25936f31 add region/bbox/area to event table 2021-09-23 07:31:48 -05:00
Blake Blackshear
c3109f808c allow partial days in retention settings 2021-09-20 18:59:16 -05:00
Blake Blackshear
a943ac1308 use s6 to shutdown frigate 2021-09-18 07:40:27 -05:00
Blake Blackshear
5a8016de87 simplify logic and fix wrong segments expiring (fixes #1779) 2021-09-17 17:15:16 -05:00
Blake Blackshear
bc350644bd make expiration of deleted camera footage faster 2021-09-17 17:12:03 -05:00
Blake Blackshear
1b2134c49e remove clip_ready event type
this doesnt really mean anything more than "end" anymore. new has_clip property added
2021-09-15 07:16:52 -05:00
Blake Blackshear
f83d4a58dd add version to the logs on startup 2021-09-13 22:02:23 -05:00
Blake Blackshear
661f7baa21 fix global live config 2021-09-13 20:33:00 -05:00
Jason Hunter
a7b7a45b23 allow for custom object detection model via configuration 2021-09-12 07:17:26 -05:00
Blake Blackshear
89e317a6bb store start/end event with pre/post capture to avoid expiring wanted recordings 2021-09-11 08:34:27 -05:00
Blake Blackshear
288b1a0562 remove nested enabled config setting on events 2021-09-08 08:02:26 -05:00
Blake Blackshear
e8eb3125a5 disallow extra keys in config 2021-09-04 16:56:01 -05:00
Blake Blackshear
8109445fdd fix color config for ts (fixes #1679) 2021-09-04 16:40:10 -05:00
Blake Blackshear
f63a7cb6c0 remove font_scale in timestamp_style and calculate dynamically again 2021-09-04 16:34:48 -05:00
drinfernoo
65855e23d9
Add RTMP and timestamp style to global config (#1674)
* 📝🔧 - Make RTMP config global

Fixes #1671

* 📝🔧 - Make timestamp style config global

Fixes #1656

* fix test function names

* formatter

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2021-09-03 07:03:36 -05:00
Blake Blackshear
6c28613def moar speed 2021-09-03 06:31:06 -05:00
Blake Blackshear
56480dc1ef bulk delete recordings 2021-09-02 20:40:38 -05:00
Blake Blackshear
8e1c15291d optimize checking recordings for events
sorts events and recordings so you can avoid a cartesian product of checking all events against all recordings
2021-09-02 08:24:53 -05:00
Blake Blackshear
a1e52c51b1 dont expire events in two places 2021-09-01 07:06:52 -05:00
Blake Blackshear
8cc834633e reduce db queries for recording cleanup 2021-09-01 06:44:05 -05:00
Blake Blackshear
7d65c05994 properly handle scenario with no recordings 2021-08-30 06:58:50 -05:00
Blake Blackshear
fbea51372f sync global snapshot options (fixes #1621) 2021-08-28 09:14:00 -05:00
Blake Blackshear
fa5ec8d019 cleanup global and camera detect config (fixes #1615) 2021-08-28 08:51:51 -05:00
Blake Blackshear
11c425a7eb error on invalid role 2021-08-28 08:16:25 -05:00
Blake Blackshear
6ccff71408 handle missing camera names 2021-08-28 07:43:51 -05:00
Blake Blackshear
41fea2a531 fix match for websocket url (fixes #1633) 2021-08-28 07:42:30 -05:00
ᗪєνιη ᗷυнʟ
10ab70080a
fix: consistent error logging to mqtt connection issues (#1578) 2021-08-24 07:59:31 -05:00
Blake Blackshear
29de723267 limit legacy expiration to files after the oldest recording in the db 2021-08-24 06:50:58 -05:00
Blake Blackshear
26424488a5 use find to reduce CPU usage for legacy expiration 2021-08-23 07:21:27 -05:00
Blake Blackshear
334095252c copy then delete (fixes #1516) 2021-08-17 06:52:15 -05:00
Blake Blackshear
1c85f774eb move colormap to config 2021-08-16 08:02:04 -05:00
Blake Blackshear
bbf0fc8324 use CPu detector by default 2021-08-16 07:39:20 -05:00
Blake Blackshear
b143e11e0e cleanup logging 2021-08-16 07:38:53 -05:00
Sebastian Englbrecht
927f56ab9f Fix logger invocation 2021-08-15 10:34:40 -05:00
Blake Blackshear
2181379475 stop using pycoral libs for efficiency 2021-08-15 09:14:13 -05:00
Blake Blackshear
45798d6d14 clean house on clips 2021-08-15 08:30:27 -05:00
Blake Blackshear
f3a1c1de0a move width/height/fps under detect and make required
also resizes the output from ffmpeg to specified size
2021-08-14 14:18:35 -05:00
Blake Blackshear
0ccf543ec1 clarify a few things in logs 2021-08-14 14:04:00 -05:00
Blake Blackshear
b33f4e2dc6 assume the clip for the event exists with recordings 2021-08-12 06:42:44 -05:00
Blake Blackshear
9cab5da74c cleanup dynamic mp4 clips 2021-08-11 07:39:03 -05:00
Blake Blackshear
189b9c6648 use a nginx internal redirect 2021-08-11 06:22:26 -05:00
Blake Blackshear
1823bd0305 fix scaling 2021-08-09 07:46:28 -05:00
Jason Hunter
fc40567794 remove -f mp4 as it is not needed 2021-08-07 15:51:16 -05:00
Jason Hunter
de121008c1 fix DoesNotExist exception 2021-08-07 15:51:16 -05:00
Jason Hunter
2fbfbf614b add download option on clips and snapshots 2021-08-07 15:51:16 -05:00
Jason Hunter
c527b1ca5d change MQTT to toggle recordings instead of clips 2021-08-07 15:51:16 -05:00
Jason Hunter
181a504a14 break out recording maintenance and cleanup into separate threads 2021-08-07 15:51:16 -05:00
Jason Hunter
5d940bcb86 optimize recording maintenance logic 2021-08-07 15:51:16 -05:00
Jason Hunter
5d94c68d66 fix recording retention logic 2021-08-07 15:51:16 -05:00
Jason Hunter
a476bc9885 initial commit 2021-08-07 15:51:16 -05:00
Blake Blackshear
dc759a3e56 use new pycoral libraries 2021-08-07 15:34:55 -05:00
Blake Blackshear
e51021c573 switch default live resolution to 720 2021-07-21 07:47:11 -05:00
Blake Blackshear
19115fb828 handle exception when missing frame 2021-07-16 07:28:30 -05:00
Blake Blackshear
50f0c05e69 fix motion mask overlay 2021-07-13 08:56:20 -05:00
Blake Blackshear
6b26fc753e include ffmpeg_cmds in config endpoint 2021-07-10 06:40:50 -05:00
Blake Blackshear
ebee204ca0 ensure default args propogate 2021-07-10 06:40:50 -05:00
Blake Blackshear
92aa16c556 add labelmap customization to the config (fixes #507) 2021-07-07 22:58:18 -05:00
Blake Blackshear
a3853af47a fix test 2021-07-07 22:58:18 -05:00
Blake Blackshear
f26f7b8d3f make default motion a little more sensitive 2021-07-07 07:33:14 -05:00
Blake Blackshear
f4aa02cc19 allow specific objects to be listed for a zone (fixes #1123) 2021-07-07 07:33:14 -05:00
Blake Blackshear
da2492413f publish on zone change (fixes #1310) 2021-07-07 07:03:28 -05:00
Blake Blackshear
f892a821f5 no need to worry about payload here 2021-07-06 07:36:37 -05:00
ElMoribond
fe2e32c84f Add ability to restart 2021-07-06 07:36:37 -05:00
ElMoribond
c6e53d0ea8 Add ability to restart 2021-07-06 07:36:37 -05:00
ElMoribond
11d8095cdd Add ability to restart 2021-07-06 07:36:37 -05:00
ElMoribond
a4052a9fe5 Add ability to restart 2021-07-06 07:36:37 -05:00
Blake Blackshear
b24bb3eb18 add range to birdseye quality config 2021-07-02 07:52:02 -05:00
Blake Blackshear
98d8118fb2 add options to define jpeg quality 2021-07-02 07:52:02 -05:00
Blake Blackshear
b4e7e51e63 make contour_area dynamic 2021-07-01 07:54:09 -05:00
Blake Blackshear
2a41a9d3ff set min motion frame to 180 2021-07-01 07:54:09 -05:00
Blake Blackshear
09b0068d16 fix cache cleanup (fixes #1231) 2021-06-30 06:38:36 -05:00
Blake Blackshear
f9457be109 add test for max_disappeared default 2021-06-27 08:13:48 -05:00
Blake Blackshear
e9291fe9d1 make max_disappeared optional with default value 2021-06-27 08:13:48 -05:00
Craig Citro
20912c12e7 Check for jpg bytes before make_response
If jpg_bytes wasn't retrieved from either desk or a tracked object, respond with 404
Prevents uncaught error for unknown event ids sent to event_snapshot endpoint
2021-06-27 08:13:14 -05:00
Craig Citro
7ddba4fc59 Prevent repeated db connect calls
Only call database.connect() if database.is_closed()
Prevents errors if _db_connect is triggered twice
2021-06-27 08:13:14 -05:00
Patrick
7ad8b8298d identity check is correct way to check for None 2021-06-27 08:09:58 -05:00
Jason Hunter
3fb24b4bf5 fix timestamp 2021-06-25 06:13:08 -05:00
Jason Hunter
ab93cae4c0 remove side effects from password substitution 2021-06-25 06:13:08 -05:00
Jason Hunter
8d01cc4807 fix ffmpeg config and remove side effects 2021-06-25 06:13:08 -05:00
Jason Hunter
1e21a62851 remove unneeded changes 2021-06-24 06:53:05 -05:00
Jason Hunter
c664bd63f6 initial conversion to pydantic 2021-06-24 06:53:05 -05:00
Blake Blackshear
762afb8f43 add config for camera live stream 2021-06-23 08:15:15 -05:00
Blake Blackshear
f009897eca clear position before copy 2021-06-23 08:15:15 -05:00
Blake Blackshear
fa61e9da29 maintain aspect ratio for birdseye 2021-06-23 08:15:15 -05:00
Blake Blackshear
0ff037997f fixup timestamp config 2021-06-23 08:15:15 -05:00
Blake Blackshear
e8c2cfa5b5 no need to hang onto the last active frame 2021-06-23 08:15:15 -05:00
Blake Blackshear
fb214b64ca reset layout_dim too 2021-06-23 08:15:15 -05:00
Sebastian Englbrecht
b3ee2de079 Fix review finding 2021-06-22 06:33:04 -05:00
Sebastian Englbrecht
211fcd64c7 Add and use config for timestamp style 2021-06-22 06:33:04 -05:00
Sebastian Englbrecht
5075e4eee1 Use timestamp decorator helper in codebase 2021-06-22 06:33:04 -05:00
Sebastian Englbrecht
7bfe8e4f5b Add draw_timstamp: Helper for timestamp mods 2021-06-22 06:33:04 -05:00
Blake Blackshear
d66f5f6bad cleanup clean snapshots 2021-06-19 08:49:06 -05:00
Blake Blackshear
fd9c8c1f0d add snapshot time to event data 2021-06-19 08:49:06 -05:00
Blake Blackshear
3a3b788c65 save clean snapshot 2021-06-19 08:49:06 -05:00
Blake Blackshear
b134db48b3 adding clean_copy to snapshot config 2021-06-19 08:49:06 -05:00
mrdrup
f110a261b9
Fix 'FileExistsError' shared memory exception (#945) 2021-06-19 07:15:02 -05:00
gpete
b72b66781a
Fixed overwritten argument 'media' (#1026)
media variable name is reused and overwritten causing issues with event expiration & clean up.
Also changed name in pure_duplicates for consistency.
2021-06-19 07:11:43 -05:00
Blake Blackshear
3b695040d1 send clip_ready mqtt to event topic 2021-06-14 18:20:12 -05:00
Blake Blackshear
40bf7a0f41 cleanup 2021-06-14 07:48:35 -05:00
Blake Blackshear
cbdf2c2c71 remove gevent fixes #920 2021-06-14 07:48:35 -05:00
Blake Blackshear
bbe3f07ec6 overlay the frigate logo on the blank frame 2021-06-13 12:35:39 -05:00
Blake Blackshear
35281c037c trickle in some frames after activity stops 2021-06-13 12:35:39 -05:00
Blake Blackshear
e0eb247028 output the current frame from each active camera instead of last active 2021-06-13 12:35:39 -05:00
Blake Blackshear
a7ecc2af4b lock before iterating web sockets 2021-06-13 12:35:39 -05:00
Blake Blackshear
58cfb8bba4 set jsmpeg video size to same as camera 2021-06-12 07:23:14 -05:00
Blake Blackshear
ed761d1767 cap the array size of the output queue 2021-06-12 07:23:14 -05:00
Blake Blackshear
babe1dd1eb precompute the layout offsets and dimensions 2021-06-12 07:23:14 -05:00
Blake Blackshear
cbd418b8de use actual logger 2021-06-12 07:23:14 -05:00
Blake Blackshear
9c5b0d4138 implement birdseye modes 2021-06-12 07:23:14 -05:00
Blake Blackshear
94c21a6363 use values from config 2021-06-12 07:23:14 -05:00
Blake Blackshear
d1a5e2e8e0 add config for birdseye 2021-06-12 07:23:14 -05:00
Blake Blackshear
17179abf5a use quality value and faster resize 2021-06-12 07:23:14 -05:00
Blake Blackshear
c70419bd0b update birdseye layout calculations 2021-06-12 07:23:14 -05:00
Blake Blackshear
4eed27e178 add layout calculations 2021-06-12 07:23:14 -05:00
Blake Blackshear
8e2ba4a8ea move birdseye placeholder to output process 2021-06-12 07:23:14 -05:00
Blake Blackshear
4596ada801 manage multiple cameras 2021-06-12 07:23:14 -05:00
Blake Blackshear
a8df97dc1a only send frames to ffmpeg if there are clients listening 2021-06-12 07:23:14 -05:00
Blake Blackshear
4e0203ca68 increase read size and listen on local 2021-06-12 07:23:14 -05:00
Blake Blackshear
8413e10091 ensure output exits properly 2021-06-12 07:23:14 -05:00
Blake Blackshear
7aaf5bd29f remove node jsmpeg server 2021-06-12 07:23:14 -05:00
Blake Blackshear
5afda72b84 handle exit signals 2021-06-12 07:23:14 -05:00
Blake Blackshear
7a6ffb1032 adding output process to handle downstream processing of frames 2021-06-12 07:23:14 -05:00
Blake Blackshear
7fc9026ca6 basic plumbing for birdseye view 2021-06-12 07:23:14 -05:00
Blake Blackshear
f4a0ec43a6 wip yuv_rgb refactor 2021-06-12 07:23:14 -05:00
Patrick
e8c342e162 Update http.py
comparison of constants, use T/F instead
2021-06-10 20:58:28 -05:00
Jason Hunter
098e293c82 fetch recordings until end of hour, not top of next hour 2021-06-10 07:04:28 -05:00
Jason Hunter
78a0b5e6c9 clean up VOD endpoint 2021-06-10 07:04:28 -05:00
Jason Hunter
055bd22138 initial implementation of recordings table 2021-06-10 07:04:28 -05:00
Mingkwan Burckhardt
8dfff83447 Added support for authentication with client certificate with MQTT broker 2021-06-06 07:57:46 -05:00
Jason Hunter
68dfaaf767 hide recordings page if record is not enabled, show error if no recordings available. 2021-06-06 07:54:58 -05:00
Jason Hunter
b53a50cd54 restyle to match Material Design List specs 2021-06-05 07:30:18 -05:00
Jason Hunter
9822d614e2 fix videojs bug when switching cameras, support recording delay, fix navigation highlight 2021-06-05 07:30:18 -05:00
Jason Hunter
ca20c735f7 add event card to overlay 2021-06-05 07:30:18 -05:00
Jason Hunter
5461308d30 Initial Recordings UI 2021-06-05 07:30:18 -05:00
Sean Vig
abbc608ee4 Updates to object processing
Lock updates to tracked objects, current frame time, motion boxes, and
regions on `update()`.

Directly create Counters using counted values.

Don't convert removed_ids, new_ids, or updated_ids sets to lists.

Update defaultdict's to remove un-necessary lambdas when possible.

When possible, drop un-necessay list comprehensions, such as when
calling `any`.

Use set comprehension, rather than passing a list comprehension into
`set()`.

Do the slightly more pythonic `x not in y` rather than `not x in y` to
check list inclusion.
2021-05-23 21:00:56 -05:00
Sean Vig
9634ec8e31 Allow zone configs to be frozen
Set the color at construction so the zone config objects can be frozen
2021-05-23 20:38:57 -05:00
Sean Vig
84a0827aee Use dataclasses for config handling
Use config data classes to eliminate some of the boilerplate associated
with setting up the configuration.  In particular, using dataclasses
removes a lot of the boilerplate around assigning properties to the
object and allows these to be easily immutable by freezing them.  In the
case of simple, non-nested dataclasses, this also provides more
convenient `asdict` helpers.

To set this up, where previously the objects would be parsed from the
config via the `__init__` method, create a `build` classmethod that does
this and calls the dataclass initializer.

Some of the objects are mutated at runtime, in particular some of the
zones are mutated to set the color (this might be able to be refactored
out) and some of the camera functionality can be enabled/disabled.  Some
of the configs with `enabled` properties don't seem to have mqtt hooks
to be able to toggle this, in particular, the clips, snapshots, and
detect can be toggled but rtmp and record configs do not, but all of
these configs are still not frozen in case there is some other
functionality I am missing.

There are a couple other minor fixes here, one that was introduced
by me recently where `max_seconds` was not defined, the other to
properly `get()` the message payload when handling publishing mqtt
messages sent via websocket.
2021-05-23 20:38:57 -05:00
Blake Blackshear
1fbcf4d9b9 fixes 2021-05-23 08:21:18 -05:00
Sean Vig
80f8256422 Improve handling of object matching
Use `np.unique` to determine the correct set of row/col pairs to iterate
over when doing the object matching without needing to track which rows
or columns have already been seen.  Add to some of the accompanying
documentation to clarify this algorithm.

Also fix what looks to be an erroneous early return, and change this to
a continue.
2021-05-22 08:04:38 -05:00
Sean Vig
57864f2be6 Wait on stop event when possible
Generally eliminate the `while True` loops while waiting for a stop
event and prefer to condition the loops on if the stop event is set,
blocking on that where it makes sense.  This generally comes in 3
flavors.  First and simplest, when there is a sleep and the stop event
is the only thing the loop blocks on, instead do a check using
`stop_event.wait(timeout)` to instead block on the stop event for the
designated amount of time. Second, when there is a different event that
is blocking in the loop, condition the loop on `stop_event.is_set()`
rather than breaking when it is set. Finally, when there is a separate
internal condition that requires a counter, have the loop iterate over
the counter and use `if stop_event.wait(timeout)` internal to the loop.
2021-05-22 07:54:16 -05:00
Jason Hunter
aab6a00e4c Add support for NGINX VOD Module 2021-05-22 07:48:44 -05:00
Sean Vig
a4e6d9ed9a Improve ffprobe executions
When running ffprobe, use `subprocess.run` rather than
`subprocess.Popen`.  This simplifies the handling that is needed to run
and process the outputs.  Here, filename parsing is also simplified by
explicitly removing the file extension with `os.path.splitext` and
forcing a single split into the camera name and the formatted date.
2021-05-22 07:48:00 -05:00
Mitch Ross
ebb6d348a3
feat(web): Delete events from Event page and API (#991)
Co-authored-by: Scott Roach <scott@thinkpivot.io>
Co-authored-by: Paul Armstrong <paul@spaceyak.com>
2021-05-12 08:19:02 -07:00
Jason Hunter
482399d82f allow logger daemon process to be killed with the main thread, thus allowing us to continue logging during shutdown 2021-05-06 07:01:33 -05:00
Blake Blackshear
4252857e19 remove tmpfs_cache_size option 2021-02-25 07:01:59 -06:00
Blake Blackshear
6d12a34c40 remove thumbnail attribute if null 2021-02-25 07:01:59 -06:00
Blake Blackshear
9e126a4b91 style cleanup 2021-02-25 07:01:59 -06:00
Blake Blackshear
39ff49e054 formatting cleanup 2021-02-25 07:01:57 -06:00
Blake Blackshear
0344d61b26 use gevent sleep to prevent mjpeg from blocking 2021-02-25 06:34:36 -06:00
Paul Armstrong
e399790442 feat(web): mqtt for stats 2021-02-20 08:20:17 -06:00
Blake Blackshear
1a7853a47e subscribe in the connect callback (fixes #814) 2021-02-20 08:20:17 -06:00
Blake Blackshear
b6572b7272 add some error handling to mqtt relay 2021-02-20 08:20:17 -06:00
Blake Blackshear
57ced2c284 constrain websockets to frigate topics 2021-02-20 08:20:17 -06:00
Blake Blackshear
26a3491466 revise log messages 2021-02-20 08:20:17 -06:00
Blake Blackshear
eed8463832 relay messages from sockets to mqtt 2021-02-20 08:20:17 -06:00
Blake Blackshear
718b4f3fd7 relay mqtt to clients 2021-02-20 08:20:17 -06:00
Blake Blackshear
22461d1728 simple echo websocket working 2021-02-20 08:20:17 -06:00
Blake Blackshear
a661fddaf3 fix cache cleanup for large full disks 2021-02-20 08:20:17 -06:00
Blake Blackshear
1b85e561b9 only save the event to the database if a snapshot or clip exists 2021-02-20 08:20:17 -06:00
Blake Blackshear
513a099c24 better error handling (fixes #739) 2021-02-20 08:20:17 -06:00
Blake Blackshear
e299e73a68 ignore detections that don't overlap with motion 2021-02-20 08:20:17 -06:00
Blake Blackshear
9550ac7422 fix intersection calculation 2021-02-20 08:20:17 -06:00
Blake Blackshear
01c3b4fa6e try and ensure database closes cleanly 2021-02-20 08:20:17 -06:00
Blake Blackshear
165ca8fbc7 purge duplicate events during cleanup 2021-02-20 08:20:17 -06:00
Blake Blackshear
ce90ae343c add global object mask 2021-02-20 08:20:17 -06:00
Blake Blackshear
d51e9446ff add camera level ffmpeg params 2021-02-20 08:20:17 -06:00
Blake Blackshear
d3524ee46f adjust jpg quality in other locations too 2021-02-20 08:20:17 -06:00
Blake Blackshear
121ea37825 allow defining required zones for snapshots/clips/mqtt 2021-02-20 08:20:17 -06:00
Blake Blackshear
9592d95599 proactively clean up cache when above 90% use 2021-02-20 08:20:17 -06:00
Blake Blackshear
d6faa18adb increase default max_disappeared to 5x FPS 2021-02-20 08:20:17 -06:00
Blake Blackshear
1cbe6f77ee only run detection on objects that intersect with motion 2021-02-20 08:20:17 -06:00
Blake Blackshear
4f5d4e36b7 add disk usage to stats 2021-02-20 08:20:17 -06:00
Paul Armstrong
163025c1f2 fix(app): reduce JPEG quality to drastically improve size 2021-02-20 08:20:17 -06:00
Paul Armstrong
e6516235fa feat(web): auto-paginate events page 2021-01-31 06:18:35 -06:00
Blake Blackshear
40d5a9f890 change default log level 2021-01-31 06:18:35 -06:00
Blake Blackshear
ee3e744cc6 tail last 100 lines of ffmpeg logs and dump when failure detected 2021-01-31 06:18:35 -06:00
Blake Blackshear
b55bd1e027 add param to reduce response sizes by excluding thumbnails in api response 2021-01-31 06:18:35 -06:00
Blake Blackshear
630c2ee6f6 use sqlitequeuedb 2021-01-26 21:40:33 -06:00
Blake Blackshear
d31c295598 add debug log when cache is cleaned up 2021-01-26 21:40:33 -06:00
Blake Blackshear
a7bb0931c4 if detection stopped, assume the container needs a restart 2021-01-26 21:40:33 -06:00
Blake Blackshear
d315dbea22 rate limit tracked object updates to every 5 seconds 2021-01-26 21:40:33 -06:00
Blake Blackshear
8db7ab6724 add snapshot endpoint that works during the event fixes #575 2021-01-26 21:40:33 -06:00
Blake Blackshear
9a2c034ae8 get the thumbnail instead of the full frame 2021-01-26 21:40:33 -06:00
Blake Blackshear
2885b80a13 dont wait forever for the cache 2021-01-26 21:40:33 -06:00
Blake Blackshear
4a85156e87 fix initial switch state 2021-01-26 21:40:33 -06:00
Blake Blackshear
1785c69e1b handle exception when frame isnt in cache 2021-01-26 21:40:33 -06:00
Blake Blackshear
11016b8486 ensure error message with missing config is printed 2021-01-26 21:40:33 -06:00
Blake Blackshear
1e84f08018 fix mqtt switch handling 2021-01-26 21:40:33 -06:00
Blake Blackshear
7f663328dc initialize detection correctly from config 2021-01-26 21:40:33 -06:00
Blake Blackshear
70167a34b6 fix zone config 2021-01-26 21:40:33 -06:00
Blake Blackshear
eb0a5e1c55 rename snapshot endpoint to thumbnail 2021-01-26 21:40:33 -06:00
Blake Blackshear
47ac77dbb0 mqtt tweaks for switches 2021-01-26 21:40:33 -06:00
Blake Blackshear
ec84847be7 allow summary data to be filtered 2021-01-26 21:40:33 -06:00
Blake Blackshear
8762da627b snapshots config typo 2021-01-26 21:40:33 -06:00
Blake Blackshear
3fab321045 update object filters to inherit like motion settings 2021-01-26 21:40:33 -06:00
Blake Blackshear
9451048574 remove support for image masks 2021-01-26 21:40:33 -06:00
Blake Blackshear
46c002038b don't fallback to the CPU
fixes #381
2021-01-26 21:40:33 -06:00
Blake Blackshear
d1d833ea9a add change type to events topic
#476
2021-01-26 21:40:33 -06:00
Blake Blackshear
c1f0750526 ensure each camera has a detect role set 2021-01-26 21:40:33 -06:00
Blake Blackshear
89e02b6956 add detection enable to config
fixes #482
2021-01-26 21:40:33 -06:00
Blake Blackshear
97e8258288 add env vars to config
fixes #509
2021-01-26 21:40:33 -06:00
Blake Blackshear
39040c1874 enable and disable detection via mqtt 2021-01-26 21:40:33 -06:00
Blake Blackshear
bca0531963 handle null thumbnail data 2021-01-26 21:40:33 -06:00
Blake Blackshear
b2c7fc8f5b add mask as object filter 2021-01-26 21:40:33 -06:00
Blake Blackshear
96ac2c29d6 add object masks and move moton mask 2021-01-26 21:40:33 -06:00
Blake Blackshear
14a5118b4d add missing global shapshots config 2021-01-26 21:40:33 -06:00
Paul Armstrong
c618867941 feat!: web user interface 2021-01-26 21:40:33 -06:00
Blake Blackshear
5ad4017510 try to cleanup some migration logging 2021-01-26 21:40:33 -06:00
Blake Blackshear
63e14a98f9 add retention settings for snapshots 2021-01-26 21:40:33 -06:00
Blake Blackshear
25e3fe8eab init variables on camera state 2021-01-26 21:40:33 -06:00
Blake Blackshear
840f046572 handle process exit exceptions 2021-01-26 21:40:33 -06:00
Blake Blackshear
89e3c2e4b1 store has_clip and has_snapshot on events 2021-01-26 21:40:33 -06:00
Blake Blackshear
c770470b58 add database migrations 2021-01-26 21:40:33 -06:00
Nat Morris
4619836122 Set titles for forked processes 2021-01-26 21:40:33 -06:00
Nat Morris
76403bba8e New stats module, refactor stats generation out of http module.
StatsEmitter thread to send stats to MQTT every 60 seconds by default, optional stats_interval config value.

New service stats attribute, containing uptime in seconds and version.
2021-01-26 21:40:33 -06:00
Blake Blackshear
a9afa303a2 turn off snapshots via mqtt 2021-01-26 21:40:33 -06:00
Blake Blackshear
e5399ae07a enable turning clips on and off via mqtt 2021-01-26 21:40:33 -06:00
Blake Blackshear
80a5a7b129 cleanup save_Clips/clips inconsistency 2021-01-26 21:40:33 -06:00
Blake Blackshear
9dc97d4b6b add jpg snapshots to disk and clean up config 2021-01-26 21:40:33 -06:00
Paul Armstrong
d8c9169af2 fix: ensure timestamp is drawn above mask 2021-01-26 21:40:33 -06:00
kluszczyn
b0b2d9d972 Recordings - fix expire_file 2021-01-26 21:40:33 -06:00
Blake Blackshear
fc04bc6046 better mask error handling 2021-01-26 21:40:33 -06:00
Blake Blackshear
9f504253fb fix tmpfs 2021-01-26 21:40:33 -06:00
Blake Blackshear
961997e078 remove redundant error output 2021-01-26 21:40:33 -06:00
Blake Blackshear
363594a9a2 use CACHE_DIR constant 2021-01-26 21:40:33 -06:00
Blake Blackshear
247e2677f3 enable mounting tmpfs volume on start 2021-01-26 21:40:33 -06:00
Blake Blackshear
bc8b85860c update process clip for latest changes 2021-01-26 21:40:33 -06:00
Blake Blackshear
44d45c5880 publish event updates on zone change 2021-01-26 21:40:33 -06:00
Blake Blackshear
2cc9a15f6a handle scenario with empty cache 2021-01-26 21:40:33 -06:00
Blake Blackshear
32fb76b3d1 add num_threads fixes #322 2021-01-26 21:40:33 -06:00
Blake Blackshear
8d52e2635a optimize clips fixes #299 2021-01-26 21:40:33 -06:00
Blake Blackshear
f20e1f20a6 add post_capture option 2021-01-26 21:40:33 -06:00
Blake Blackshear
af8594c5c6 re-crop to the object rather than the region 2021-01-26 21:40:33 -06:00
Blake Blackshear
899d41f361 allow runtime drawing settings for mjpeg and latest 2021-01-26 21:40:33 -06:00
Blake Blackshear
7dc6382c90 allow the mask to be a list of masks 2021-01-26 21:40:33 -06:00
Blake Blackshear
e8009c2d26 adding version endpoint 2021-01-26 21:40:33 -06:00
Blake Blackshear
3bc7cdaab6 configurable motion and detect settings 2021-01-26 21:40:33 -06:00
Blake Blackshear
8f68df60c7 fix test 2021-01-26 21:40:33 -06:00
Blake Blackshear
6af3cb6134 switch default threshold to .7 2021-01-26 21:40:33 -06:00
Blake Blackshear
2ff0c3907f allow process clips to output a csv of scores 2021-01-26 21:40:33 -06:00
Blake Blackshear
dd102ff01d allow db path to be customized 2021-01-26 21:40:33 -06:00
Blake Blackshear
a4b88ac4a7 fix process clip 2021-01-26 21:40:33 -06:00
Blake Blackshear
93b9d586d2 handle empty string args 2021-01-26 21:40:33 -06:00
Blake Blackshear
41dd4447cc allow region to extend beyond the frame 2021-01-26 21:40:33 -06:00
Blake Blackshear
d0470fffcc allow defining model shape and switch to mobiledet as default model 2021-01-26 21:40:33 -06:00
Blake Blackshear
5053305e17 add model dimensions to config 2021-01-26 21:40:33 -06:00
Blake Blackshear
3c07767138 handle and warn if roles dont match enabled features 2021-01-26 21:40:33 -06:00
Blake Blackshear
e147852878 catch all psutil errors 2021-01-26 21:40:33 -06:00
Blake Blackshear
e7cdace0ab comment you zeroconf 2021-01-26 21:40:33 -06:00
Blake Blackshear
f60eb4e977 fix flask logger config 2021-01-26 21:40:33 -06:00
Blake Blackshear
7aecf6c6de fix graceful exits 2021-01-26 21:40:33 -06:00
Blake Blackshear
75d62096a6 better exception handling 2021-01-26 21:40:33 -06:00
Blake Blackshear
7c44994070 fix default args 2021-01-26 21:40:33 -06:00
Blake Blackshear
4c6e90717a update some default config values 2021-01-26 21:40:33 -06:00
Blake Blackshear
d60ca9d783 log level configuration 2021-01-26 21:40:33 -06:00
Blake Blackshear
d304718ea0 no need to write jpg disk 2021-01-26 21:40:33 -06:00
Blake Blackshear
c787c8948e dont delete the recordings directory 2021-01-26 21:40:33 -06:00
Blake Blackshear
62728ef7fb default save_clips objects 2021-01-26 21:40:33 -06:00
Blake Blackshear
47e256f03d add logging for directory creation 2021-01-26 21:40:33 -06:00
Blake Blackshear
527db52d5e exit on config errors 2021-01-26 21:40:33 -06:00
Blake Blackshear
f78b2c48a7 add zeroconf discovery 2021-01-26 21:40:33 -06:00
Blake Blackshear
90c965a32a optional android notification aspect ratio 2021-01-26 21:40:33 -06:00
Blake Blackshear
d4afcde6c9 reduce min timestamp size 2021-01-26 21:40:33 -06:00
Blake Blackshear
257de89ce4 publish object counts rather than on/off 2021-01-26 21:40:33 -06:00
Blake Blackshear
735cc3962b make directories constants 2021-01-26 21:40:33 -06:00
Blake Blackshear
feb42181de cleanup empty directories 2021-01-26 21:40:33 -06:00
Blake Blackshear
65ddd91855 add recording maintenance 2021-01-26 21:40:33 -06:00
Blake Blackshear
6d7d838613 add record settings to config 2021-01-26 21:40:33 -06:00
Blake Blackshear
5edf7b7f00 fix log timeout 2021-01-26 21:40:33 -06:00
Blake Blackshear
117569830d ensure zones dont have the same name as a camera 2021-01-26 21:40:33 -06:00
Blake Blackshear
d62aec7287 graceful exit of subprocesses 2021-01-26 21:40:33 -06:00
Blake Blackshear
4e0cf3681e add multiple streams per camera 2021-01-26 21:40:33 -06:00
Blake Blackshear
1acbeb813e add support for rebroadcasting as rtmp 2021-01-26 21:40:33 -06:00
Blake Blackshear
b87ec752cf avoid null error 2021-01-26 21:40:33 -06:00
Blake Blackshear
753df31fa6 minimize logging 2021-01-26 21:40:33 -06:00
Blake Blackshear
bd77b74689 oops 2021-01-26 21:40:33 -06:00
Blake Blackshear
810c23d8ee only publish end events for true positives 2021-01-26 21:40:33 -06:00