Commit Graph

942 Commits

Author SHA1 Message Date
Nicolas Mowen
fd6eb78f41
Birdseye Autolayout (#6734)
* Calculate possible layout

* Working in ideal conditions

* Fix issues with different heights

* Remove logs

* Optimally handle cameras that don't match the canvas aspect ratio

* Make sure to copy so list is not overwritten

* Remove unused import

* Remove try catch

* Optimize layout for low amount of cameras

* Try to scale frames up if not enough space is used
2023-06-11 07:54:18 -05:00
Sergey Krashevich
8d941e5e26
Add function to get physical interfaces for bandwidth calculation (#6618)
* Add function to get physical interfaces for bandwidth calculation in get_bandwidth_stats() function

* Add telemetry configuration option for enabled network interfaces, with default values for monitoring bandwidth stats for camera ffmpeg processes, go2rtc, and object detectors. Also add support for FrigateConfig in set_bandwidth_stats function to get bandwidth stats for specified network interfaces
2023-06-11 07:34:03 -05:00
Nicolas Mowen
8bc76d19db
DB Optimizations (#6712)
* Enable auto vacuums

* Enable auto vacuum

* Fix separator

* Fix separator and remove incorrect log

* Limit to 1 row since that is all that is used

* Add index on camera + segment_size

* Formatting

* Increase timeout and cache_size

* Set DB mode to NORMAL synchronous level

* Formatting

* Vacuum every 2 weeks

* Remove fstring

* Use string

* Use consts
2023-06-11 07:23:18 -05:00
Nicolas Mowen
435d152423
Fix bug introduced in new linter (#6754)
* Fix bug introduced in new linter

* Ignore this error

* Fix more

* Ignore boolean error too
2023-06-11 07:18:47 -05:00
Nicolas Mowen
d3949eebfa
Add API and WebUI to export recordings (#6550)
* Add ability to export frigate clips

* Add http endpoint

* Add dir to nginx

* Add webUI

* Formatting

* Cleanup unused

* Optimize timelapse

* Fix pts

* Use JSON body for params

* Use hwaccel to encode when available

* Print ffmpeg command when fail

* Print ffmpeg command when fail

* Add separate ffmpeg preset for timelapse

* Add docs outlining the export directory

* Add export docs

* Use ''

* Fix playlist max time

* Lower max playlist time

* Add api docs for export

* isort fixes
2023-06-08 07:32:35 -04:00
Nicolas Mowen
62f36b221e
Remove ffmpeg banner (#6600)
* Hide banner in maintainer

* Hide banner in event download
2023-06-01 05:46:34 -05:00
Blake Blackshear
ae0aba44dc
Improve tracking (#6516) 2023-05-31 08:12:43 -06:00
Martin Weinelt
ab50d0b006
Add isort and ruff linter (#6575)
* Add isort and ruff linter

Both linters are pretty common among modern python code bases.

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

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

Removes the pylint dev requirement, since ruff replaces it.

* treewide: fix issues detected by ruff

* treewide: fix bare except clauses

* .devcontainer: Set up isort

* treewide: optimize imports

* treewide: apply black

* treewide: make regex patterns raw strings

This is necessary for escape sequences to be properly recognized.
2023-05-29 05:31:17 -05:00
Martin Weinelt
1e17dbaa91
deepstack: pass api key in request (#6579)
The POST data was prepared, but not passed into the request call.
2023-05-23 17:32:08 -05:00
Nicolas Mowen
f66ccb04f6
Fix pydantic (#6584) 2023-05-23 08:00:21 -06:00
Sergey Krashevich
11738110dc
Add handling for non-existent or empty model file paths (#6525)
* Add handling for non-existent or empty model file paths in `compute_model_hash()` method

* Remove print() in detector_config.py

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

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-05-21 08:29:57 -05:00
Nicolas Mowen
4940826011
Fix false positives (#6544) 2023-05-19 13:26:19 -06:00
Nicolas Mowen
fec1dd3f46
Fix breakages by manual_event_api branch (#6542)
* Fix breakages by manual_event_api branch

* More fixes
2023-05-19 10:59:24 -06:00
Blake Blackshear
42f3ee3de5 sync master 2023-05-19 05:47:49 -05:00
Nicolas Mowen
e357715a8c
Ability to manually create events through the API (#3184)
* Move to events package

* Improve handling of external events

* Handle external events in the event queue

* Pass in event processor

* Check event json

* Fix json parsing and change defaults

* Fix snapshot saving

* Hide % score when not available

* Correct docs and add json example

* Save event png db

* Adjust image

* Formatting

* Add catch for failure ending event

* Add init to modules

* Fix naming

* Formatting

* Fix http creation

* fix test

* Change to PUT and include response in docs

* Add ability to set bounding box locations in snapshot

* Support multiple box annotations

* Cleanup docs example response

Co-authored-by: Blake Blackshear <blake@frigate.video>

* Cleanup docs wording

Co-authored-by: Blake Blackshear <blake@frigate.video>

* Store full frame for thumbnail

* Formatting

* Set thumbnail height to 175

* Formatting

---------

Co-authored-by: Blake Blackshear <blake@frigate.video>
2023-05-19 05:16:11 -05:00
Sergey Krashevich
6d0c2ec5c8
Add go2rtc & remote detectors network bandwidth usage to System table (#6526)
* Add network bandwidth usage to System table display in System.jsx and update get_bandwidth_stats function in util.py to include go2rtc processes

* black...

* Add network bandwidth usage to system table in web UI and improve regex in get_bandwidth_stats function to include frigate detector processes

* black...

* Update bandwidth calculation to include both incoming and outgoing traffic

* black:(
2023-05-18 06:40:24 -05:00
Korneliusz Jarzębski
17e8a46c7d
add ffmpeg bandwidth stats (#6492)
* add ffmpeg bandwidth stats

* add ffmpeg bandwidth stats

* Change column name

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

* fix lint formatting

---------

Co-authored-by: Korneliusz Jarzębski <k.jarzebski@netverse.pl>
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-05-17 20:01:56 -05:00
Nicolas Mowen
b568a29fa8
Don't fail if camera does not support presets (#6497) 2023-05-17 07:42:56 -05:00
Sergey Krashevich
b4038821cc
Update DeepStack detector to set width and height from input image size (#6429) 2023-05-17 07:40:41 -05:00
Sergey Krashevich
5fb96c777a
Add cmdline information to CPU usage stats in get_cpu_stats() function and display it in the System page's ffmpeg table with a copy-to-clipboard button (#6430) 2023-05-15 07:39:03 -05:00
Sergey Krashevich
181b53a55d
Fix error in parsing DeepStack response JSON and handle cases where predictions field is missing (#6463) 2023-05-15 07:37:34 -05:00
Nicolas Mowen
5951a740d2
Prevent recordings from being turned on if disabled in config (#6444)
* Prevent enabling recordings if not enabled in config

* Fix conflict

* Fix spacing

* Update wording

* Update wording

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-05-15 07:36:26 -05:00
Sergey Krashevich
ede1dedbbd
Add Deepstack/CodeProject-AI.Server detector plugin (#6143)
* Add Deepstack detector plugin with configurable API URL, timeout, and API key

* Update DeepStack plugin to recognize 'truck' as 'car' for label indexing

* Add debug logging to DeepStack plugin for better monitoring and troubleshooting

* Refactor DeepStack label loading from file to use merged labelmap

* Black format

* add documentation draft

* fix link to codeproject website

* Apply suggestions from code review

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

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-05-04 18:06:07 -05:00
Sergey Krashevich
0fcfcb85ab
Implement NVML for NVIDIA GPU Stats (#6359)
* nvml

* black...black...black...

* small fix for avoid errors on strange GPUs and old drivers

* fix type errors

* fix type errors

* fix unittest process crash

where the tests for tests?..

* it's impossible to mock low-level library

* fix double % for other GPU types

* remove space before gpu statistic values
2023-05-04 18:02:01 -05:00
Sergey Krashevich
03b45c153b
Increase maximum event sub_label length to 100 characters (#6350)
* Increase maximum sub label length to 100 characters and update corresponding fields in models and API

* black format...
2023-05-04 17:59:44 -05:00
Sergey Krashevich
2add675d42
Refactor Process Stats and Bugfixes (#6344)
* test refactor process stats

* Update util.py

* bugfix

* black formatting

* add missing processes field to StatsTrackingTypes class

* fix python checks and tests...

* use psutil for calcilate cpu utilization on get_cpu_stats

* black...black...black...

* add cpu average

* calculate statiscts for logger process

* add P-ID for other processes in System.jsx

* Apply suggestions from code review

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

* make page beautiful again :)

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-05-04 17:58:59 -05:00
Nicolas Mowen
305323c9e9
Update Rpi preset (#6385)
* Update Rpi preset

* Fix rpi test
2023-05-04 17:55:44 -05:00
Sergey Krashevich
b38c9e82e2
Replace subprocess usage with os module for better performance and maintainability (#6298)
* avoid executing external tools by using Python's built-in os module to interact with the filesystem directly

* Refactor recording cleanup script to use os module instead of subprocess

* black format util.py

* Ooooops

* Refactor get_cpu_stats() to properly identify recording process
2023-05-01 21:22:35 -05:00
Blake Blackshear
19890310fe
Bug fixes (#6332)
* fix timeline delete

* fix labelmap in config response

* create cache dirs if needed
2023-04-30 14:58:39 -05:00
Blake Blackshear
9bf98f908d
add plus integration for models (#6328) 2023-04-30 13:32:36 -05:00
Nicolas Mowen
ad52e238ce
Refactor events to be more generic (#6320)
* Organize event table to be more generalized

* Add appropriate fields to data

* Move tracked object logic to own function

* Add source type to event queue

* rename enum

* Fix types that are used in webUI

* remove redundant

* Formatting

* fix typing

* Rename enum
2023-04-30 12:07:14 -05:00
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