* Run ffmpeg sub process & video_properties as async
* Run recording cleanup in the main process
* More cleanup
* Use inter process communication to write recordings into the DB
* Formatting
* Store camera labels in dict and other optimizations
* Add max on timeout so it is at least 60
* Ensure db timeout is at least 60
* Update list once a day to ensure new labels are cleaned up
* Formatting
* Insert recordings as bulk instead of individually.
* Fix
* Refactor event and timeline cleanup
* Remove unused
* much improved motion estimation and tracking
* docs updates
* move ptz specific mp values to ptz_metrics dict
* only check if moving at frame time
* pass full dict instead of individual values
* Basic functionality
* Threaded motion estimator
* Revert "Threaded motion estimator"
This reverts commit 3171801607.
* Don't detect motion when ptz is moving
* fix motion logic
* fix mypy error
* Add threaded queue for movement for slower ptzs
* Move queues per camera
* Move autotracker start to app.py
* iou value for tracked object
* mqtt callback
* tracked object should be initially motionless
* only draw thicker box if autotracking is enabled
* Init if enabled when initially disabled in config
* Fix init
* Thread names
* Always use motion estimator
* docs
* clarify fov support
* remove size ratio
* use mp event instead of value for ptz status
* update autotrack at half fps
* fix merge conflict
* fix event type for mypy
* clean up
* Clean up
* remove unused code
* merge conflict fix
* docs: update link to object_detectors page
* Update docs/docs/configuration/autotracking.md
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* clarify wording
* pass actual instances directly
* default return preset
* fix type
* Error message when onvif init fails
* disable autotracking if onvif init fails
* disable autotracking if onvif init fails
* ptz module
* verify required_zones in config
* update util after dev merge
---------
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* Refactored queues to use faster_fifo instead of mp.Queue
* Refactored LimitedQueue to include a counter for the number of items in the queue and updated put and get methods to use the counter
* Refactor app.py and util.py to use a custom Queue implementation called LQueue instead of the existing Queue
* Refactor put and get methods in LimitedQueue to handle queue size and blocking behavior more efficiently
* code format
* remove code from other branch (merging fuckup)
* Add audio process PID to the list of processes and log the start of the audio process
* Update audio process PID key in processes dictionary to "audioDetector" instead of "audio".
* Initial audio classification model implementation
* fix mypy
* Keep audio labelmap local
* Cleanup
* Start adding config for audio
* Add the detector
* Add audio detection process keypoints
* Build out base config
* Load labelmap correctly
* Fix config bugs
* Start audio process
* Fix startup issues
* Try to cleanup restarting
* Add ffmpeg input args
* Get audio detection working
* Save event to db
* End events if not heard for 30 seconds
* Use not heard config
* Stop ffmpeg when shutting down
* Fixes
* End events correctly
* Use api instead of event queue to save audio events
* Get events working
* Close threads when stop event is sent
* remove unused
* Only start audio process if at least one camera is enabled
* Add const for float
* Cleanup labelmap
* Add audio icon in frontend
* Add ability to toggle audio with mqtt
* Set initial audio value
* Fix audio enabling
* Close logpipe
* Isort
* Formatting
* Fix web tests
* Fix web tests
* Handle cases where args are a string
* Remove log
* Cleanup process close
* Use correct field
* Simplify if statement
* Use var for localhost
* Add audio detectors docs
* Add restream docs to mention audio detection
* Add full config docs
* Fix links to other docs
---------
Co-authored-by: Jason Hunter <hunterjm@gmail.com>
* "Refactor storage stats calculation to use powers of 2 for more accurate values"
* replace 1000000 to 2^20
* Refactor storage unit size display to use binary prefixes
This commit updates the display of storage unit sizes in both the camera storage stats and the Storage component in the web UI to use binary prefixes (MiB and GiB) instead of decimal prefixes (MB and GB). This provides more accurate and consistent representation of storage sizes
* 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
* 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
* 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.
* 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>
* 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>
* 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
* 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
* 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
* 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
* 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>
* 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
* 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
* Refactor mqtt client
* Protect callback method
* Use async to handle reconnects
* Set types and clenup
* Don't set connected until rc code is checked
* 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>
* 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
* 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>
* 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
* 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>
* 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
* Starting working on adding motion toggle
* Add all info to mqtt command
* Send motion to correct funs
* Update mqtt docs
* Fixes for contingencies
* format
* mypy
* Tweak behavior
* Fix motion breaking frames
* Fix bad logic in detect set
* Always set value for motion boxes