Commit Graph

911 Commits

Author SHA1 Message Date
Nicolas Mowen
ca7790ff65
Cleanup timeline entries when relevant recording segments are removed (#6319)
* Cleanup timeline entries when relevant recording segments are removed

* Make timeline cleanup simpler

* Formatting
2023-04-30 09:28:21 -05:00
Nicolas Mowen
37360edbc1
Show other system processes in system page (#6276) 2023-04-28 07:47:49 -05:00
Nicolas Mowen
df016ddd0d
Fix http-jpeg template insertion (#6291) 2023-04-28 07:11:01 -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
e451f44ced
Move recording management to separate process (#6248)
* Move recordings management to own process and ensure db multiprocess access

* remove reference to old threads

* Cleanup directory remover

* Mypy fixes

* Fix mypy

* Add support back for setting record via MQTT and WS

* Formatting

* Fix rebase issue
2023-04-26 07:25:26 -06: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
fbaab71d78
Metadata Timeline (#6194)
* Create timeline table

* Fix indexes

* Add other fields

* Adjust schema to be less descriptive

* Handle timeline queue from tracked object data

* Setup timeline queue in events

* Add source id for index

* Add other fields

* Fixes

* Formatting

* Store better data

* Add api with filtering

* Setup basic UI for timeline in events

* Cleanups

* Add recordings snapshot url

* Start working on timeline ui

* Add tooltip with info

* Improve icons

* Fix start time with clip

* Move player logic back to clips

* Make box in timeline relative coordinates

* Make region relative

* Get box overlay working

* Remove overlay when playing again

* Add disclaimer when selecting overlay points

* Add docs for new apis

* Fix mobile

* Fix docs

* Change color of bottom center box

* Fix vscode formatting
2023-04-23 10:45:19 -05:00
KtAlumi
366c31259f
Edit dsize order (#6172)
dsize could be (width, height).

Co-authored-by: kt.lu <kt.lu@latticeworkinc.com>
2023-04-22 21:38:58 -05:00
Martin Weinelt
cb73d0cd39
Migrate away from deprecated np.float (#5898)
It is an alias for the python float type, and got deprecated in 1.20 and
was removed in 1.24. The rest of the project already uses float32
(single), so I believe this is also correct here, as opposed to float64
(double).
2023-04-16 07:13:33 -05:00
Blake Blackshear
15415bab10
update deps (#6093)
* update dev deps

* update deps

* docs deps

* python dev deps

* update python deps
2023-04-15 14:17:59 -05:00
Nicolas Mowen
3b62ff093a
Ensure the frigate config validators are also checked when saving config (#6069) 2023-04-15 07:24:13 -05:00
Nicolas Mowen
6986949d84
Remove deprecated retain_days config (#5952) 2023-04-09 11:23:34 -05:00
Nicolas Mowen
3f17f871fa
Fix cleaning logs with rtsp in middle (#5800) 2023-03-21 17:21:37 -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
Dermot Duffy
e8d8cc4f55
Return sub_labels in event summary information. (#5642) 2023-03-05 11:39:41 -06:00
Martin Weinelt
161e7b3fd7
Allow using full tensorflow in cpu/edgetpu detector plugins (#5611)
It supports the same entrypoints, given that tflite is a small cut-out
of the big tensorflow picture.

This patch was created for downstream usage in nixpkgs, where we don't
have the tflite python package, but do have the full tensorflow package.
2023-03-03 17:44:17 -06:00
Nicolas Mowen
17c26c9fa9
Sub label filter fixes (#5602)
* Fix list access issue

* Specifically include item when in list or individual only

* Formatting

* Sort sub labels to ensure consistent list
2023-03-03 17:43:27 -06: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
Nicolas Mowen
34bdf2fc10
Clean up output for vainfo and ffprobe (#5586)
* Clean up output for vainfo and ffprobe

* Fix cleanup

* Format vainfo display

* Fix ffprobe output

* Fix stringification

* remove unused
2023-02-26 07:05:27 -06:00
Nicolas Mowen
d97fa99ec5
Fix logging for corrupt segments (#5582)
* Fix logging for corrupt segments

* Formatting
2023-02-24 19:13:33 -06:00
Bernt Christian Egeland
3611e874ca
Events Page: Added option to override browser time format and style (#5538)
* use12hour optional config

* use12hour config arg

* added use12HourFormat arg to format function

* dateStyle & timeStyle option

* moved timezone & locales to format function

* added dateStyle & timeStyle

* re-formatted

* added strftime_fmt config entry

* strftime package

* added strftime option

* underscore instead of camelCase

* underscore props instead of camelCase
2023-02-22 06:54:16 -07:00
Nicolas Mowen
2797a60d4f
Don't fail if openvino fails to import (#5532)
* Don't fail if openvino fails to import

* Ensure all modules are imported safely

* Undo

* Fix list append
2023-02-19 07:41:14 -06:00
Anil Ozyalcin
0592c8b0e2
YOLOv5 & YOLOv8 support for the OpenVINO Detector (#5523)
* Initial commit that adds YOLOv5 and YOLOv8 support for OpenVINO detector

* Fixed double inference bug with YOLOv5 and YOLOv8

* Modified documentation to mention YOLOv5 and YOLOv8

* Changes to pass lint checks

* Change minimum threshold to improve model performance

* Fix link

* Clean up YOLO post-processing

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-02-19 07:39:47 -06:00
Nicolas Mowen
2b685ac343
Plus upload in progress (#5521)
* Fix frigate+ uploading bug

Fixes https://github.com/blakeblackshear/frigate/issues/5515

* wording

* Formatting

* Don't show button when event is in progress

* Don't show in download menu either
2023-02-19 07:38:16 -06:00
Nicolas Mowen
27d3676ba5
Fix rpi birdseye encode (#5522)
* Remove invalid bframe argument for rpi encoder

* Remove gop size arg as well
2023-02-16 18:38:32 -06:00
Nicolas Mowen
52459bf348
Update ffmpeg args with low risk improvements (#5519)
* Add threads 1 to input / output args

* Remove cuvid from hwaccel

* Update docs for new args

* Formatting
2023-02-16 15:44:10 -07:00
Nicolas Mowen
7b26935462
Ensure birdseye restream is not left with partially read frames (#5504)
* Ensure birdseye pipe does not get corrupted

* Fix conditionals

* Change log

* Formatting
2023-02-16 07:49:31 -06:00
Nicolas Mowen
1715e2e09d
Init birdseye restream command in S6 (#5494)
* remove restream from frigate logic

* Migrate birdseye stream definition to S6

* Cleanup

* Use consts to import as well
2023-02-15 07:09:25 -06:00
Nicolas Mowen
08ab9dedf7
Update ffmpeg_presets.py (#5462) 2023-02-12 08:02:40 -06:00
Nicolas Mowen
562e2627c2
Auto select gpu for hwaccel presets (#5406)
* Add ability to GPU device to be automatically detected when multiple exist

* Add logging info

* Fix access

* Fix

* Formatting

* Fix path of device

* Use log error instead of raise

* Remove log which could apply to other caess

* Set default value

* rework logic and support auto gpu selection for encoding gpu as well
2023-02-11 08:00:58 -06:00
Nicolas Mowen
88252e0ae6
Update ffmpeg_presets.py (#5433) 2023-02-08 21:27:43 -06:00
Blake Blackshear
e10ddb343c
additional shutdown optimizations (#5380) 2023-02-04 08:58:45 -06:00
Blake Blackshear
624c314335
Fast restart (#5378)
* dont wait so long for queues

* implement stop methods for comms

* set the detection events on exit and return early from processing

* handle the stop event in the broadcast threads

* short circuit the detection process exit code if it already exited

* some logging for stats thread

* just keep the log process alive 1 second after the last log message

* ensure the multiprocessing queues are emptied and closed

* Update frigate/log.py

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

* Update frigate/log.py

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

* mypy fixes

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-02-03 20:15:47 -06:00
Anil Ozyalcin
b33094207c
YOLOX support for OpenVINO Detector (#5285)
* Initial commit to enable Yolox models with OpenVINO in Frigate

* Fix ModelEnumtType import error in openvino.py

* Initial edit of the docs to include verbage about yolox

* Initial edit of the docs to include verbage about yolox

* Elaborate configuration and limitations in docs.

* Add capability to dynamically determine number of classes in yolox model

* Further refinements

* Removed unnecesarry comments, improved documentation, addressed PR items

* Fixed lint formatting issues
2023-02-03 19:36:37 -06:00
jvrobert
7083a5c9b6
Try to limit nvidia GPU queries to included GPUs (#5356)
* Try to limit nvidia GPU queries to included GPUs

* ignore non digit GPU indexes

* formatting

* Formatting

* Remove trailing spaces

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-02-03 19:34:07 -06:00
Nicolas Mowen
db131d4971
Add Low latency preset (#5367)
* Create new low latency preset

* Update chart for new preset
2023-02-03 19:33:25 -06:00
James L
8d21c950a3
Name capture processes (#5340) 2023-02-01 17:49:18 -06:00
Blake Blackshear
f06e8b47be
Docs updates, fix recording warnings, default log level for ws4py (#5294)
* set default log level for ws4py

* proactively cleanup cache in all retain modes

* docs updates

* typo

* fix link

* updates
2023-01-30 17:42:53 -06:00
Nicolas Mowen
7edeaa3407
Add warning for below suggested SHM calculation (#5312)
* Add warning for below suggested SHM calculation

* Remove debug check

* Make names more clear

* Fix

* fix log
2023-01-30 17:42:23 -06:00
Nicolas Mowen
88b903ba39
Restart ffmpeg if process exceeds detect fps by 10 (#5280)
* Restart ffmpeg if process exceeds detect fps by 10

* Update frigate/video.py

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* spelling

---------

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
2023-01-29 17:20:42 -06:00
Blake Blackshear
7130d93616
warn if unable to keep up with moving segments (#5264) 2023-01-27 07:32:55 -06:00
James L
11054daebe
System page: add last updated time ago (#5195) 2023-01-27 06:20:41 -06:00
Nicolas Mowen
7926ddd008
Clear file before unlinking (#5259) 2023-01-27 06:16:40 -06:00
Nicolas Mowen
a63dd9bccd
Add low delay args to restream input args (#5231) 2023-01-25 18:39:35 -06:00
James L
07c635d822
Add config option to disable version check (#5208)
* Add config option to disable version check

* Add note to docs
2023-01-25 18:36:26 -06:00
Felipe Santos
feeb7107d5
Fix Frigate stuck at finishing when restarting from UI (#5216) 2023-01-24 07:27:57 -06:00
Nicolas Mowen
f52de322d3
Set hard frame rate limit (#5210) 2023-01-24 07:27:07 -06:00
Nicolas Mowen
924f946e46
Fix birdseye snapshot (#5171) 2023-01-20 20:40:55 -06:00
Felipe Santos
02df2a8bbd
Refactor s6 scripts to the new format (#5135)
* Refator s6 scripts to the new format

* Remove unneeded workaround

* Migrate logging to new s6 format

* Remove more unnecessary s6 variables

* Fix prepare-log and when go2rtc is not present in config

* Restart the whole container if either Frigate or go2rtc fails

* D

* Fix service name in finish

* Fix nginx finish comment

* Restart improvements

* Fix devcontainer

* Fix format

* Update Dockerfile

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-01-18 07:53:53 -06:00
Nicolas Mowen
19afb035ff
Rewrite restream (#5106)
* Tear out restream config

* Rework birdseye restream

* Create go2rtc config handler

* Fix bug

* Write start script

* Rework style

* Fix python run syntax

* Output as json instead of yaml

* Put old live config back and fix birdseye references

* Fix camera webUI

* Add frigate env var subsitutions

* Fix webui checks

* Check keys

* Remove unused prest

* Fix tests

* Update restream docs

* Update restream docs

* Update live docs

* Update camera specific recommendation

* Update more docs

* add links for the docs

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* Update note about supported audio codecs

* Move restream to go2rtc

* Docs fixes

* Add verification of stream name

* Ensure that webUI uses camera name

* Update docs to reflect new live stream name

* Fix check

* Formatting

* Remove audio from detect

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* Fix docs

* Don't handle env variable substitution

* Add go2rtc version

* Clarify docs

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
2023-01-16 17:50:35 -06:00
Blake Blackshear
3bec28ffef
handle timezones with partial hour offsets (#5115)
* handle timezones with partial hour offsets

* cleanup
2023-01-16 17:17:03 -06:00
Nicolas Mowen
81b3fdb423
Pre clear retained messagse (#5117) 2023-01-16 17:16:46 -06:00
yeahme49
e39fb51dec
Add Save Only button to config editor (#5090)
* Add Save Only button to save config without restarting

* Fixes

* fix formatting

* change to query parameter from header

* lint fixes
2023-01-15 11:25:49 -06:00
Nicolas Mowen
367ac28a94
Fix qsv h265 (#5095) 2023-01-15 09:41:13 -06:00
Nicolas Mowen
99577a57e6
Add specific presets for restream and record with audio (#5094)
* Add more ffmpeg presets

* Update docs

* Update tests

* Update docs to optimize setup
2023-01-15 09:40:42 -06:00
Nicolas Mowen
01b9d4d848
Rework audio encoding for restream (#5092)
* Use memo for recordings timezone

* Add audio encoding field and simplify stream creation

* Update docs and tests

* Fix bad logic
2023-01-15 09:38:19 -06:00
Nate Meyer
60b2315028
Update library loading for tensorrt (#5087)
* Update library loading for tensorrt

* Add symlink to libnvrtc
2023-01-14 13:14:27 -06:00
Nicolas Mowen
e0b3b27b8a
Add option for live mode & timezone config, fix MSE check for iPad (#5079)
* Add config fields

* Clean up camera default values

* Set recordings timezone with config if available

* Adjust for timezone config

* Cleanup setting of the timezone

* Don't fail on MSE check iPad

* Fix MSE check for birdseye

* Add docs

* Fix test
2023-01-13 17:27:16 -06:00
James L
2031c3146f
System page: make clear if detect disabled (#5075) 2023-01-13 17:14:07 -06:00
Nicolas Mowen
2d76363da5
Catch FileNotFoundError when getting file system stats (#5056) 2023-01-13 07:22:47 -06:00
Nicolas Mowen
54bfa4679c
Simplify hwaccel filter args and fix qsv bugs (#5054)
* Simplify hwaccel filter args and fix qsv bugs

* Formatting

* Remove dead code

* Set framerate and size for rpi as well
2023-01-13 07:22:19 -06:00
Felipe Santos
95596b39fd
Capitalize the Frigate word (#5044) 2023-01-13 07:18:15 -06:00
Nicolas Mowen
cf2466c8c1
Fix recordings storage (#5031)
* Fix recordings storage

* Update record.py

* Update record.py

* Formatting
2023-01-12 05:53:38 -06:00
James L
ddcae2d4aa
Fix mem usage reporting when using docker limits (#5011)
* Fix mem usage reporting when using docker limits

* format code

* wip
2023-01-11 17:39:26 -06:00
sergeknystautas
731db8fb8f
Add in_progress parameter to /api/events to filter the results. (#5013)
* Add in_progress parameter to /api/events to filter the results.

* Change in_progress to default to no filtering, 0 means no in progress, 1 means only in progress.

* Fix code format with black.

* Clear blank line.
2023-01-11 17:22:39 -06:00
Nicolas Mowen
cb0c5c2587
Disable backchannel audio since it is not used (#5021)
* Disable backchannel audio since it is not used

* Don't need to block bachchannel audio for ffmpeg streams

* Formatting
2023-01-11 17:21:48 -06:00
Nicolas Mowen
ddde477770
Use scale_qsv and don't apply deinterlacing (#4997) 2023-01-11 06:11:26 -06:00
Nicolas Mowen
d49359e26a
Fix None filter for sub labels (#4981) 2023-01-09 19:44:26 -06:00
Nicolas Mowen
e79eab711a
Fix RPi preset (#4968) 2023-01-08 20:58:06 -06:00
Nicolas Mowen
61243ad34b
Make error messages for gpu stats more clear (#4962)
* Make error messages for gpu stats more clear

* Make error messages for gpu stats more clear
2023-01-08 14:00:46 -06:00
Blake Blackshear
1f963ec5aa
Fix raspberry pi hwaccel (#4955)
* use ffmpeg from raspbian repo

* dynamically choose timeout param

* invert logic

* Add hwaccel presets for rpi

Co-authored-by: Nick Mowen <nickmowen213@gmail.com>
2023-01-08 07:04:58 -06:00
Pierre Belanger
bcbf0061ff
Support for dynamic MQTT user configuration #4883 (#4956)
* Support for dynamic MQTT user configuration #4883

* Fix substitute condition & docs
2023-01-07 17:10:48 -06:00
Nicolas Mowen
57dce4ec38
Make label colors consistent (#4951) 2023-01-07 12:05:11 -06:00
Pavels Veretennikovs
47ac5ed522
fix: preset-http-jpeg-generic reference (#4946) 2023-01-07 07:21:18 -06:00
Nicolas Mowen
543cad5497
Only set colors for enabled objects (#4936)
* Only create colormap for enabled labels

* Fix assigning
2023-01-06 19:31:54 -06:00
Nicolas Mowen
d9c45a76fe
Don't recheck erroring hwaccel in http either (#4935)
* Don't recheck erroring hwaccel in http either

* Send error instead of empty for known erroring hwaccel

* Formatting
2023-01-06 19:31:25 -06:00
Nate Meyer
8ac3114f9a
Cleanup Detector labelmap (#4932)
* Add missing labels to default labelmap.  Fill any holes with "unknown".  Remove unique labelmap for tensorrt.

* Replace "truck" with "car" on Openvino labelmap
2023-01-06 07:03:16 -06:00
Nicolas Mowen
9ee367d9e9
Fix Other Stats Access Too (#4917) 2023-01-06 06:51:58 -06:00
Nicolas Mowen
64ab6580dc
Send blank hwaccel-error cache so logs will show when loading the stats page manually (#4912) 2023-01-05 06:27:57 -06:00
Nicolas Mowen
0a3295aa5c
Rewrite encoding logic and cleanup vaapi presets (#4898)
* Remove duplicated vaapi presets

* Move encoding to string with inputs and outputs

* Formatting

* Fix formatting

* Fix typo

* Remove vaapi encoder
2023-01-04 18:16:11 -06:00
Nicolas Mowen
ffa98a138b
Don't keep attempting gpu usage stats after failure (#4904)
* Don't log intel gpu top errors

* Keep list of errored hwaccel and don't send again

* Can log on first time

* Formatting & mypy
2023-01-04 18:12:51 -06:00
Rob-Powell
9fd13aad11
check stream specific hwaccel_args for gpu stats (#4869)
* check stream specific hwaccel_args for gpu stats

* fix indentation

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

* check special chars for linter

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-01-04 07:37:42 -06:00
Nicolas Mowen
d547680116
Only replace topic (#4884) 2023-01-03 19:25:15 -06:00
Nicolas Mowen
bc5aa1141a
Set host as blank by default (#4880) 2023-01-03 19:24:53 -06:00
Nicolas Mowen
ea7d1aabba
Ability to set different codec for restream and use go2rtc hardware (#4876)
* Add video codec to restream config

* Add handling of encode engine and video codec

* Add test for video encoding

* Set in main configuration docs as well

* Add example to restream docs

* Put back patch
2023-01-03 19:24:34 -06:00
Nicolas Mowen
ceab294840
Catch case where args are a string but not preset (#4864)
* Catch case where args are a string but not preset

* Fix formatting
2023-01-02 18:32:12 -06:00
Nicolas Mowen
abc40f2581
only return stderr if return code is not 0 (#4863) 2023-01-02 17:31:59 -06:00
Nicolas Mowen
cee52e9cfd
Remove vaapi interlace which caused fps to be higher than specified (#4843) 2023-01-01 13:41:27 -06:00
spacebares
f4991b46f8
[API] filter for favorite events (#4737)
* [API] filter for favorite events

*  Added /api/events filter for favorite (retain_indefinitely) events

* New Star button to filter for favorite events on the Events page

* fix python formatting

* keep Events favorite button to right side
2022-12-31 08:56:30 -06:00
Nicolas Mowen
ff56262c6e
Add ability to restream birdseye (#4761)
* Try using RTSP for restream

* Add ability to get snapshot of birdseye when birdseye restream is enabled

* Write to pipe instead of encoding mpeg1

* Write to cache instead

* Use const for location

* Formatting

* Add hardware encoding for birdseye based on ffmpeg preset

* Provide framerate

* Adjust args

* Fix order

* Delete pipe file if it exists

* Cleanup spacing

* Fix spacing
2022-12-31 08:54:10 -06:00
Nicolas Mowen
da1b7c2e28
Fix handling of timezones (#4831) 2022-12-30 17:51:13 -06:00
Nicolas Mowen
d6731b17a4
Add hardware accelerated scaling when using ffmpeg hwaccel presets (#4804)
* Use hardware accelerated scaling when hwaccel preset is set

* Set output types

* Add tests for scale, fix bugs

* Need to copy specific scale too
2022-12-30 10:56:52 -06:00
Nate Meyer
3f05f74ecb
Nvidia TensorRT detector (#4718)
* Initial WIP dockerfile and scripts to add tensorrt support

* Add tensorRT detector

* WIP attempt to install TensorRT 8.5

* Updates to detector for cuda python library

* TensorRT Cuda library rework WIP

Does not run

* Fixes from rebase to detector factory

* Fix parsing output memory pointer

* Handle TensorRT logs with the python logger

* Use non-async interface and convert input data to float32. Detection runs without error.

* Make TensorRT a separate build from the base Frigate image.

* Add script and documentation for generating TRT Models

* Add support for TensorRT devcontainer

* Add labelmap to trt model script and docs.  Cleanup of old scripts.

* Update detect to normalize input tensor using model input type

* Add config for selecting GPU. Fix Async inference. Update documentation.

* Update some CUDA libraries to clean up version warning

* Add CI stage to build TensorRT tag

* Add note in docs for image tag and model support
2022-12-30 10:53:17 -06:00
Jonathan Zhang
ffd637cc0c
fix: handle multi-word timezones (#4816) 2022-12-30 08:34:01 -06:00
Nicolas Mowen
369299315f
Optimize nginx & recordings (#4688)
* Add segment duration metadata

* Use faststart only for kept segments

* Add more options for performance

* Build nginx locally

* Build nginx in dockerfile and enable threaded vod handling

* Use DASH instead of hls

* Allow player to continue on error

* Undo DASH change

* Fix typo

* Correct log

* Fix bad comments

* Fix indentation

* Preload stream

* remove unused

* Fix spacing

* Fix tabs / sspaces

* Retab

* More cleanup
2022-12-17 17:53:34 -06:00
Felipe Santos
9b99ba81e5
Use presets by default (#4597) 2022-12-16 07:41:03 -06:00
Dennis George
420bcd7aa0
Convert detectors to factory pattern, ability to set different model for each detector (#4635)
* refactor detectors

* move create_detector and DetectorTypeEnum

* fixed code formatting

* add detector model config models

* fix detector unit tests

* adjust SharedMemory size to largest detector model shape

* fix detector model config defaults

* enable auto-discovery of detectors

* simplify config

* simplify config changes further

* update detectors docs; detect detector configs dynamic

* add suggested changes

* remove custom detector doc

* fix grammar, adjust device defaults
2022-12-15 07:12:52 -06:00
Nicolas Mowen
43c2761308
System page improvements (#4707)
* Catch case where camera is disabled

* Add ffprobe timeout and catch case where camera is disabled
2022-12-14 17:20:47 -06:00
Nicolas Mowen
b1ec56de29
Add multiselect filtering to events view (#3367) 2022-12-12 06:30:34 -06:00
Nicolas Mowen
037f3761e7
Use UTC for recordings (#4656)
* Write files in UTC and update folder structure to not conflict

* Add timezone arg for events summary

* Fixes for timezone in calls

* Use timezone for recording and recordings summary endpoints

* Fix sqlite parsing

* Fix sqlite parsing

* Fix recordings summary with timezone

* Fix

* Formatting

* Add pytz

* Fix default timezone

* Add note about times being displayed in localtime

* Improve timezone wording and show actual timezone

* Add alternate endpoint to cover existing usecase to avoid breaking change

* Formatting
2022-12-11 07:45:32 -06:00
Nicolas Mowen
739a267462
Don't catch presets (#4653) 2022-12-09 08:35:28 -06:00
Nicolas Mowen
cd9f6b074e
Restart record process if segments stop being written. (#4604)
* Catch when recording segments are not being written to cache and restart ffmpeg responsible for record

* Ensure this check is only run for role with record

* Fix formatting

* Redo recordings validator to watch segments time and restart if no segment for 30 seconds

* Formatting

* Increase wait time to 120 seconds and improve error message

* Add more config checks for record args and add test

* Formatting

* Specify output args.
2022-12-08 20:03:54 -07:00
Nicolas Mowen
964bcc0733
Logs in UI (#4562)
* Log all services to RAM

* Gracefully handle shutdown

* Add logs route

* Remove tail

* Return logs for services

* Display log chooser with copy button

* show logs for specific services

* Clean up settings logs

* Add copy functionality to logs

* Add copy functionality to logs

* Fix merge

* Set archive count to 0

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
2022-12-08 20:15:00 -06:00
Nicolas Mowen
4f79ca1bf0
Fix ffprobe with special characters (#4646)
* Clean path from scpecial characters before running ffprobe

* Fix camera paths
2022-12-08 19:02:11 -06:00
Nicolas Mowen
bc52fc1e79
Fix end events for mqtt (#4647) 2022-12-08 19:00:44 -06:00
Nicolas Mowen
7888059c9f
Add config editor to webUI (#4608)
* Add raw config endpoint

* Add config editor

* Add code editor

* Add error

* Add ability to copy config

* Only show the save button when code has been edited

* Update errors

* Remove debug config from system page

* Break out config saving steps to pinpoint where error occurred.

* Show correct config errors

* Switch to monaco editor

* Adjust UI colors and behavior

* Get yaml validation working

* Set success color
2022-12-07 07:36:56 -06:00
Felipe Santos
87e2810725
Do not apply -user_agent for rtmp streams (#4596) 2022-12-04 09:46:03 -06:00
Nicolas Mowen
007fa75294
Fix intel gpu stats (#4581)
* Fix return code for timeout call

* Rewrit intel gpu logic

* Fix test and output
2022-12-03 10:28:01 -06:00
Nate Meyer
e5fe323aca
Add OpenVino Detector (#3768)
* Initial work for adding OpenVino detector.  Not functional

* Load model and submit for inference.

Sucessfully load model and initialize OpenVino engine with either CPU or GPU as device.
Does not parse results for objects.

* Detection working with ssdlite_mobilenetv2 FP16 model

* Add OpenVIno support and model to docker image

* Add documentation for OpenVino detector configuration

* Adds support for ARM32/ARM64 and the Myriad X hardware

-  Use custom-built openvino wheel for all platforms
-  Add libusb build without udev for NCS2 support

* Add documentation around Intel CPU requirements and NCS2 setup

* Print all available output tensors

* Update documentation for config parameters
2022-12-03 10:19:34 -06:00
Felipe Santos
4523c9b06d
Set User Agent for FFmpeg calls (#4555)
* Set User Agent for FFmpeg calls

* Allow to use shell-like string args

* Add test for arg as string with space
2022-11-30 16:53:45 -06:00
Nicolas Mowen
5ad391977e
FEAT: Storage API & Frontend (#3409)
* Get storage output stats for each camera

* Add storage route

* Add storage route

* Add storage page

* Cleanup

* Add stats and show more storage

* Add tests for mb abbrev util fun

* Rewrite storage logic to use storage maintainer and segment sizes

* Include storage maintainer for http

* Use correct format

* Remove utils

* Fix tests

* Remove total from equation

* Multiply by 100 to get percent

* Add basic storage info

* Fix storage stats

* Fix endpoint and ui

* Fix formatting
2022-11-29 19:59:56 -06:00
Nicolas Mowen
25a7c4ee81
Fix gpu stats for ffmpeg presets (#4554) 2022-11-29 19:56:01 -06:00
Nicolas Mowen
87144cd572
FEAT: Support for ffmpeg presets (#3840)
* Add hwaccel presets

* Use hwaccel presets

* Add input arg presets

* Use input arg presets

* Make util to clean up redundant code

* Add support for output arg presets

* Add tests

* Update camera specific to use presets

* Update hwaccel to use presets

* Format files and fix tests

* Rewrite tests to test record correctly

* Move presets from string to list to avoid manually separating into a list

* Add mjpeg cuvid decoder preset

* Fix tests

* Fix comment
2022-11-28 21:48:11 -06:00
Nicolas Mowen
69560c8bde
Replace green screen with error message and force camera_fps to 0 (#4544)
* Move to images specific folder

* Send error image when camera stream is not available

* Immediately set camera_fps to 0 if camera crashes

* Cache error image so it is not read from file system on each run

* Move camera fps set
2022-11-28 21:47:20 -06:00
Nicolas Mowen
aaedd24f37
Add GPU stats to the /stats API and debug screen (#3931)
* Add ffprobe endpoint

* Get ffprobe for multiple inputs

* Copy ffprobe in output

* Fix bad if statement

* Return full output of ffprobe process

* Return full output of ffprobe process

* Make ffprobe button show dialog with output and option to copy

* Add driver names to consts

* Add driver env var name

* Setup general tracking for GPU stats

* Catch RPi args as well

* Add util to get radeontop results

* Add real amd GPU stats

* Fix missed arg

* pass config

* Use only the values

* Fix vram

* Add nvidia gpu stats

* Use nvidia stats

* Add chart for gpu stats

* Format AMD with space between percent

* Get correct nvidia %

* Start to add support for intel GPU stats

* Block out RPi as util is not currently available

* Formatting

* Fix mypy

* Strip for float conversion

* Strip for float conversion

* Fix percent formatting

* Remove name from gpu map

* Add tests and fix AMD formatting

* Add nvidia gpu stats test

* Formatting

* Add intel_gpu_top for testing

* Formatting

* Handle case where hwaccel is not setup

* Formatting

* Check to remove none

* Don't use set

* Cleanup and fix types

* Handle case where args is list

* Fix mypy

* Cast to str

* Fix type checking

* Return none instead of empty

* Fix organization

* Make keys consistent

* Make gpu match style

* Get support for vainfo

* Add vainfo endpoint

* Set vainfo output in error correctly

* Remove duplicate function

* Fix errors

* Do cpu & gpu work asynchonously

* Fix async

* Fix event loop

* Fix crash

* Fix naming

* Send empty data for gpu if error occurs

* Show error if gpu stats could not be retrieved

* Fix mypy

* Fix test

* Don't use json for vainfo

* Fix cross references

* Strip unicode still

* await vainfo response

* Add gpu deps

* Formatting

* remove comments

* Use empty string

* Add vainfo back in
2022-11-28 19:24:20 -06:00
Nicolas Mowen
3cb6d43fac
Fix recordings set name (#4543) 2022-11-28 18:58:41 -06:00
Nicolas Mowen
68248cc274
Clean http password, clean path in debug config as well (#4519)
* Clean ffmpeg paths

* Clean http passwords too

* Make check optional
2022-11-26 19:18:33 -06:00
Blake Blackshear
047c2408d2
fix support for yuv models (#4523) 2022-11-26 19:15:47 -06:00
Nicolas Mowen
91982c4f7e
Remove topic prefix (#4515) 2022-11-25 20:10:09 -06:00
Nicolas Mowen
4e5512e35d
Fix stats prefix (#4505) 2022-11-24 20:12:43 -06:00
Nicolas Mowen
6c0978498d
Abstract MQTT from communication and make mqtt optional (#4462)
* Add option for mqtt config

* Setup communication layer

* Have a dispatcher which is responsible for handling and sending messages

* Move mqtt to communication

* Separate ws communications module

* Make ws client conform to communicator

* Cleanup imports

* Migrate to new dispatcher

* Clean up

* Need to set topic prefix

* Remove references to mqtt in dispatcher

* Don't start mqtt until dispatcher is subscribed

* Cleanup

* Shorten package

* Formatting

* Remove unused

* Cleanup

* Rename mqtt to ws on web

* Fix ws mypy

* Fix mypy

* Reformat

* Cleanup if/else chain

* Catch bad set commands
2022-11-23 20:03:20 -06:00
Nicolas Mowen
ebdf36e0b9
Refactor mqtt to handle reconnects and not cause frigate to stop. (#4440)
* Refactor mqtt client

* Protect callback method

* Use async to handle reconnects

* Set types and clenup

* Don't set connected until rc code is checked
2022-11-20 07:36:01 -06:00
herostrat
2e81c94d8e
Typing Part 3: events.py (#3352)
* Typing: events.py

* Remove unused variable

* Fix return Any from return statement

Not all elements from the event dict are sure to be something that can be evaluated

See e.g.: https://github.com/python/mypy/issues/5697

* Sort out Event disambiguity

There was a name collision of multiprocessing Event type and frigate events

Co-authored-by: Sebastian Englbrecht <sebastian.englbrecht@kabelmail.de>
2022-11-19 07:16:33 -06:00
Nicolas Mowen
a04fa105ef
Fix internal restream error and add docs for reducing camera connections (#4431)
* Start restream before detection

* Add docs explaining how to reduce connections to the camera

* Fix typos for consistency

* Add link to other part of doc for readability
2022-11-19 07:15:20 -06:00
Nicolas Mowen
4eb3e98076
Update go2rtc, simplify manual stream, and support audio for MSE & WebRTC (#4391)
* Update go2rtc to rc3

* Simplify ffmpeg / audio conversions

* Set ffmpeg bin location

* Manually set video as copied

* Run go2rtc with env vars

* Remove manual ffmpeg declaration

* Enable force_audio by default

* Fix test
2022-11-16 06:29:47 -06:00
Nicolas Mowen
c97aac6c94
Revamped debug UI and add camera / process info, ffprobe copying (#4349)
* Move each camera to a separate card and show per process info

* Install top

* Add support for cpu usage stats

* Use cpu usage stats in debug

* Increase number of runs to ensure good results

* Add ffprobe endpoint

* Get ffprobe for multiple inputs

* Copy ffprobe in output

* Add fps to camera metrics

* Fix lint errors

* Update stats config

* Add ffmpeg pid

* Use grid display so more cameras can take less vertical space

* Fix hanging characters

* Only show the current detector

* Fix bad if statement

* Return full output of ffprobe process

* Return full output of ffprobe process

* Don't specify rtsp_transport

* Make ffprobe button show dialog with output and option to copy

* Adjust ffprobe api to take paths directly

* Add docs for ffprobe api
2022-11-13 12:48:14 -06:00
Nicolas Mowen
9e31873520
More config checks (#4310)
* Move existing checks to own functions

* Add config check for zone objects that are not tracked

* Add tests for config error

* Formatting

* Catch case where field is defined multiple times and add test

* Add warning for rtmp
2022-11-08 19:47:45 -06:00
Nate Meyer
40cb5102b0
Support more special chars in camera passwords (#4259)
* Support more special chars in camera passwords

* End password test with double @ chars

* Escape passwords in paths for go2rtc

* Fixes for formatting
2022-11-05 21:42:32 -05:00
Nate Meyer
4383b883c0
Refactor to simplify support for additional detector types (#3656)
* Refactor EdgeTPU and CPU model handling to detector submodules.

* Fix selecting the correct detection device type from the config

* Remove detector type check when creating ObjectDetectProcess

* Fixes after rebasing to 0.11

* Add init file to detector folder

* Rename to detect_api

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

* Add unit test for LocalObjectDetector class

* Add configuration for model inputs
Support transforming detection regions to RGB or BGR.
Support specifying the input tensor shape.  The tensor shape has a standard format ["BHWC"] when handed to the detector, but can be transformed in the detector to match the model shape using the model  input_tensor config.

* Add documentation for new model config parameters

* Add input tensor transpose to LocalObjectDetector

* Change the model input tensor config to use an enumeration

* Updates for model config documentation

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2022-11-03 21:23:09 -05:00
Nicolas Mowen
1bc9efd529
Support special characters in passwords, redacted logs & debug config (#4057)
* Consts for regex

* Add regex for camera username and password

* Redact user:pass from ffmpeg logs

* Redact ffmpeg commands

* Move common function to util

* Add tests

* Formatting

* Remove unused imports

* Fix test

* Add port to test

* Support special characters in passwords

* Add tests for special character handling

* Remove docs about not supporting special characters
2022-11-02 07:00:54 -05:00
banthungprong
8163afce79
Allow cameras to be disabled in config (#4162)
* add option enabled for each camera in config

* Simplified If-block and removed wrong Optional

* Update Docs enabling/disabling camera in config

* correct format for option

* Disabling Camera for processes, no config changes

* Describe effects of disabled cam in documentation

* change if-logic, obsolete copy, info disabled cam

* changed color to white, added top padding in disabled camera info

* changed indentation
2022-11-02 06:41:44 -05:00
Nicolas Mowen
2a36a1b980
Catch case where segment is bad length (#4228)
* Catch case where segment is bad length

* Log ffprobe error code and error
2022-11-02 06:37:27 -05:00
Nicolas Mowen
d8123d2497
Add go2rtc and add restream role / live source (#4082)
* Pull go2rtc dependency

* Add go2rtc to local services and add to s6

* Add relay controller for go2rtc

* Add restream role

* Add restream role

* Add restream to nginx

* Add camera live source config

* Disable RTMP by default and use restream

* Use go2rtc for camera config

* Fix go2rtc move

* Start restream on frigate start

* Send restream to camera level

* Fix restream

* Make sure jsmpeg works as expected

* Make view rspect live size config

* Tweak player options to fit live view

* Adjust VideoPlayer to accept live option which disables irrelevant controls

* Add multiple options from restream live view

* Add base for webrtc option

* Setup specific restream modules

* Make mp4 the default streaming for now

* Expose 8554 for rtsp relay from go2rtc

* Formatting

* Update docs to suggest new restream method.

* Update docs to reflect restream role

* Update docs to reflect restream role

* Add webrtc player

* Improvements to webRTC

* Support webrtc

* Cleanup

* Adjust rtmp test and add restream test

* Fix tests

* Add restream tests

* Add live view docs and show different options

* Small docs tweak

* Support all stream types

* Update to beta 9 of go2rtc

* Formatting

* Make jsmpeg the default

* Support wss if made from https

* Support wss if made from https

* Use onEffect

* Set url outside onEffect

* Fix passed deps

* Update docs about required host mode

* Try memo instead

* Close websocket on changing camera

* Formatting

* Close pc connection

* Set video source to null on cleanup

* Use full path since go2rtc can't see PATH var

* Adjust audio codec to enable browser audio by default

* Cleanup stream creation

* Add restream tests

* Format tests

* Mock requests

* Adjust paths

* Move stream configs to restream

* Remove live source

* Remove live config

* Use live persistence for which view to use on each camera

* Fix live sizes

* Only use jsmpeg sizes for jsmpeg live

* Set max live size

* Remove access of live config

* Add selector for live view source in web view

* Remove RTMP from default list of roles

* Update docs

* Fix tests

* Fix docs for live view modes

* make default undefined to avoid race condition

* Wait until camera source is loaded to avoid race condition

* Fix tests

* Add config to go2rtc

* Work with config

* Set full path for config

* Set to use stun

* Check for mounted file

* Look for frigate-go2rtc

* Update docs to reflect webRTC configuration.

* Add link to go2rtc config

* Update docs to be more clear

* Update docs to be more clear

* Update format

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* Update live docs

* Improve bash startup script

* Add option to force audio compatibility

* Formatting

* Fix mapping

* Fix broken link

* Update go2rtc version

* Get go2rtc webui working

* Add support for mse

* Remove mp4 option

* Undo changes to video player

* Update docs for new live view options

* Make separate path for mse

* Remove unused

* Remove mp4 path

* Try to get go2rtc proxy working

* Try to get go2rtc proxy working

* Remove unused callback

* Allow websocket on restrea dashboard

* Make mse default stream option

* Fix mse sizing

* don't assume roles is defined

* Remove nginx mapping to go2rtc ui

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2022-11-02 06:36:09 -05:00
Nicolas Mowen
b4d4adb75b
Limit recording retention to available storage (#3942)
* Add field and migration for segment size

* Store the segment size in db

* Add comment

* Add default

* Fix size parsing

* Include segment size in recordings endpoint

* Start adding storage maintainer

* Add storage maintainer and calculate average sizes

* Update comment

* Store segment and hour avg sizes per camera

* Formatting

* Keep track of total segment and hour averages

* Remove unused files

* Cleanup 2 hours of recordings at a time

* Formatting

* Fix bug

* Round segment size

* Cleanup some comments

* Handle case where segments are not deleted on initial run or is only retained segments

* Improve cleanup log

* Formatting

* Fix typo and improve logging

* Catch case where no recordings exist for camera

* Specifically define sort

* Handle edge case for cameras that only record part time

* Increase definition of part time recorder

* Remove warning about not supported storage based retention

* Add note about storage based retention to recording docs

* Add tests for storage maintenance calculation and cleanup

* Format tests

* Don't run for a camera with no recording segments

* Get size of file from cache

* Rework camera stats to be more efficient

* Remove total and other inefficencies

* Rewrite storage cleanup logic to be much more efficient

* Fix existing tests

* Fix bugs from tests

* Add another test

* Improve logging

* Formatting

* Set back correct loop time

* Update name

* Update comment

* Only include segments that have a nonzero size

* Catch case where camera has 0 nonzero segment durations

* Add test to cover zero bandwidth migration case

* Fix test

* Incorrect boolean logic

* Formatting

* Explicity re-define iterator
2022-10-09 06:28:26 -05:00
Nicolas Mowen
66dc8c772b
Remove snapshot requirement for thumbnail event query (#4039) 2022-10-07 21:13:15 -05:00
Nicolas Mowen
65c211bb6d
Catch ffprobe empty stdout (#4016) 2022-10-04 19:56:04 -05:00
Nicolas Mowen
60ad38261b
Fix sub label access (#4015)
* Fix access

* Formatting
2022-10-04 18:49:37 -05:00
Blake Blackshear
8669c29e3d
don't overwrite segments that already exist (#3995) 2022-10-01 18:11:29 -05:00
Nicolas Mowen
f0e836e5b6
Update MQTT along with enabling motion detection (#3898) 2022-10-01 09:01:43 -05:00
Nicolas Mowen
a1ae5b67d8
Mqtt sub labels (#3899)
* Set sub label on object data if event is in progress

* Include sub_label in dict

* Don't need to set and passively get

* Formatting

* Don't expect event to be valid

* Update docs to reflect that sub label is included
2022-10-01 09:00:56 -05:00
Nicolas Mowen
53f7190d42
Set a timeout on github release check (#3969)
* Set a timeout on github release check

* Formatting
2022-10-01 08:58:23 -05:00
Nicolas Mowen
df40b96b44
BUG: Fixes and cleanup around region / bounding box calculation (#3879)
* -1 so ensure indexes are correct

* Catch case of zero division

* Due to the -1, it may be negative

* Ignore source of error

The error is occurring due to a detections bounding box starting beyond the frame, this should be immediately ignored

* Formatting

* Check horizontal placement as well

* Remove original frame clamping
2022-09-22 08:07:16 -05:00
Nick Mowen
1bc8d94312 Fix edge of frame after region adjustments 2022-09-15 06:33:32 -05:00
Nick Mowen
7e9f913ff6 Fix edge case where browser sends multiple requests to download file. 2022-09-15 06:32:54 -05:00
uvjustin
9df415b3f2
Fix VOD issues with longer keyframe intervals (#3671)
* Fix VOD issues with longer keyframe intervals

* Move probe function to util
Update comment

* Use recording duration for keyFrameDurations

* Remove unused early return

* Avoid clipping first clip
2022-08-26 06:32:34 -05:00
uvjustin
8c45dab9b8
Handle spaces in labels (#3679)
* Unquote label in flask routes
Encode label in Camera.jsx

* Don't use preprocessor

* Update nginx location for cacheable images
2022-08-25 07:32:30 -05:00