diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..f687072fe --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +{ + "name": "Frigate Dev", + "dockerComposeFile": "../docker-compose.yml", + "service": "dev", + "workspaceFolder": "/lab/frigate", + "extensions": [ + "ms-python.python", + "visualstudioexptteam.vscodeintellicode", + "mhutchie.git-graph", + "ms-azuretools.vscode-docker", + "streetsidesoftware.code-spell-checker", + "eamodio.gitlens", + "esbenp.prettier-vscode", + "ms-python.vscode-pylance" + ], + "settings": { + "python.pythonPath": "/usr/bin/python3", + "python.linting.pylintEnabled": true, + "python.linting.enabled": true, + "python.formatting.provider": "black", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true, + "terminal.integrated.shell.linux": "/bin/bash" + } +} diff --git a/.dockerignore b/.dockerignore index c6f4105f3..5cad5e7d4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,7 @@ docs/ debug config/ *.pyc -.git \ No newline at end of file +.git +core +*.mp4 +*.db \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 9a340c4fb..000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: On push - -on: - push: - branches: - - master - - release-0.8.0 - -jobs: - deploy-docs: - name: Deploy docs - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./docs - steps: - - uses: actions/checkout@master - - uses: actions/setup-node@master - with: - node-version: 12.x - - run: npm install - - name: Build docs - run: npm run build - - name: Deploy documentation - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/build diff --git a/.gitignore b/.gitignore index a1dc92a01..85caded13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store *.pyc +*.swp debug .vscode config/config.yml @@ -10,3 +11,4 @@ frigate/version.py web/build web/node_modules web/coverage +core diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 000000000..bf205daa6 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,588 @@ +[MASTER] + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-whitelist= + +# Specify a score threshold to be exceeded before program exits with error. +fail-under=10.0 + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. +confidence= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + deprecated-operator-function, + deprecated-urllib-function, + xreadlines-attribute, + deprecated-sys-function, + exception-escape, + comprehension-escape + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member + + +[REPORTS] + +# Python expression which should return a score less than or equal to 10. You +# have access to the variables 'error', 'warning', 'refactor', and 'convention' +# which contain the number of messages in each category, as well as 'statement' +# which is the total number of statements analyzed. This score is used by the +# global evaluation report (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +#msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. Available dictionaries: none. To make it work, +# install the python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains the private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to the private dictionary (see the +# --spelling-private-dict-file option) instead of raising a message. +spelling-store-unknown-words=no + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis). It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + +# List of decorators that change the signature of a decorated function. +signature-mutators= + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat should generate a warning +# on implicit string concatenation in sequences defined over several lines. +check-str-concat-over-line-jumps=no + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[SIMILARITIES] + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + +# Regular expression of note tags to take in consideration. +#notes-rgx= + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. +#class-attribute-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _ + +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. +#variable-rgx= + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io + + +[LOGGING] + +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +logging-format-style=fstr + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[DESIGN] + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement (see R0916). +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp, + __post_init__ + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=cls + + +[IMPORTS] + +# List of modules that can be imported at any level, not just the top level +# one. +allow-any-import-level= + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules=optparse,tkinter.tix + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled). +ext-import-graph= + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled). +import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Couples of modules and preferred modules, separated by a comma. +preferred-modules= + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "BaseException, Exception". +overgeneral-exceptions=BaseException, + Exception diff --git a/Makefile b/Makefile index eb6e9b49a..0bf2ab4d7 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ default_target: amd64_frigate COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1) version: - echo "VERSION='0.8.4-$(COMMIT_HASH)'" > frigate/version.py + echo "VERSION='0.9.0-$(COMMIT_HASH)'" > frigate/version.py web: docker build --tag frigate-web --file docker/Dockerfile.web web/ @@ -12,11 +12,14 @@ amd64_wheels: docker build --tag blakeblackshear/frigate-wheels:1.0.3-amd64 --file docker/Dockerfile.wheels . amd64_ffmpeg: - docker build --tag blakeblackshear/frigate-ffmpeg:1.1.0-amd64 --file docker/Dockerfile.ffmpeg.amd64 . + docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.2.0-amd64 --file docker/Dockerfile.ffmpeg.amd64 . + +nginx_frigate: + docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate-nginx:1.0.2 --file docker/Dockerfile.nginx . amd64_frigate: version web - docker build --tag frigate-base --build-arg ARCH=amd64 --build-arg FFMPEG_VERSION=1.1.0 --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.base . - docker build --tag frigate --file docker/Dockerfile.amd64 . + docker build --no-cache --tag frigate-base --build-arg ARCH=amd64 --build-arg FFMPEG_VERSION=1.1.0 --build-arg WHEELS_VERSION=1.0.3 --build-arg NGINX_VERSION=1.0.2 --file docker/Dockerfile.base . + docker build --no-cache --tag frigate --file docker/Dockerfile.amd64 . amd64_all: amd64_wheels amd64_ffmpeg amd64_frigate @@ -24,11 +27,11 @@ amd64nvidia_wheels: docker build --tag blakeblackshear/frigate-wheels:1.0.3-amd64nvidia --file docker/Dockerfile.wheels . amd64nvidia_ffmpeg: - docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64nvidia --file docker/Dockerfile.ffmpeg.amd64nvidia . + docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.2.0-amd64nvidia --file docker/Dockerfile.ffmpeg.amd64nvidia . amd64nvidia_frigate: version web - docker build --tag frigate-base --build-arg ARCH=amd64nvidia --build-arg FFMPEG_VERSION=1.0.0 --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.base . - docker build --tag frigate --file docker/Dockerfile.amd64nvidia . + docker build --no-cache --tag frigate-base --build-arg ARCH=amd64nvidia --build-arg FFMPEG_VERSION=1.0.0 --build-arg WHEELS_VERSION=1.0.3 --build-arg NGINX_VERSION=1.0.2 --file docker/Dockerfile.base . + docker build --no-cache --tag frigate --file docker/Dockerfile.amd64nvidia . amd64nvidia_all: amd64nvidia_wheels amd64nvidia_ffmpeg amd64nvidia_frigate @@ -36,23 +39,23 @@ aarch64_wheels: docker build --tag blakeblackshear/frigate-wheels:1.0.3-aarch64 --file docker/Dockerfile.wheels . aarch64_ffmpeg: - docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-aarch64 --file docker/Dockerfile.ffmpeg.aarch64 . + docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.3.0-aarch64 --file docker/Dockerfile.ffmpeg.aarch64 . aarch64_frigate: version web - docker build --tag frigate-base --build-arg ARCH=aarch64 --build-arg FFMPEG_VERSION=1.0.0 --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.base . - docker build --tag frigate --file docker/Dockerfile.aarch64 . + docker build --no-cache --tag frigate-base --build-arg ARCH=aarch64 --build-arg FFMPEG_VERSION=1.0.0 --build-arg WHEELS_VERSION=1.0.3 --build-arg NGINX_VERSION=1.0.2 --file docker/Dockerfile.base . + docker build --no-cache --tag frigate --file docker/Dockerfile.aarch64 . -armv7_all: armv7_wheels armv7_ffmpeg armv7_frigate +aarch64_all: aarch64_wheels aarch64_ffmpeg aarch64_frigate armv7_wheels: docker build --tag blakeblackshear/frigate-wheels:1.0.3-armv7 --file docker/Dockerfile.wheels . armv7_ffmpeg: - docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-armv7 --file docker/Dockerfile.ffmpeg.armv7 . + docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.2.0-armv7 --file docker/Dockerfile.ffmpeg.armv7 . armv7_frigate: version web - docker build --tag frigate-base --build-arg ARCH=armv7 --build-arg FFMPEG_VERSION=1.0.0 --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.base . - docker build --tag frigate --file docker/Dockerfile.armv7 . + docker build --no-cache --tag frigate-base --build-arg ARCH=armv7 --build-arg FFMPEG_VERSION=1.0.0 --build-arg WHEELS_VERSION=1.0.3 --build-arg NGINX_VERSION=1.0.2 --file docker/Dockerfile.base . + docker build --no-cache --tag frigate --file docker/Dockerfile.armv7 . armv7_all: armv7_wheels armv7_ffmpeg armv7_frigate diff --git a/README.md b/README.md index 012a856af..009e945cb 100644 --- a/README.md +++ b/README.md @@ -14,25 +14,29 @@ Use of a [Google Coral Accelerator](https://coral.ai/products/) is optional, but - Uses a very low overhead motion detection to determine where to run object detection - Object detection with TensorFlow runs in separate processes for maximum FPS - Communicates over MQTT for easy integration into other systems -- Records video clips of detected objects +- Records video with retention settings based on detected objects - 24/7 recording - Re-streaming via RTMP to reduce the number of connections to your camera ## Documentation -View the documentation at https://blakeblackshear.github.io/frigate +View the documentation at https://docs.frigate.video ## Donations + If you would like to make a donation to support development, please use [Github Sponsors](https://github.com/sponsors/blakeblackshear). ## Screenshots + Integration into Home Assistant +
Also comes with a builtin UI: +
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 000000000..197d9e11e
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,29 @@
+version: "3"
+services:
+ dev:
+ container_name: frigate-dev
+ user: vscode
+ privileged: true
+ shm_size: "256mb"
+ build:
+ context: .
+ dockerfile: docker/Dockerfile.dev
+ volumes:
+ - /etc/localtime:/etc/localtime:ro
+ - .:/lab/frigate:cached
+ - ./config/config.yml:/config/config.yml:ro
+ - ./debug:/media/frigate
+ - /dev/bus/usb:/dev/bus/usb
+ - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware
+ ports:
+ - "1935:1935"
+ - "5000:5000"
+ - "5001:5001"
+ - "8080:8080"
+ entrypoint: ["sudo", "/init"]
+ command: /bin/sh -c "while sleep 1000; do :; done"
+ mqtt:
+ container_name: mqtt
+ image: eclipse-mosquitto:1.6
+ ports:
+ - "1883:1883"
diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64
index 5ce548f2d..30d69fc83 100644
--- a/docker/Dockerfile.aarch64
+++ b/docker/Dockerfile.aarch64
@@ -5,18 +5,24 @@ ENV DEBIAN_FRONTEND=noninteractive
# Install packages for apt repo
RUN apt-get -qq update \
&& apt-get -qq install --no-install-recommends -y \
- # ffmpeg runtime dependencies
- libgomp1 \
- # runtime dependencies
- libopenexr24 \
- libgstreamer1.0-0 \
- libgstreamer-plugins-base1.0-0 \
- libopenblas-base \
- libjpeg-turbo8 \
- libpng16-16 \
- libtiff5 \
- libdc1394-22 \
- ## Tensorflow lite
- && pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_aarch64.whl \
+ # ffmpeg runtime dependencies
+ libgomp1 \
+ # runtime dependencies
+ libopenexr24 \
+ libgstreamer1.0-0 \
+ libgstreamer-plugins-base1.0-0 \
+ libopenblas-base \
+ libjpeg-turbo8 \
+ libpng16-16 \
+ libtiff5 \
+ libdc1394-22 \
&& rm -rf /var/lib/apt/lists/* \
- && (apt-get autoremove -y; apt-get autoclean -y)
\ No newline at end of file
+ && (apt-get autoremove -y; apt-get autoclean -y)
+
+# s6-overlay
+ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-aarch64-installer /tmp/
+RUN chmod +x /tmp/s6-overlay-aarch64-installer && /tmp/s6-overlay-aarch64-installer /
+
+ENTRYPOINT ["/init"]
+
+CMD ["python3", "-u", "-m", "frigate"]
\ No newline at end of file
diff --git a/docker/Dockerfile.amd64 b/docker/Dockerfile.amd64
index 56f9839e8..d583e43f8 100644
--- a/docker/Dockerfile.amd64
+++ b/docker/Dockerfile.amd64
@@ -4,15 +4,25 @@ LABEL maintainer "blakeb@blakeshome.com"
# By default, use the i965 driver
ENV LIBVA_DRIVER_NAME=i965
# Install packages for apt repo
+
+RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add - \
+ && echo 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main' > /etc/apt/sources.list.d/intel-graphics.list \
+ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F63F0F2B90935439 \
+ && echo 'deb http://ppa.launchpad.net/kisak/kisak-mesa/ubuntu focal main' > /etc/apt/sources.list.d/kisak-mesa-focal.list
+
RUN apt-get -qq update \
&& apt-get -qq install --no-install-recommends -y \
- # ffmpeg dependencies
- libgomp1 \
- # VAAPI drivers for Intel hardware accel
- libva-drm2 libva2 libmfx1 i965-va-driver vainfo intel-media-va-driver mesa-va-drivers \
- ## Tensorflow lite
- && wget -q https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl \
- && python3.8 -m pip install tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl \
- && rm tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl \
+ # ffmpeg dependencies
+ libgomp1 \
+ # VAAPI drivers for Intel hardware accel
+ libva-drm2 libva2 libmfx1 i965-va-driver vainfo intel-media-va-driver-non-free mesa-vdpau-drivers mesa-va-drivers mesa-vdpau-drivers libdrm-radeon1 \
&& rm -rf /var/lib/apt/lists/* \
- && (apt-get autoremove -y; apt-get autoclean -y)
\ No newline at end of file
+ && (apt-get autoremove -y; apt-get autoclean -y)
+
+# s6-overlay
+ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-amd64-installer /tmp/
+RUN chmod +x /tmp/s6-overlay-amd64-installer && /tmp/s6-overlay-amd64-installer /
+
+ENTRYPOINT ["/init"]
+
+CMD ["python3", "-u", "-m", "frigate"]
\ No newline at end of file
diff --git a/docker/Dockerfile.amd64nvidia b/docker/Dockerfile.amd64nvidia
index 8714f70ad..f893d684f 100644
--- a/docker/Dockerfile.amd64nvidia
+++ b/docker/Dockerfile.amd64nvidia
@@ -4,12 +4,8 @@ LABEL maintainer "blakeb@blakeshome.com"
# Install packages for apt repo
RUN apt-get -qq update \
&& apt-get -qq install --no-install-recommends -y \
- # ffmpeg dependencies
- libgomp1 \
- ## Tensorflow lite
- && wget -q https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl \
- && python3.8 -m pip install tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl \
- && rm tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl \
+ # ffmpeg dependencies
+ libgomp1 \
&& rm -rf /var/lib/apt/lists/* \
&& (apt-get autoremove -y; apt-get autoclean -y)
@@ -45,3 +41,11 @@ ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video
ENV NVIDIA_REQUIRE_CUDA "cuda>=11.1 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441 brand=tesla,driver>=450,driver<451"
+
+# s6-overlay
+ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-amd64-installer /tmp/
+RUN chmod +x /tmp/s6-overlay-amd64-installer && /tmp/s6-overlay-amd64-installer /
+
+ENTRYPOINT ["/init"]
+
+CMD ["python3", "-u", "-m", "frigate"]
\ No newline at end of file
diff --git a/docker/Dockerfile.armv7 b/docker/Dockerfile.armv7
index 2e50cd22c..af44301b8 100644
--- a/docker/Dockerfile.armv7
+++ b/docker/Dockerfile.armv7
@@ -5,20 +5,26 @@ ENV DEBIAN_FRONTEND=noninteractive
# Install packages for apt repo
RUN apt-get -qq update \
&& apt-get -qq install --no-install-recommends -y \
- # ffmpeg runtime dependencies
- libgomp1 \
- # runtime dependencies
- libopenexr24 \
- libgstreamer1.0-0 \
- libgstreamer-plugins-base1.0-0 \
- libopenblas-base \
- libjpeg-turbo8 \
- libpng16-16 \
- libtiff5 \
- libdc1394-22 \
- libaom0 \
- libx265-179 \
- ## Tensorflow lite
- && pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_armv7l.whl \
+ # ffmpeg runtime dependencies
+ libgomp1 \
+ # runtime dependencies
+ libopenexr24 \
+ libgstreamer1.0-0 \
+ libgstreamer-plugins-base1.0-0 \
+ libopenblas-base \
+ libjpeg-turbo8 \
+ libpng16-16 \
+ libtiff5 \
+ libdc1394-22 \
+ libaom0 \
+ libx265-179 \
&& rm -rf /var/lib/apt/lists/* \
- && (apt-get autoremove -y; apt-get autoclean -y)
\ No newline at end of file
+ && (apt-get autoremove -y; apt-get autoclean -y)
+
+# s6-overlay
+ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-armhf-installer /tmp/
+RUN chmod +x /tmp/s6-overlay-armhf-installer && /tmp/s6-overlay-armhf-installer /
+
+ENTRYPOINT ["/init"]
+
+CMD ["python3", "-u", "-m", "frigate"]
\ No newline at end of file
diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base
index 794e81dac..ec1b5a0aa 100644
--- a/docker/Dockerfile.base
+++ b/docker/Dockerfile.base
@@ -1,8 +1,10 @@
ARG ARCH=amd64
ARG WHEELS_VERSION
ARG FFMPEG_VERSION
+ARG NGINX_VERSION
FROM blakeblackshear/frigate-wheels:${WHEELS_VERSION}-${ARCH} as wheels
FROM blakeblackshear/frigate-ffmpeg:${FFMPEG_VERSION}-${ARCH} as ffmpeg
+FROM blakeblackshear/frigate-nginx:${NGINX_VERSION} as nginx
FROM frigate-web as web
FROM ubuntu:20.04
@@ -18,33 +20,28 @@ ENV DEBIAN_FRONTEND=noninteractive
# Install packages for apt repo
RUN apt-get -qq update \
&& apt-get upgrade -y \
- && apt-get -qq install --no-install-recommends -y \
- gnupg wget unzip tzdata nginx libnginx-mod-rtmp \
- && apt-get -qq install --no-install-recommends -y \
- python3-pip \
+ && apt-get -qq install --no-install-recommends -y gnupg wget unzip tzdata libxml2 \
+ && apt-get -qq install --no-install-recommends -y python3-pip \
&& pip3 install -U /wheels/*.whl \
&& APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key adv --fetch-keys https://packages.cloud.google.com/apt/doc/apt-key.gpg \
&& echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list \
&& echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections \
- && apt-get -qq update && apt-get -qq install --no-install-recommends -y \
- libedgetpu1-max=15.0 \
+ && apt-get -qq update && apt-get -qq install --no-install-recommends -y libedgetpu1-max python3-tflite-runtime python3-pycoral \
&& rm -rf /var/lib/apt/lists/* /wheels \
&& (apt-get autoremove -y; apt-get autoclean -y)
RUN pip3 install \
peewee_migrate \
+ pydantic \
zeroconf \
- voluptuous\
- Flask-Sockets \
- gevent \
- gevent-websocket
+ ws4py
-COPY nginx/nginx.conf /etc/nginx/nginx.conf
+COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/
# get model and labels
COPY labelmap.txt /labelmap.txt
-RUN wget -q https://github.com/google-coral/test_data/raw/master/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite -O /edgetpu_model.tflite
-RUN wget -q https://github.com/google-coral/test_data/raw/master/ssdlite_mobiledet_coco_qat_postprocess.tflite -O /cpu_model.tflite
+RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite -O /edgetpu_model.tflite
+RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite -O /cpu_model.tflite
WORKDIR /opt/frigate/
ADD frigate frigate/
@@ -52,10 +49,7 @@ ADD migrations migrations/
COPY --from=web /opt/frigate/build web/
-COPY run.sh /run.sh
-RUN chmod +x /run.sh
+COPY docker/rootfs/ /
EXPOSE 5000
EXPOSE 1935
-
-CMD ["/run.sh"]
diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev
new file mode 100644
index 000000000..41a3296c9
--- /dev/null
+++ b/docker/Dockerfile.dev
@@ -0,0 +1,24 @@
+FROM frigate:latest
+
+ARG USERNAME=vscode
+ARG USER_UID=1000
+ARG USER_GID=$USER_UID
+
+# Create the user
+RUN groupadd --gid $USER_GID $USERNAME \
+ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
+ #
+ # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
+ && apt-get update \
+ && apt-get install -y sudo \
+ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
+ && chmod 0440 /etc/sudoers.d/$USERNAME
+
+RUN apt-get update \
+ && apt-get install -y git curl vim htop
+
+RUN pip3 install pylint black
+
+# Install Node 14
+RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
+ && apt-get install -y nodejs
diff --git a/docker/Dockerfile.ffmpeg.aarch64 b/docker/Dockerfile.ffmpeg.aarch64
index 3fa630a65..b53dda2ee 100644
--- a/docker/Dockerfile.ffmpeg.aarch64
+++ b/docker/Dockerfile.ffmpeg.aarch64
@@ -9,41 +9,41 @@ WORKDIR /tmp/workdir
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -yqq update && \
- apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \
+ apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 xutils-dev && \
apt-get autoremove -y && \
apt-get clean -y
FROM base as build
-ENV FFMPEG_VERSION=4.3.1 \
- AOM_VERSION=v1.0.0 \
- FDKAAC_VERSION=0.1.5 \
- FREETYPE_VERSION=2.5.5 \
- FRIBIDI_VERSION=0.19.7 \
- KVAZAAR_VERSION=1.2.0 \
- LAME_VERSION=3.100 \
- LIBPTHREAD_STUBS_VERSION=0.4 \
- LIBVIDSTAB_VERSION=1.1.0 \
- LIBXCB_VERSION=1.13.1 \
- XCBPROTO_VERSION=1.13 \
- OGG_VERSION=1.3.2 \
- OPENCOREAMR_VERSION=0.1.5 \
- OPUS_VERSION=1.2 \
- OPENJPEG_VERSION=2.1.2 \
- THEORA_VERSION=1.1.1 \
- VORBIS_VERSION=1.3.5 \
- VPX_VERSION=1.8.0 \
- WEBP_VERSION=1.0.2 \
- X264_VERSION=20170226-2245-stable \
- X265_VERSION=3.1.1 \
- XAU_VERSION=1.0.9 \
- XORG_MACROS_VERSION=1.19.2 \
- XPROTO_VERSION=7.0.31 \
- XVID_VERSION=1.3.4 \
- LIBZMQ_VERSION=4.3.2 \
- SRC=/usr/local
+ENV FFMPEG_VERSION=4.3.2 \
+ AOM_VERSION=v1.0.0 \
+ FDKAAC_VERSION=0.1.5 \
+ FREETYPE_VERSION=2.11.0 \
+ FRIBIDI_VERSION=0.19.7 \
+ KVAZAAR_VERSION=1.2.0 \
+ LAME_VERSION=3.100 \
+ LIBPTHREAD_STUBS_VERSION=0.4 \
+ LIBVIDSTAB_VERSION=1.1.0 \
+ LIBXCB_VERSION=1.13.1 \
+ XCBPROTO_VERSION=1.13 \
+ OGG_VERSION=1.3.2 \
+ OPENCOREAMR_VERSION=0.1.5 \
+ OPUS_VERSION=1.2 \
+ OPENJPEG_VERSION=2.1.2 \
+ THEORA_VERSION=1.1.1 \
+ VORBIS_VERSION=1.3.5 \
+ VPX_VERSION=1.8.0 \
+ WEBP_VERSION=1.0.2 \
+ X264_VERSION=20170226-2245-stable \
+ X265_VERSION=3.1.1 \
+ XAU_VERSION=1.0.9 \
+ XORG_MACROS_VERSION=1.19.2 \
+ XPROTO_VERSION=7.0.31 \
+ XVID_VERSION=1.3.4 \
+ LIBZMQ_VERSION=4.3.2 \
+ SRC=/usr/local
-ARG FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz"
+ARG FREETYPE_SHA256SUM="a45c6b403413abd5706f3582f04c8339d26397c4304b78fa552f2215df64101f freetype-2.11.0.tar.gz"
ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz"
ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz"
@@ -61,27 +61,27 @@ ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/usr/lib64:/usr/lib:/lib64:/lib"
-RUN buildDeps="autoconf \
- automake \
- cmake \
- curl \
- bzip2 \
- libexpat1-dev \
- g++ \
- gcc \
- git \
- gperf \
- libtool \
- make \
- nasm \
- perl \
- pkg-config \
- python \
- libssl-dev \
- yasm \
- linux-headers-raspi2 \
- libomxil-bellagio-dev \
- zlib1g-dev" && \
+RUN buildDeps="autoconf \
+ automake \
+ cmake \
+ curl \
+ bzip2 \
+ libexpat1-dev \
+ g++ \
+ gcc \
+ git \
+ gperf \
+ libtool \
+ make \
+ nasm \
+ perl \
+ pkg-config \
+ python \
+ libssl-dev \
+ yasm \
+ linux-headers-raspi2 \
+ libomxil-bellagio-dev \
+ zlib1g-dev" && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}
## opencore-amr https://sourceforge.net/projects/opencore-amr/
@@ -392,6 +392,16 @@ RUN \
make -j $(nproc) install && \
rm -rf ${DIR}
+
+RUN \
+ DIR=/tmp/rkmpp && \
+ mkdir -p ${DIR} && \
+ cd ${DIR} && \
+ git clone https://github.com/rockchip-linux/libdrm-rockchip && git clone https://github.com/rockchip-linux/mpp && \
+ cd libdrm-rockchip && bash autogen.sh && ./configure && make && make install && \
+ cd ../mpp && cmake -DRKPLATFORM=ON -DHAVE_DRM=ON && make -j6 && make install && \
+ rm -rf ${DIR}
+
## ffmpeg https://ffmpeg.org/
RUN \
DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \
@@ -434,6 +444,8 @@ RUN \
--enable-libkvazaar \
--enable-libaom \
--extra-libs=-lpthread \
+ --enable-rkmpp \
+ --enable-libdrm \
# --enable-omx \
# --enable-omx-rpi \
# --enable-mmal \
@@ -459,7 +471,7 @@ RUN \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \
mkdir -p /usr/local/lib/pkgconfig && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \
- sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
+ sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
done
FROM base AS release
diff --git a/docker/Dockerfile.ffmpeg.amd64 b/docker/Dockerfile.ffmpeg.amd64
index 21e0e6b9f..5dc005505 100644
--- a/docker/Dockerfile.ffmpeg.amd64
+++ b/docker/Dockerfile.ffmpeg.amd64
@@ -14,33 +14,33 @@ RUN apt-get -yqq update && \
FROM base as build
-ENV FFMPEG_VERSION=4.3.1 \
- AOM_VERSION=v1.0.0 \
- FDKAAC_VERSION=0.1.5 \
- FREETYPE_VERSION=2.5.5 \
- FRIBIDI_VERSION=0.19.7 \
- KVAZAAR_VERSION=1.2.0 \
- LAME_VERSION=3.100 \
- LIBPTHREAD_STUBS_VERSION=0.4 \
- LIBVIDSTAB_VERSION=1.1.0 \
- LIBXCB_VERSION=1.13.1 \
- XCBPROTO_VERSION=1.13 \
- OGG_VERSION=1.3.2 \
- OPENCOREAMR_VERSION=0.1.5 \
- OPUS_VERSION=1.2 \
- OPENJPEG_VERSION=2.1.2 \
- THEORA_VERSION=1.1.1 \
- VORBIS_VERSION=1.3.5 \
- VPX_VERSION=1.8.0 \
- WEBP_VERSION=1.0.2 \
- X264_VERSION=20170226-2245-stable \
- X265_VERSION=3.1.1 \
- XAU_VERSION=1.0.9 \
- XORG_MACROS_VERSION=1.19.2 \
- XPROTO_VERSION=7.0.31 \
- XVID_VERSION=1.3.4 \
- LIBZMQ_VERSION=4.3.2 \
- SRC=/usr/local
+ENV FFMPEG_VERSION=4.3.2 \
+ AOM_VERSION=v1.0.0 \
+ FDKAAC_VERSION=0.1.5 \
+ FREETYPE_VERSION=2.5.5 \
+ FRIBIDI_VERSION=0.19.7 \
+ KVAZAAR_VERSION=1.2.0 \
+ LAME_VERSION=3.100 \
+ LIBPTHREAD_STUBS_VERSION=0.4 \
+ LIBVIDSTAB_VERSION=1.1.0 \
+ LIBXCB_VERSION=1.13.1 \
+ XCBPROTO_VERSION=1.13 \
+ OGG_VERSION=1.3.2 \
+ OPENCOREAMR_VERSION=0.1.5 \
+ OPUS_VERSION=1.2 \
+ OPENJPEG_VERSION=2.1.2 \
+ THEORA_VERSION=1.1.1 \
+ VORBIS_VERSION=1.3.5 \
+ VPX_VERSION=1.8.0 \
+ WEBP_VERSION=1.0.2 \
+ X264_VERSION=20170226-2245-stable \
+ X265_VERSION=3.1.1 \
+ XAU_VERSION=1.0.9 \
+ XORG_MACROS_VERSION=1.19.2 \
+ XPROTO_VERSION=7.0.31 \
+ XVID_VERSION=1.3.4 \
+ LIBZMQ_VERSION=4.3.2 \
+ SRC=/usr/local
ARG FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz"
ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
@@ -60,27 +60,27 @@ ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/usr/lib64:/usr/lib:/lib64:/lib"
-RUN buildDeps="autoconf \
- automake \
- cmake \
- curl \
- bzip2 \
- libexpat1-dev \
- g++ \
- gcc \
- git \
- gperf \
- libtool \
- make \
- nasm \
- perl \
- pkg-config \
- python \
- libssl-dev \
- yasm \
- libva-dev \
- libmfx-dev \
- zlib1g-dev" && \
+RUN buildDeps="autoconf \
+ automake \
+ cmake \
+ curl \
+ bzip2 \
+ libexpat1-dev \
+ g++ \
+ gcc \
+ git \
+ gperf \
+ libtool \
+ make \
+ nasm \
+ perl \
+ pkg-config \
+ python \
+ libssl-dev \
+ yasm \
+ libva-dev \
+ libmfx-dev \
+ zlib1g-dev" && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}
## opencore-amr https://sourceforge.net/projects/opencore-amr/
@@ -450,7 +450,7 @@ RUN \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \
mkdir -p /usr/local/lib/pkgconfig && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \
- sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
+ sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
done
FROM base AS release
@@ -463,6 +463,6 @@ ENTRYPOINT ["ffmpeg"]
COPY --from=build /usr/local /usr/local/
RUN \
- apt-get update -y && \
- apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver mesa-va-drivers && \
- rm -rf /var/lib/apt/lists/*
+ apt-get update -y && \
+ apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver mesa-va-drivers && \
+ rm -rf /var/lib/apt/lists/*
diff --git a/docker/Dockerfile.ffmpeg.amd64nvidia b/docker/Dockerfile.ffmpeg.amd64nvidia
index 402e8973d..71f91fe4f 100644
--- a/docker/Dockerfile.ffmpeg.amd64nvidia
+++ b/docker/Dockerfile.ffmpeg.amd64nvidia
@@ -37,36 +37,36 @@ FROM devel-base as build
ENV NVIDIA_HEADERS_VERSION=9.1.23.1
-ENV FFMPEG_VERSION=4.3.1 \
- AOM_VERSION=v1.0.0 \
- FDKAAC_VERSION=0.1.5 \
- FREETYPE_VERSION=2.5.5 \
- FRIBIDI_VERSION=0.19.7 \
- KVAZAAR_VERSION=1.2.0 \
- LAME_VERSION=3.100 \
- LIBPTHREAD_STUBS_VERSION=0.4 \
- LIBVIDSTAB_VERSION=1.1.0 \
- LIBXCB_VERSION=1.13.1 \
- XCBPROTO_VERSION=1.13 \
- OGG_VERSION=1.3.2 \
- OPENCOREAMR_VERSION=0.1.5 \
- OPUS_VERSION=1.2 \
- OPENJPEG_VERSION=2.1.2 \
- THEORA_VERSION=1.1.1 \
- VORBIS_VERSION=1.3.5 \
- VPX_VERSION=1.8.0 \
- WEBP_VERSION=1.0.2 \
- X264_VERSION=20170226-2245-stable \
- X265_VERSION=3.1.1 \
- XAU_VERSION=1.0.9 \
- XORG_MACROS_VERSION=1.19.2 \
- XPROTO_VERSION=7.0.31 \
- XVID_VERSION=1.3.4 \
- LIBZMQ_VERSION=4.3.2 \
- LIBSRT_VERSION=1.4.1 \
- LIBARIBB24_VERSION=1.0.3 \
- LIBPNG_VERSION=1.6.9 \
- SRC=/usr/local
+ENV FFMPEG_VERSION=4.3.2 \
+ AOM_VERSION=v1.0.0 \
+ FDKAAC_VERSION=0.1.5 \
+ FREETYPE_VERSION=2.5.5 \
+ FRIBIDI_VERSION=0.19.7 \
+ KVAZAAR_VERSION=1.2.0 \
+ LAME_VERSION=3.100 \
+ LIBPTHREAD_STUBS_VERSION=0.4 \
+ LIBVIDSTAB_VERSION=1.1.0 \
+ LIBXCB_VERSION=1.13.1 \
+ XCBPROTO_VERSION=1.13 \
+ OGG_VERSION=1.3.2 \
+ OPENCOREAMR_VERSION=0.1.5 \
+ OPUS_VERSION=1.2 \
+ OPENJPEG_VERSION=2.1.2 \
+ THEORA_VERSION=1.1.1 \
+ VORBIS_VERSION=1.3.5 \
+ VPX_VERSION=1.8.0 \
+ WEBP_VERSION=1.0.2 \
+ X264_VERSION=20170226-2245-stable \
+ X265_VERSION=3.1.1 \
+ XAU_VERSION=1.0.9 \
+ XORG_MACROS_VERSION=1.19.2 \
+ XPROTO_VERSION=7.0.31 \
+ XVID_VERSION=1.3.4 \
+ LIBZMQ_VERSION=4.3.2 \
+ LIBSRT_VERSION=1.4.1 \
+ LIBARIBB24_VERSION=1.0.3 \
+ LIBPNG_VERSION=1.6.9 \
+ SRC=/usr/local
ARG FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz"
ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
@@ -87,35 +87,35 @@ ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64"
-RUN buildDeps="autoconf \
- automake \
- cmake \
- curl \
- bzip2 \
- libexpat1-dev \
- g++ \
- gcc \
- git \
- gperf \
- libtool \
- make \
- nasm \
- perl \
- pkg-config \
- python \
- libssl-dev \
- yasm \
- zlib1g-dev" && \
+RUN buildDeps="autoconf \
+ automake \
+ cmake \
+ curl \
+ bzip2 \
+ libexpat1-dev \
+ g++ \
+ gcc \
+ git \
+ gperf \
+ libtool \
+ make \
+ nasm \
+ perl \
+ pkg-config \
+ python \
+ libssl-dev \
+ yasm \
+ zlib1g-dev" && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}
RUN \
- DIR=/tmp/nv-codec-headers && \
- git clone https://github.com/FFmpeg/nv-codec-headers ${DIR} && \
- cd ${DIR} && \
- git checkout n${NVIDIA_HEADERS_VERSION} && \
- make PREFIX="${PREFIX}" && \
- make install PREFIX="${PREFIX}" && \
+ DIR=/tmp/nv-codec-headers && \
+ git clone https://github.com/FFmpeg/nv-codec-headers ${DIR} && \
+ cd ${DIR} && \
+ git checkout n${NVIDIA_HEADERS_VERSION} && \
+ make PREFIX="${PREFIX}" && \
+ make install PREFIX="${PREFIX}" && \
rm -rf ${DIR}
## opencore-amr https://sourceforge.net/projects/opencore-amr/
@@ -527,7 +527,7 @@ RUN \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \
mkdir -p /usr/local/lib/pkgconfig && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \
- sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
+ sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
done
@@ -539,7 +539,7 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]
-# copy only needed files, without copying nvidia dev files
+# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
diff --git a/docker/Dockerfile.ffmpeg.armv7 b/docker/Dockerfile.ffmpeg.armv7
index b56f8d909..0c40cef85 100644
--- a/docker/Dockerfile.ffmpeg.armv7
+++ b/docker/Dockerfile.ffmpeg.armv7
@@ -15,33 +15,33 @@ RUN apt-get -yqq update && \
FROM base as build
-ENV FFMPEG_VERSION=4.3.1 \
- AOM_VERSION=v1.0.0 \
- FDKAAC_VERSION=0.1.5 \
- FREETYPE_VERSION=2.5.5 \
- FRIBIDI_VERSION=0.19.7 \
- KVAZAAR_VERSION=1.2.0 \
- LAME_VERSION=3.100 \
- LIBPTHREAD_STUBS_VERSION=0.4 \
- LIBVIDSTAB_VERSION=1.1.0 \
- LIBXCB_VERSION=1.13.1 \
- XCBPROTO_VERSION=1.13 \
- OGG_VERSION=1.3.2 \
- OPENCOREAMR_VERSION=0.1.5 \
- OPUS_VERSION=1.2 \
- OPENJPEG_VERSION=2.1.2 \
- THEORA_VERSION=1.1.1 \
- VORBIS_VERSION=1.3.5 \
- VPX_VERSION=1.8.0 \
- WEBP_VERSION=1.0.2 \
- X264_VERSION=20170226-2245-stable \
- X265_VERSION=3.1.1 \
- XAU_VERSION=1.0.9 \
- XORG_MACROS_VERSION=1.19.2 \
- XPROTO_VERSION=7.0.31 \
- XVID_VERSION=1.3.4 \
- LIBZMQ_VERSION=4.3.3 \
- SRC=/usr/local
+ENV FFMPEG_VERSION=4.3.2 \
+ AOM_VERSION=v1.0.0 \
+ FDKAAC_VERSION=0.1.5 \
+ FREETYPE_VERSION=2.5.5 \
+ FRIBIDI_VERSION=0.19.7 \
+ KVAZAAR_VERSION=1.2.0 \
+ LAME_VERSION=3.100 \
+ LIBPTHREAD_STUBS_VERSION=0.4 \
+ LIBVIDSTAB_VERSION=1.1.0 \
+ LIBXCB_VERSION=1.13.1 \
+ XCBPROTO_VERSION=1.13 \
+ OGG_VERSION=1.3.2 \
+ OPENCOREAMR_VERSION=0.1.5 \
+ OPUS_VERSION=1.2 \
+ OPENJPEG_VERSION=2.1.2 \
+ THEORA_VERSION=1.1.1 \
+ VORBIS_VERSION=1.3.5 \
+ VPX_VERSION=1.8.0 \
+ WEBP_VERSION=1.0.2 \
+ X264_VERSION=20170226-2245-stable \
+ X265_VERSION=3.1.1 \
+ XAU_VERSION=1.0.9 \
+ XORG_MACROS_VERSION=1.19.2 \
+ XPROTO_VERSION=7.0.31 \
+ XVID_VERSION=1.3.4 \
+ LIBZMQ_VERSION=4.3.3 \
+ SRC=/usr/local
ARG FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz"
ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
@@ -60,30 +60,30 @@ ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/usr/lib64:/usr/lib:/lib64:/lib:/opt/vc/lib"
-RUN buildDeps="autoconf \
- automake \
- cmake \
- curl \
- bzip2 \
- libexpat1-dev \
- g++ \
- gcc \
- git \
- gperf \
- libtool \
- make \
- nasm \
- perl \
- pkg-config \
- python \
- sudo \
- libssl-dev \
- yasm \
- linux-headers-raspi2 \
- libomxil-bellagio-dev \
- libx265-dev \
- libaom-dev \
- zlib1g-dev" && \
+RUN buildDeps="autoconf \
+ automake \
+ cmake \
+ curl \
+ bzip2 \
+ libexpat1-dev \
+ g++ \
+ gcc \
+ git \
+ gperf \
+ libtool \
+ make \
+ nasm \
+ perl \
+ pkg-config \
+ python \
+ sudo \
+ libssl-dev \
+ yasm \
+ linux-headers-raspi2 \
+ libomxil-bellagio-dev \
+ libx265-dev \
+ libaom-dev \
+ zlib1g-dev" && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}
## opencore-amr https://sourceforge.net/projects/opencore-amr/
@@ -471,7 +471,7 @@ RUN \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \
mkdir -p /usr/local/lib/pkgconfig && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \
- sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
+ sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \
done
FROM base AS release
diff --git a/docker/Dockerfile.nginx b/docker/Dockerfile.nginx
new file mode 100644
index 000000000..72e15f8e0
--- /dev/null
+++ b/docker/Dockerfile.nginx
@@ -0,0 +1,52 @@
+FROM ubuntu:20.04 AS base
+
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get -yqq update && \
+ apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \
+ apt-get autoremove -y && \
+ apt-get clean -y
+
+FROM base as build
+
+ARG NGINX_VERSION=1.18.0
+ARG VOD_MODULE_VERSION=1.28
+ARG SECURE_TOKEN_MODULE_VERSION=1.4
+ARG RTMP_MODULE_VERSION=1.2.1
+
+RUN cp /etc/apt/sources.list /etc/apt/sources.list~ \
+ && sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list \
+ && apt-get update
+
+RUN apt-get -yqq build-dep nginx
+
+RUN apt-get -yqq install --no-install-recommends curl \
+ && mkdir /tmp/nginx \
+ && curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /tmp/nginx -zx --strip-components=1 \
+ && mkdir /tmp/nginx-vod-module \
+ && curl -sL https://github.com/kaltura/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz | tar -C /tmp/nginx-vod-module -zx --strip-components=1 \
+ # Patch MAX_CLIPS to allow more clips to be added than the default 128
+ && sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h \
+ && mkdir /tmp/nginx-secure-token-module \
+ && curl -sL https://github.com/kaltura/nginx-secure-token-module/archive/refs/tags/${SECURE_TOKEN_MODULE_VERSION}.tar.gz | tar -C /tmp/nginx-secure-token-module -zx --strip-components=1 \
+ && mkdir /tmp/nginx-rtmp-module \
+ && curl -sL https://github.com/arut/nginx-rtmp-module/archive/refs/tags/v${RTMP_MODULE_VERSION}.tar.gz | tar -C /tmp/nginx-rtmp-module -zx --strip-components=1
+
+WORKDIR /tmp/nginx
+
+RUN ./configure --prefix=/usr/local/nginx \
+ --with-file-aio \
+ --with-http_sub_module \
+ --with-http_ssl_module \
+ --with-threads \
+ --add-module=../nginx-vod-module \
+ --add-module=../nginx-secure-token-module \
+ --add-module=../nginx-rtmp-module \
+ --with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
+
+RUN make && make install
+RUN rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
+
+FROM base
+COPY --from=build /usr/local/nginx /usr/local/nginx
+ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
+CMD ["-g", "daemon off;"]
\ No newline at end of file
diff --git a/docker/Dockerfile.wheels b/docker/Dockerfile.wheels
index 278d989e0..a6fa222ec 100644
--- a/docker/Dockerfile.wheels
+++ b/docker/Dockerfile.wheels
@@ -34,8 +34,7 @@ RUN pip3 wheel --wheel-dir=/wheels \
matplotlib \
click \
setproctitle \
- peewee \
- gevent
+ peewee
FROM scratch
diff --git a/docker/rootfs/etc/services.d/nginx/finish b/docker/rootfs/etc/services.d/nginx/finish
new file mode 100644
index 000000000..24482e77f
--- /dev/null
+++ b/docker/rootfs/etc/services.d/nginx/finish
@@ -0,0 +1,5 @@
+#!/usr/bin/execlineb -S1
+if { s6-test ${1} -ne 0 }
+if { s6-test ${1} -ne 256 }
+
+s6-svscanctl -t /var/run/s6/services
\ No newline at end of file
diff --git a/docker/rootfs/etc/services.d/nginx/run b/docker/rootfs/etc/services.d/nginx/run
new file mode 100644
index 000000000..5aba51c91
--- /dev/null
+++ b/docker/rootfs/etc/services.d/nginx/run
@@ -0,0 +1,2 @@
+#!/usr/bin/execlineb -P
+/usr/local/nginx/sbin/nginx
\ No newline at end of file
diff --git a/nginx/nginx.conf b/docker/rootfs/usr/local/nginx/conf/nginx.conf
similarity index 70%
rename from nginx/nginx.conf
rename to docker/rootfs/usr/local/nginx/conf/nginx.conf
index 51842cb70..bd8826282 100644
--- a/nginx/nginx.conf
+++ b/docker/rootfs/usr/local/nginx/conf/nginx.conf
@@ -1,23 +1,23 @@
+daemon off;
+user root;
worker_processes 1;
-error_log /var/log/nginx/error.log warn;
+error_log /usr/local/nginx/logs/error.log warn;
pid /var/run/nginx.pid;
-load_module "modules/ngx_rtmp_module.so";
-
events {
worker_connections 1024;
}
http {
- include /etc/nginx/mime.types;
+ include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
- access_log /var/log/nginx/access.log main;
+ access_log /usr/local/nginx/logs/access.log main;
sendfile on;
@@ -34,9 +34,56 @@ http {
keepalive 1024;
}
+ upstream mqtt_ws {
+ server localhost:5002;
+ keepalive 1024;
+ }
+
+ upstream jsmpeg {
+ server localhost:8082;
+ keepalive 1024;
+ }
+
server {
listen 5000;
+ # vod settings
+ vod_base_url '';
+ vod_segments_base_url '';
+ vod_mode mapped;
+ vod_max_mapping_response_size 1m;
+ vod_upstream_location /api;
+ vod_align_segments_to_key_frames on;
+ vod_manifest_segment_durations_mode accurate;
+
+ # vod caches
+ vod_metadata_cache metadata_cache 512m;
+ vod_mapping_cache mapping_cache 5m;
+
+ # gzip manifests
+ gzip on;
+ gzip_types application/vnd.apple.mpegurl;
+
+ # file handle caching / aio
+ open_file_cache max=1000 inactive=5m;
+ open_file_cache_valid 2m;
+ open_file_cache_min_uses 1;
+ open_file_cache_errors on;
+ aio on;
+
+ location /vod/ {
+ vod hls;
+
+ secure_token $args;
+ secure_token_types application/vnd.apple.mpegurl;
+
+ add_header Access-Control-Allow-Headers '*';
+ add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
+ add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
+ add_header Access-Control-Allow-Origin '*';
+ expires -1;
+ }
+
location /stream/ {
add_header 'Cache-Control' 'no-cache';
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
@@ -81,6 +128,11 @@ http {
root /media/frigate;
}
+ location /cache/ {
+ internal; # This tells nginx it's not accessible from the outside
+ alias /tmp/cache/;
+ }
+
location /recordings/ {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true';
@@ -103,7 +155,15 @@ http {
}
location /ws {
- proxy_pass http://frigate_api/ws;
+ proxy_pass http://mqtt_ws/;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "Upgrade";
+ proxy_set_header Host $host;
+ }
+
+ location /live/ {
+ proxy_pass http://jsmpeg/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
@@ -112,6 +172,7 @@ http {
location /api/ {
add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header Cache-Control "no-store";
proxy_pass http://frigate_api/;
proxy_pass_request_headers on;
diff --git a/docs/docs/configuration/advanced.md b/docs/docs/configuration/advanced.md
index 7efcfb680..18521b7d5 100644
--- a/docs/docs/configuration/advanced.md
+++ b/docs/docs/configuration/advanced.md
@@ -1,50 +1,11 @@
---
id: advanced
-title: Advanced
-sidebar_label: Advanced
+title: Advanced Options
+sidebar_label: Advanced Options
---
## Advanced configuration
-### `motion`
-
-Global motion detection config. These may also be defined at the camera level.
-
-```yaml
-motion:
- # Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
- # Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
- # The value should be between 1 and 255.
- threshold: 25
- # Optional: Minimum size in pixels in the resized motion image that counts as motion
- # Increasing this value will prevent smaller areas of motion from being detected. Decreasing will make motion detection more sensitive to smaller
- # moving objects.
- contour_area: 100
- # Optional: Alpha value passed to cv2.accumulateWeighted when averaging the motion delta across multiple frames (default: shown below)
- # Higher values mean the current frame impacts the delta a lot, and a single raindrop may register as motion.
- # Too low and a fast moving person wont be detected as motion.
- delta_alpha: 0.2
- # Optional: Alpha value passed to cv2.accumulateWeighted when averaging frames to determine the background (default: shown below)
- # Higher values mean the current frame impacts the average a lot, and a new object will be averaged into the background faster.
- # Low values will cause things like moving shadows to be detected as motion for longer.
- # https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
- frame_alpha: 0.2
- # Optional: Height of the resized motion frame (default: 1/6th of the original frame height)
- # This operates as an efficient blur alternative. Higher values will result in more granular motion detection at the expense of higher CPU usage.
- # Lower values result in less CPU, but small changes may not register as motion.
- frame_height: 180
-```
-
-### `detect`
-
-Global object detection settings. These may also be defined at the camera level.
-
-```yaml
-detect:
- # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
- max_disappeared: 25
-```
-
### `logger`
Change the default log level for troubleshooting purposes.
@@ -72,48 +33,32 @@ Examples of available modules are:
### `environment_vars`
-This section can be used to set environment variables for those unable to modify the environment of the container (ie. within Hass.io)
-
-```yaml
-environment_vars:
- EXAMPLE_VAR: value
-```
+This section can be used to set environment variables for those unable to modify the environment of the container (ie. within HassOS)
### `database`
-Event and clip information is managed in a sqlite database at `/media/frigate/clips/frigate.db`. If that database is deleted, clips will be orphaned and will need to be cleaned up manually. They also won't show up in the Media Browser within Home Assistant.
+Event and recording information is managed in a sqlite database at `/media/frigate/frigate.db`. If that database is deleted, recordings will be orphaned and will need to be cleaned up manually. They also won't show up in the Media Browser within Home Assistant.
-If you are storing your clips on a network share (SMB, NFS, etc), you may get a `database is locked` error message on startup. You can customize the location of the database in the config if necessary.
+If you are storing your database on a network share (SMB, NFS, etc), you may get a `database is locked` error message on startup. You can customize the location of the database in the config if necessary.
-This may need to be in a custom location if network storage is used for clips.
-
-```yaml
-database:
- path: /media/frigate/clips/frigate.db
-```
-
-### `detectors`
-
-```yaml
-detectors:
- # Required: name of the detector
- coral:
- # Required: type of the detector
- # Valid values are 'edgetpu' (requires device property below) and 'cpu'.
- type: edgetpu
- # Optional: device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api
- device: usb
- # Optional: num_threads value passed to the tflite.Interpreter (default: shown below)
- # This value is only used for CPU types
- num_threads: 3
-```
+This may need to be in a custom location if network storage is used for the media folder.
### `model`
+If using a custom model, the width and height will need to be specified.
+
+The labelmap can be customized to your needs. A common reason to do this is to combine multiple object types that are easily confused when you don't need to be as granular such as car/truck. By default, truck is renamed to car because they are often confused. You cannot add new object types, but you can change the names of existing objects in the model.
+
```yaml
model:
- # Required: height of the trained model
- height: 320
- # Required: width of the trained model
- width: 320
+ labelmap:
+ 2: vehicle
+ 3: vehicle
+ 5: vehicle
+ 7: vehicle
+ 15: animal
+ 16: animal
+ 17: animal
```
+
+Note that if you rename objects in the labelmap, you will also need to update your `objects -> track` list as well.
diff --git a/docs/docs/configuration/camera_specific.md b/docs/docs/configuration/camera_specific.md
new file mode 100644
index 000000000..b737a5605
--- /dev/null
+++ b/docs/docs/configuration/camera_specific.md
@@ -0,0 +1,87 @@
+---
+id: camera_specific
+title: Camera Specific Configurations
+---
+
+### MJPEG Cameras
+
+The input and output parameters need to be adjusted for MJPEG cameras
+
+```yaml
+input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
+```
+
+Note that mjpeg cameras require encoding the video into h264 for recording, and rtmp roles. This will use significantly more CPU than if the cameras supported h264 feeds directly.
+
+```yaml
+output_args:
+ record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an
+ rtmp: -c:v libx264 -an -f flv
+```
+
+### RTMP Cameras
+
+The input parameters need to be adjusted for RTMP cameras
+
+```yaml
+ffmpeg:
+ input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -rw_timeout 5000000 -use_wallclock_as_timestamps 1 -f live_flv
+```
+
+### Reolink 410/520 (possibly others)
+
+According to [this discussion](https://github.com/blakeblackshear/frigate/issues/1713#issuecomment-932976305), the http video streams seem to be the most reliable for Reolink.
+
+```yaml
+cameras:
+ reolink:
+ ffmpeg:
+ hwaccel_args:
+ input_args:
+ - -avoid_negative_ts
+ - make_zero
+ - -fflags
+ - nobuffer+genpts+discardcorrupt
+ - -flags
+ - low_delay
+ - -strict
+ - experimental
+ - -analyzeduration
+ - 1000M
+ - -probesize
+ - 1000M
+ - -rw_timeout
+ - "5000000"
+ inputs:
+ - path: http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password
+ roles:
+ - record
+ - rtmp
+ - path: http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=username&password=password
+ roles:
+ - detect
+ detect:
+ width: 640
+ height: 480
+ fps: 7
+```
+
+
+
+### Blue Iris RTSP Cameras
+
+You will need to remove `nobuffer` flag for Blue Iris RTSP cameras
+
+```yaml
+ffmpeg:
+ input_args: -avoid_negative_ts make_zero -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1
+```
+
+### UDP Only Cameras
+
+If your cameras do not support TCP connections for RTSP, you can use UDP.
+
+```yaml
+ffmpeg:
+ input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport udp -stimeout 5000000 -use_wallclock_as_timestamps 1
+```
diff --git a/docs/docs/configuration/cameras.md b/docs/docs/configuration/cameras.md
index 5184e516c..ef6e05dd2 100644
--- a/docs/docs/configuration/cameras.md
+++ b/docs/docs/configuration/cameras.md
@@ -5,18 +5,15 @@ title: Cameras
## Setting Up Camera Inputs
-Up to 4 inputs can be configured for each camera and the role of each input can be mixed and matched based on your needs. This allows you to use a lower resolution stream for object detection, but create clips from a higher resolution stream, or vice versa.
+Several inputs can be configured for each camera and the role of each input can be mixed and matched based on your needs. This allows you to use a lower resolution stream for object detection, but create recordings from a higher resolution stream, or vice versa.
Each role can only be assigned to one input per camera. The options for roles are as follows:
-| Role | Description |
-| -------- | ------------------------------------------------------------------------------------ |
-| `detect` | Main feed for object detection |
-| `clips` | Clips of events from objects detected in the `detect` feed. [docs](#recording-clips) |
-| `record` | Saves 60 second segments of the video feed. [docs](#247-recordings) |
-| `rtmp` | Broadcast as an RTMP feed for other services to consume. [docs](#rtmp-streams) |
-
-### Example
+| Role | Description |
+| -------- | ----------------------------------------------------------------------------------------------- |
+| `detect` | Main feed for object detection |
+| `record` | Saves segments of the video feed based on configuration settings. [docs](/configuration/record) |
+| `rtmp` | Broadcast as an RTMP feed for other services to consume. [docs](/configuration/rtmp) |
```yaml
mqtt:
@@ -31,459 +28,18 @@ cameras:
- rtmp
- path: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/live
roles:
- - clips
- record
- width: 1280
- height: 720
- fps: 5
-```
-
-`width`, `height`, and `fps` are only used for the `detect` role. Other streams are passed through, so there is no need to specify the resolution.
-
-## Masks & Zones
-
-### Masks
-
-Masks are used to ignore initial detection in areas of your camera's field of view.
-
-There are two types of masks available:
-
-- **Motion masks**: Motion masks are used to prevent unwanted types of motion from triggering detection. Try watching the video feed with `Motion Boxes` enabled to see what may be regularly detected as motion. For example, you want to mask out your timestamp, the sky, rooftops, etc. Keep in mind that this mask only prevents motion from being detected and does not prevent objects from being detected if object detection was started due to motion in unmasked areas. Motion is also used during object tracking to refine the object detection area in the next frame. Over masking will make it more difficult for objects to be tracked. To see this effect, create a mask, and then watch the video feed with `Motion Boxes` enabled again.
-- **Object filter masks**: Object filter masks are used to filter out false positives for a given object type. These should be used to filter any areas where it is not possible for an object of that type to be. The bottom center of the detected object's bounding box is evaluated against the mask. If it is in a masked area, it is assumed to be a false positive. For example, you may want to mask out rooftops, walls, the sky, treetops for people. For cars, masking locations other than the street or your driveway will tell frigate that anything in your yard is a false positive.
-
-To create a poly mask:
-
-1. Visit the [web UI](/usage/web)
-1. Click the camera you wish to create a mask for
-1. Click "Mask & Zone creator"
-1. Click "Add" on the type of mask or zone you would like to create
-1. Click on the camera's latest image to create a masked area. The yaml representation will be updated in real-time
-1. When you've finished creating your mask, click "Copy" and paste the contents into your `config.yaml` file and restart Frigate
-
-Example of a finished row corresponding to the below example image:
-
-```yaml
-motion:
- mask: "0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432"
-```
-
-
-
-```yaml
-# Optional: camera level motion config
-motion:
- # Optional: motion mask
- # NOTE: see docs for more detailed info on creating masks
- mask: 0,900,1080,900,1080,1920,0,1920
-```
-
-### Zones
-
-Zones allow you to define a specific area of the frame and apply additional filters for object types so you can determine whether or not an object is within a particular area. Zones cannot have the same name as a camera. If desired, a single zone can include multiple cameras if you have multiple cameras covering the same area by configuring zones with the same name for each camera.
-
-During testing, `draw_zones` should be set in the config to draw the zone on the frames so you can adjust as needed. The zone line will increase in thickness when any object enters the zone.
-
-To create a zone, follow the same steps above for a "Motion mask", but use the section of the web UI for creating a zone instead.
-
-```yaml
-# Optional: zones for this camera
-zones:
- # Required: name of the zone
- # NOTE: This must be different than any camera names, but can match with another zone on another
- # camera.
- front_steps:
- # Required: List of x,y coordinates to define the polygon of the zone.
- # NOTE: Coordinates can be generated at https://www.image-map.net/
- coordinates: 545,1077,747,939,788,805
- # Optional: Zone level object filters.
- # NOTE: The global and camera filters are applied upstream.
- filters:
- person:
- min_area: 5000
- max_area: 100000
- threshold: 0.7
-```
-
-## Objects
-
-For a list of available objects, see the [objects documentation](./objects.mdx).
-
-```yaml
-# Optional: Camera level object filters config.
-objects:
- track:
- - person
- - car
- # Optional: mask to prevent all object types from being detected in certain areas (default: no mask)
- # Checks based on the bottom center of the bounding box of the object.
- # NOTE: This mask is COMBINED with the object type specific mask below
- mask: 0,0,1000,0,1000,200,0,200
- filters:
- person:
- min_area: 5000
- max_area: 100000
- min_score: 0.5
- threshold: 0.7
- # Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
- # Checks based on the bottom center of the bounding box of the object
- mask: 0,0,1000,0,1000,200,0,200
-```
-
-## Clips
-
-Frigate can save video clips without any CPU overhead for encoding by simply copying the stream directly with FFmpeg. It leverages FFmpeg's segment functionality to maintain a cache of video for each camera. The cache files are written to disk at `/tmp/cache` and do not introduce memory overhead. When an object is being tracked, it will extend the cache to ensure it can assemble a clip when the event ends. Once the event ends, it again uses FFmpeg to assemble a clip by combining the video clips without any encoding by the CPU. Assembled clips are are saved to `/media/frigate/clips`. Clips are retained according to the retention settings defined on the config for each object type.
-
-These clips will not be playable in the web UI or in Home Assistant's media browser unless your camera sends video as h264.
-
-:::caution
-Previous versions of frigate included `-vsync drop` in input parameters. This is not compatible with FFmpeg's segment feature and must be removed from your input parameters if you have overrides set.
-:::
-
-```yaml
-clips:
- # Required: enables clips for the camera (default: shown below)
- # This value can be set via MQTT and will be updated in startup based on retained value
- enabled: False
- # Optional: Number of seconds before the event to include in the clips (default: shown below)
- pre_capture: 5
- # Optional: Number of seconds after the event to include in the clips (default: shown below)
- post_capture: 5
- # Optional: Objects to save clips for. (default: all tracked objects)
- objects:
- - person
- # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
- required_zones: []
- # Optional: Camera override for retention settings (default: global values)
- retain:
- # Required: Default retention days (default: shown below)
- default: 10
- # Optional: Per object retention days
- objects:
- person: 15
-```
-
-## Snapshots
-
-Frigate can save a snapshot image to `/media/frigate/clips` for each event named as `