diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d424c6bf8..262db5ab4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,7 +13,7 @@ updates: open-pull-requests-limit: 10 target-branch: dev - package-ecosystem: "pip" - directory: "/" + directory: "/docker/main" schedule: interval: daily open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98ef86506..face11a9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,14 +21,14 @@ jobs: name: AMD64 Build steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU and Buildx id: setup uses: ./.github/actions/setup with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build and push amd64 standard build - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . file: docker/main/Dockerfile @@ -38,7 +38,7 @@ jobs: tags: ${{ steps.setup.outputs.image-name }}-amd64 cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64 - name: Build and push TensorRT (x86 GPU) - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: push: true targets: tensorrt @@ -52,14 +52,14 @@ jobs: name: ARM Build steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU and Buildx id: setup uses: ./.github/actions/setup with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build and push arm64 standard build - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . file: docker/main/Dockerfile @@ -70,7 +70,7 @@ jobs: ${{ steps.setup.outputs.image-name }}-standard-arm64 cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64 - name: Build and push RPi build - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: push: true targets: rpi @@ -84,7 +84,7 @@ jobs: name: Jetson Jetpack 4 steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU and Buildx id: setup uses: ./.github/actions/setup @@ -96,7 +96,7 @@ jobs: BASE_IMAGE: timongentzsch/l4t-ubuntu20-opencv:latest SLIM_BASE: timongentzsch/l4t-ubuntu20-opencv:latest TRT_BASE: timongentzsch/l4t-ubuntu20-opencv:latest - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: push: true targets: tensorrt @@ -110,7 +110,7 @@ jobs: name: Jetson Jetpack 5 steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU and Buildx id: setup uses: ./.github/actions/setup @@ -122,7 +122,7 @@ jobs: BASE_IMAGE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime SLIM_BASE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime TRT_BASE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: push: true targets: tensorrt @@ -145,7 +145,7 @@ jobs: with: string: ${{ github.repository }} - name: Log in to the Container registry - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d with: registry: ghcr.io username: ${{ github.actor }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6b4739abb..d5a8d049a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,7 +15,7 @@ jobs: env: DOCKER_BUILDKIT: "1" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@master with: node-version: 16.x @@ -34,7 +34,7 @@ jobs: name: Web - Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@master with: node-version: 16.x @@ -48,7 +48,7 @@ jobs: name: Web - Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@master with: node-version: 16.x @@ -63,7 +63,7 @@ jobs: name: Python Checks steps: - name: Check out the repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} uses: actions/setup-python@v4.7.0 with: @@ -87,7 +87,7 @@ jobs: name: Python Tests steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@master with: node-version: 16.x @@ -97,9 +97,9 @@ jobs: run: npm run build working-directory: ./web - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build run: make - name: Run mypy diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 8625a63a8..aee067b25 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.4 +# syntax=docker/dockerfile:1.6 # https://askubuntu.com/questions/972516/debian-frontend-environment-variable ARG DEBIAN_FRONTEND=noninteractive @@ -33,7 +33,7 @@ RUN --mount=type=tmpfs,target=/tmp --mount=type=tmpfs,target=/var/cache/apt \ FROM scratch AS go2rtc ARG TARGETARCH WORKDIR /rootfs/usr/local/go2rtc/bin -ADD --link --chmod=755 "https://github.com/AlexxIT/go2rtc/releases/download/v1.6.2/go2rtc_linux_${TARGETARCH}" go2rtc +ADD --link --chmod=755 "https://github.com/AlexxIT/go2rtc/releases/download/v1.8.1/go2rtc_linux_${TARGETARCH}" go2rtc #### @@ -121,13 +121,15 @@ RUN apt-get -qq update \ apt-transport-https \ gnupg \ wget \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://deb.debian.org/debian bullseye main contrib non-free" | tee /etc/apt/sources.list.d/raspi.list \ + # the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html + && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \ + gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \ + tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \ && apt-get -qq update \ && apt-get -qq install -y \ python3.9 \ python3.9-dev \ - wget \ # opencv dependencies build-essential cmake git pkg-config libgtk-3-dev \ libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ @@ -199,6 +201,9 @@ ENV S6_LOGGING_SCRIPT="T 1 n0 s10000000 T" ENTRYPOINT ["/init"] CMD [] +HEALTHCHECK --start-period=120s --start-interval=5s --interval=15s --timeout=5s --retries=3 \ + CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1 + # Frigate deps with Node.js and NPM for devcontainer FROM deps AS devcontainer diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index 61ece1b76..43fff479b 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -55,17 +55,16 @@ fi # arch specific packages if [[ "${TARGETARCH}" == "amd64" ]]; then - # Use debian testing repo only for hwaccel packages - echo 'deb http://deb.debian.org/debian testing main non-free' >/etc/apt/sources.list.d/debian-testing.list + # use debian bookworm for hwaccel packages + echo 'deb https://deb.debian.org/debian bookworm main contrib non-free' >/etc/apt/sources.list.d/debian-bookworm.list apt-get -qq update - # intel-opencl-icd specifically for GPU support in OpenVino apt-get -qq install --no-install-recommends --no-install-suggests -y \ intel-opencl-icd \ - mesa-va-drivers libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 radeontop intel-gpu-tools + mesa-va-drivers radeontop libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 intel-gpu-tools # something about this dependency requires it to be installed in a separate call rather than in the line above apt-get -qq install --no-install-recommends --no-install-suggests -y \ i965-va-driver-shaders - rm -f /etc/apt/sources.list.d/debian-testing.list + rm -f /etc/apt/sources.list.d/debian-bookworm.list fi if [[ "${TARGETARCH}" == "arm64" ]]; then diff --git a/docker/main/requirements-wheels.txt b/docker/main/requirements-wheels.txt index 322d53a46..c245285a1 100644 --- a/docker/main/requirements-wheels.txt +++ b/docker/main/requirements-wheels.txt @@ -8,18 +8,18 @@ onvif_zeep == 0.2.12 opencv-python-headless == 4.7.0.* paho-mqtt == 1.6.* peewee == 3.16.* -peewee_migrate == 1.11.* +peewee_migrate == 1.12.* psutil == 5.9.* pydantic == 1.10.* git+https://github.com/fbcotter/py3nvml#egg=py3nvml -PyYAML == 6.0 +PyYAML == 6.0.* pytz == 2023.3 ruamel.yaml == 0.17.* tzlocal == 5.0.* types-PyYAML == 6.0.* requests == 2.31.* types-requests == 2.31.* -scipy == 1.10.* +scipy == 1.11.* norfair == 2.2.* setproctitle == 1.3.* ws4py == 0.5.* diff --git a/docker/main/rootfs/usr/local/go2rtc/create_config.py b/docker/main/rootfs/usr/local/go2rtc/create_config.py index aefed5f83..7d69dc415 100644 --- a/docker/main/rootfs/usr/local/go2rtc/create_config.py +++ b/docker/main/rootfs/usr/local/go2rtc/create_config.py @@ -100,12 +100,25 @@ for name in go2rtc_config.get("streams", {}): stream = go2rtc_config["streams"][name] if isinstance(stream, str): - go2rtc_config["streams"][name] = go2rtc_config["streams"][name].format( - **FRIGATE_ENV_VARS - ) + try: + go2rtc_config["streams"][name] = go2rtc_config["streams"][name].format( + **FRIGATE_ENV_VARS + ) + except KeyError as e: + print( + "[ERROR] Invalid substitution found, see https://docs.frigate.video/configuration/restream#advanced-restream-configurations for more info." + ) + sys.exit(e) + elif isinstance(stream, list): for i, stream in enumerate(stream): - go2rtc_config["streams"][name][i] = stream.format(**FRIGATE_ENV_VARS) + try: + go2rtc_config["streams"][name][i] = stream.format(**FRIGATE_ENV_VARS) + except KeyError as e: + print( + "[ERROR] Invalid substitution found, see https://docs.frigate.video/configuration/restream#advanced-restream-configurations for more info." + ) + sys.exit(e) # add birdseye restream stream if enabled if config.get("birdseye", {}).get("restream", False): diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf index 35703fb2c..a857461b5 100644 --- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf @@ -93,10 +93,6 @@ http { 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 '*'; add_header Cache-Control "no-store"; expires off; } @@ -104,16 +100,6 @@ http { location /stream/ { add_header Cache-Control "no-store"; expires off; - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Credentials' 'true'; - add_header 'Access-Control-Expose-Headers' 'Content-Length'; - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' "$http_origin"; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain charset=UTF-8'; - add_header 'Content-Length' 0; - return 204; - } types { application/dash+xml mpd; @@ -126,16 +112,6 @@ http { } location /clips/ { - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Credentials' 'true'; - add_header 'Access-Control-Expose-Headers' 'Content-Length'; - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' "$http_origin"; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain charset=UTF-8'; - add_header 'Content-Length' 0; - return 204; - } types { video/mp4 mp4; @@ -152,17 +128,6 @@ http { } location /recordings/ { - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Credentials' 'true'; - add_header 'Access-Control-Expose-Headers' 'Content-Length'; - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' "$http_origin"; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain charset=UTF-8'; - add_header 'Content-Length' 0; - return 204; - } - types { video/mp4 mp4; } @@ -173,17 +138,6 @@ http { } location /exports/ { - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Credentials' 'true'; - add_header 'Access-Control-Expose-Headers' 'Content-Length'; - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' "$http_origin"; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain charset=UTF-8'; - add_header 'Content-Length' 0; - return 204; - } - types { video/mp4 mp4; } @@ -235,8 +189,6 @@ http { } location ~* /api/.*\.(jpg|jpeg|png)$ { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; rewrite ^/api/(.*)$ $1 break; proxy_pass http://frigate_api; proxy_pass_request_headers on; @@ -248,10 +200,6 @@ http { location /api/ { add_header Cache-Control "no-store"; expires off; - - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; proxy_pass http://frigate_api/; proxy_pass_request_headers on; proxy_set_header Host $host; diff --git a/docker/tensorrt/Dockerfile.base b/docker/tensorrt/Dockerfile.base index 331a328b7..b0015016d 100644 --- a/docker/tensorrt/Dockerfile.base +++ b/docker/tensorrt/Dockerfile.base @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.4 +# syntax=docker/dockerfile:1.6 # https://askubuntu.com/questions/972516/debian-frontend-environment-variable ARG DEBIAN_FRONTEND=noninteractive @@ -24,3 +24,6 @@ COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_laye COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos COPY docker/tensorrt/detector/rootfs/ / ENV YOLO_MODELS="yolov7-320" + +HEALTHCHECK --start-period=600s --start-interval=5s --interval=15s --timeout=5s --retries=3 \ + CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1 diff --git a/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run b/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run index 93b132a38..c39c7a0aa 100755 --- a/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run +++ b/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run @@ -43,6 +43,15 @@ if [[ -z ${MODEL_CONVERT} ]]; then exit 0 fi +# Setup ENV to select GPU for conversion +if [ ! -z ${TRT_MODEL_PREP_DEVICE+x} ]; then + if [ ! -z ${CUDA_VISIBLE_DEVICES+x} ]; then + PREVIOUS_CVD="$CUDA_VISIBLE_DEVICES" + unset CUDA_VISIBLE_DEVICES + fi + export CUDA_VISIBLE_DEVICES="$TRT_MODEL_PREP_DEVICE" +fi + # On Jetpack 4.6, the nvidia container runtime will mount several host nvidia libraries into the # container which should not be present in the image - if they are, TRT model generation will # fail or produce invalid models. Thus we must request the user to install them on the host in @@ -87,5 +96,14 @@ do echo "Generated ${model}.trt in $(($(date +%s)-start)) seconds" done +# Restore ENV after conversion +if [ ! -z ${TRT_MODEL_PREP_DEVICE+x} ]; then + unset CUDA_VISIBLE_DEVICES + if [ ! -z ${PREVIOUS_CVD+x} ]; then + export CUDA_VISIBLE_DEVICES="$PREVIOUS_CVD" + fi +fi + +# Print which models exist in output folder echo "Available tensorrt models:" cd ${OUTPUT_FOLDER} && ls *.trt; diff --git a/docs/docs/configuration/advanced.md b/docs/docs/configuration/advanced.md index bc1a7c421..d652b3526 100644 --- a/docs/docs/configuration/advanced.md +++ b/docs/docs/configuration/advanced.md @@ -120,7 +120,7 @@ NOTE: The folder that is mapped from the host needs to be the folder that contai ## Custom go2rtc version -Frigate currently includes go2rtc v1.6.2, there may be certain cases where you want to run a different version of go2rtc. +Frigate currently includes go2rtc v1.8.1, there may be certain cases where you want to run a different version of go2rtc. To do this: diff --git a/docs/docs/configuration/audio_detectors.md b/docs/docs/configuration/audio_detectors.md index 3e5fafdf8..b783daa69 100644 --- a/docs/docs/configuration/audio_detectors.md +++ b/docs/docs/configuration/audio_detectors.md @@ -48,15 +48,26 @@ cameras: - detect ``` +### Configuring Minimum Volume + +The audio detector uses volume levels in the same way that motion in a camera feed is used for object detection. This means that frigate will not run audio detection unless the audio volume is above the configured level in order to reduce resource usage. Audio levels can vary widely between camera models so it is important to run tests to see what volume levels are. MQTT explorer can be used on the audio topic to see what volume level is being detected. + +:::tip + +Volume is considered motion for recordings, this means when the `record -> retain -> mode` is set to `motion` any time audio volume is > min_volume that recording segment for that camera will be kept. + +::: + ### Configuring Audio Events -The included audio model has over [500 different types](https://github.com/blakeblackshear/frigate/blob/dev/audio-labelmap.txt) of audio that can be detected, many of which are not practical. By default `bark`, `speech`, `yell`, and `scream` are enabled but these can be customized. +The included audio model has over [500 different types](https://github.com/blakeblackshear/frigate/blob/dev/audio-labelmap.txt) of audio that can be detected, many of which are not practical. By default `bark`, `fire_alarm`, `scream`, `speech`, and `yell` are enabled but these can be customized. ```yaml audio: enabled: True listen: - bark + - fire_alarm - scream - speech - yell diff --git a/docs/docs/configuration/autotracking.md b/docs/docs/configuration/autotracking.md index 918cbcb43..2e5e52f7f 100644 --- a/docs/docs/configuration/autotracking.md +++ b/docs/docs/configuration/autotracking.md @@ -5,6 +5,8 @@ title: Camera Autotracking An ONVIF-capable, PTZ (pan-tilt-zoom) camera that supports relative movement within the field of view (FOV) can be configured to automatically track moving objects and keep them in the center of the frame. +![Autotracking example with zooming](/img/frigate-autotracking-example.gif) + ## Autotracking behavior Once Frigate determines that an object is not a false positive and has entered one of the required zones, the autotracker will move the PTZ camera to keep the object centered in the frame until the object either moves out of the frame, the PTZ is not capable of any more movement, or Frigate loses track of it. @@ -50,6 +52,23 @@ cameras: autotracking: # Optional: enable/disable object autotracking. (default: shown below) enabled: False + # Optional: calibrate the camera on startup (default: shown below) + # A calibration will move the PTZ in increments and measure the time it takes to move. + # The results are used to help estimate the position of tracked objects after a camera move. + # Frigate will update your config file automatically after a calibration with + # a "movement_weights" entry for the camera. You should then set calibrate_on_startup to False. + calibrate_on_startup: False + # Optional: the mode to use for zooming in/out on objects during autotracking. (default: shown below) + # Available options are: disabled, absolute, and relative + # disabled - don't zoom in/out on autotracked objects, use pan/tilt only + # absolute - use absolute zooming (supported by most PTZ capable cameras) + # relative - use relative zooming (not supported on all PTZs, but makes concurrent pan/tilt/zoom movements) + zooming: disabled + # Optional: A value to change the behavior of zooming on autotracked objects. (default: shown below) + # A lower value will keep more of the scene in view around a tracked object. + # A higher value will zoom in more on a tracked object, but Frigate may lose tracking more quickly. + # The value should be between 0.1 and 0.75 + zoom_factor: 0.3 # Optional: list of objects to track from labelmap.txt (default: shown below) track: - person @@ -60,17 +79,47 @@ cameras: return_preset: home # Optional: Seconds to delay before returning to preset. (default: shown below) timeout: 10 + # Optional: Values generated automatically by a camera calibration. Do not modify these manually. (default: shown below) + movement_weights: [] ``` +## Calibration + +PTZ motors operate at different speeds. Performing a calibration will direct Frigate to measure this speed over a variety of movements and use those measurements to better predict the amount of movement necessary to keep autotracked objects in the center of the frame. + +Calibration is optional, but will greatly assist Frigate in autotracking objects that move across the camera's field of view more quickly. + +To begin calibration, set the `calibrate_on_startup` for your camera to `True` and restart Frigate. Frigate will then make a series of 30 small and large movements with your camera. Don't move the PTZ manually while calibration is in progress. Once complete, camera motion will stop and your config file will be automatically updated with a `movement_weights` parameter to be used in movement calculations. You should not modify this parameter manually. + +After calibration has ended, your PTZ will be moved to the preset specified by `return_preset` and you should set `calibrate_on_startup` in your config file to `False`. + +Note that Frigate will refine and update the `movement_weights` parameter in your config automatically as the PTZ moves during autotracking and more measurements are obtained. + +You can recalibrate at any time by removing the `movement_weights` parameter, setting `calibrate_on_startup` to `True`, and then restarting Frigate. You may need to recalibrate or remove `movement_weights` from your config altogether if autotracking is erratic. If you change your `return_preset` in any way, a recalibration is also recommended. + ## Best practices and considerations Every PTZ camera is different, so autotracking may not perform ideally in every situation. This experimental feature was initially developed using an EmpireTech/Dahua SD1A404XB-GNR. The object tracker in Frigate estimates the motion of the PTZ so that tracked objects are preserved when the camera moves. In most cases (especially for faster moving objects), the default 5 fps is insufficient for the motion estimator to perform accurately. 10 fps is the current recommendation. Higher frame rates will likely not be more performant and will only slow down Frigate and the motion estimator. Adjust your camera to output at least 10 frames per second and change the `fps` parameter in the [detect configuration](index.md) of your configuration file. -A fast [detector](object_detectors.md) is recommended. CPU detectors will not perform well or won't work at all. If Frigate already has trouble keeping track of your object, the autotracker will struggle as well. +A fast [detector](object_detectors.md) is recommended. CPU detectors will not perform well or won't work at all. You can watch Frigate's debug viewer for your camera to see a thicker colored box around the object currently being autotracked. -The autotracker will add PTZ motion requests to a queue while the motor is moving. Once the motor stops, the events in the queue will be executed together as one large move (rather than incremental moves). If your PTZ's motor is slow, you may not be able to reliably autotrack fast moving objects. +![Autotracking Debug View](/img/autotracking-debug.gif) + +A full-frame zone in `required_zones` is not recommended, especially if you've calibrated your camera and there are `movement_weights` defined in the configuration file. Frigate will continue to autotrack an object that has entered one of the `required_zones`, even if it moves outside of that zone. + +## Zooming + +Zooming is still a very experimental feature and may use significantly more CPU when tracking objects than panning/tilting only. It may be helpful to tweak your camera's autofocus settings if you are noticing focus problems when using zooming. + +Absolute zooming makes zoom movements separate from pan/tilt movements. Most PTZ cameras will support absolute zooming. + +Relative zooming attempts to make a zoom movement concurrently with any pan/tilt movements. It was tested to work with some Dahua and Amcrest PTZs. But the ONVIF specification indicates that there no assumption about how the generic zoom range is mapped to magnification, field of view or other physical zoom dimension when using relative zooming. So if relative zooming behavior is erratic or just doesn't work, use absolute zooming. + +You can optionally adjust the `zoom_factor` for your camera in your configuration file. Lower values will leave more space from the scene around the tracked object while higher values will cause your camera to zoom in more on the object. However, keep in mind that Frigate needs a fair amount of pixels and scene details outside of the bounding box of the tracked object to estimate the motion of your camera. If the object is taking up too much of the frame, Frigate will not be able to track the motion of the camera and your object will be lost. + +The range of this option is from 0.1 to 0.75. The default value of 0.3 should be sufficient for most users. If you have a powerful zoom lens on your PTZ or you find your autotracked objects are often lost, you may want to lower this value. Because every PTZ and scene is different, you should experiment to determine what works best for you. ## Usage applications diff --git a/docs/docs/configuration/camera_specific.md b/docs/docs/configuration/camera_specific.md index bbfb03778..2567b2c81 100644 --- a/docs/docs/configuration/camera_specific.md +++ b/docs/docs/configuration/camera_specific.md @@ -80,8 +80,8 @@ cameras: rtmp: enabled: False # <-- RTMP should be disabled if your stream is not H264 detect: - width: # <- optional, by default Frigate tries to automatically detect resolution - height: # <- optional, by default Frigate tries to automatically detect resolution + width: # <- optional, by default Frigate tries to automatically detect resolution + height: # <- optional, by default Frigate tries to automatically detect resolution ``` ### Blue Iris RTSP Cameras @@ -108,20 +108,20 @@ According to [this discussion](https://github.com/blakeblackshear/frigate/issues ```yaml go2rtc: streams: - your_reolink_camera: + your_reolink_camera: - "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password#video=copy#audio=copy#audio=opus" - your_reolink_camera_sub: + your_reolink_camera_sub: - "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=username&password=password" cameras: - reolink: + your_reolink_camera: ffmpeg: inputs: - - path: rtsp://127.0.0.1:8554/your_reolink_camera?video=copy&audio=aac + - path: rtsp://127.0.0.1:8554/your_reolink_camera input_args: preset-rtsp-restream roles: - record - - path: rtsp://127.0.0.1:8554/your_reolink_camera_sub?video=copy + - path: rtsp://127.0.0.1:8554/your_reolink_camera_sub input_args: preset-rtsp-restream roles: - detect @@ -140,7 +140,7 @@ go2rtc: - rtspx://192.168.1.1:7441/abcdefghijk ``` -[See the go2rtc docs for more information](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#source-rtsp) +[See the go2rtc docs for more information](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#source-rtsp) In the Unifi 2.0 update Unifi Protect Cameras had a change in audio sample rate which causes issues for ffmpeg. The input rate needs to be set for record and rtmp if used directly with unifi protect. @@ -150,3 +150,7 @@ ffmpeg: record: preset-record-ubiquiti rtmp: preset-rtmp-ubiquiti # recommend using go2rtc instead ``` + +### TP-Link VIGI Cameras + +TP-Link VIGI cameras need some adjustments to the main stream settings on the camera itself to avoid issues. The stream needs to be configured as `H264` with `Smart Coding` set to `off`. Without these settings you may have problems when trying to watch recorded events. For example Firefox will stop playback after a few seconds and show the following error message: `The media playback was aborted due to a corruption problem or because the media used features your browser did not support.`. diff --git a/docs/docs/configuration/cameras.md b/docs/docs/configuration/cameras.md index fd4b53a69..58bf2bdc6 100644 --- a/docs/docs/configuration/cameras.md +++ b/docs/docs/configuration/cameras.md @@ -11,11 +11,12 @@ A camera is enabled by default but can be temporarily disabled by using `enabled 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 | -| `record` | Saves segments of the video feed based on configuration settings. [docs](record.md) | -| `rtmp` | Deprecated: Broadcast as an RTMP feed for other services to consume. [docs](restream.md) | +| Role | Description | +| -------- | ---------------------------------------------------------------------------------------- | +| `detect` | Main feed for object detection. [docs](object_detectors.md) | +| `record` | Saves segments of the video feed based on configuration settings. [docs](record.md) | +| `audio` | Feed for audio based detection. [docs](audio_detectors.md) | +| `rtmp` | Deprecated: Broadcast as an RTMP feed for other services to consume. [docs](restream.md) | ```yaml mqtt: @@ -51,13 +52,18 @@ For camera model specific settings check the [camera specific](camera_specific.m ## Setting up camera PTZ controls -Add onvif config to camera +:::caution + +Not every PTZ supports ONVIF, which is the standard protocol Frigate uses to communicate with your camera. Check the [official list of ONVIF conformant products](https://www.onvif.org/conformant-products/), your camera documentation, or camera manufacturer's website to ensure your PTZ supports ONVIF. Also, ensure your camera is running the latest firmware. + +::: + +Add the onvif section to your camera in your configuration file: ```yaml cameras: back: - ffmpeg: - ... + ffmpeg: ... onvif: host: 10.0.10.10 port: 8000 @@ -65,6 +71,25 @@ cameras: password: password ``` -then PTZ controls will be available in the cameras WebUI. +If the ONVIF connection is successful, PTZ controls will be available in the camera's WebUI. An ONVIF-capable camera that supports relative movement within the field of view (FOV) can also be configured to automatically track moving objects and keep them in the center of the frame. For autotracking setup, see the [autotracking](autotracking.md) docs. + +## ONVIF PTZ camera recommendations + +This list of working and non-working PTZ cameras is based on user feedback. + +| Brand or specific camera | PTZ Controls | Autotracking | Notes | +| ------------------------ | :----------: | :----------: | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| Amcrest | ✅ | ✅ | ⛔️ Generally, Amcrest should work, but some older models (like the common IP2M-841) don't support autotracking | +| Amcrest ASH21 | ❌ | ❌ | No ONVIF support | +| Ctronics PTZ | ✅ | ❌ | | +| Dahua | ✅ | ✅ | | +| Foscam R5 | ✅ | ❌ | | +| Hikvision | ✅ | ❌ | Incomplete ONVIF support (MoveStatus won't update even on latest firmware) - reported with HWP-N4215IH-DE and DS-2DE3304W-DE, but likely others | +| Reolink 511WA | ✅ | ❌ | Zoom only | +| Reolink E1 Pro | ✅ | ❌ | | +| Reolink E1 Zoom | ✅ | ❌ | | +| Sunba 405-D20X | ✅ | ❌ | | +| Tapo C210 | ❌ | ❌ | Incomplete ONVIF support | +| Vikylin PTZ-2804X-I2 | ❌ | ❌ | Incomplete ONVIF support | diff --git a/docs/docs/configuration/hardware_acceleration.md b/docs/docs/configuration/hardware_acceleration.md index 3241c4b77..0c429d48d 100644 --- a/docs/docs/configuration/hardware_acceleration.md +++ b/docs/docs/configuration/hardware_acceleration.md @@ -64,11 +64,10 @@ ffmpeg: ### Configuring Intel GPU Stats in Docker -Additional configuration is needed for the Docker container to be able to access the `intel_gpu_top` command for GPU stats. Three possible changes can be made: +Additional configuration is needed for the Docker container to be able to access the `intel_gpu_top` command for GPU stats. There are two options: 1. Run the container as privileged. -2. Adding the `CAP_PERFMON` capability. -3. Setting the `perf_event_paranoid` low enough to allow access to the performance event system. +2. Add the `CAP_PERFMON` capability (note: you might need to set the `perf_event_paranoid` low enough to allow access to the performance event system.) #### Run as privileged @@ -125,7 +124,7 @@ _Note: This setting must be changed for the entire system._ For more information on the various values across different distributions, see https://askubuntu.com/questions/1400874/what-does-perf-paranoia-level-four-do. -Depending on your OS and kernel configuration, you may need to change the `/proc/sys/kernel/perf_event_paranoid` kernel tunable. You can test the change by running `sudo sh -c 'echo 2 >/proc/sys/kernel/perf_event_paranoid'` which will persist until a reboot. Make it permanent by running `sudo sh -c 'echo kernel.perf_event_paranoid=1 >> /etc/sysctl.d/local.conf'` +Depending on your OS and kernel configuration, you may need to change the `/proc/sys/kernel/perf_event_paranoid` kernel tunable. You can test the change by running `sudo sh -c 'echo 2 >/proc/sys/kernel/perf_event_paranoid'` which will persist until a reboot. Make it permanent by running `sudo sh -c 'echo kernel.perf_event_paranoid=2 >> /etc/sysctl.d/local.conf'` ## AMD/ATI GPUs (Radeon HD 2000 and newer GPUs) via libva-mesa-driver diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 4442b3b57..f659b5339 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -151,6 +151,7 @@ audio: # Optional: Types of audio to listen for (default: shown below) listen: - bark + - fire_alarm - scream - speech - yell @@ -323,7 +324,7 @@ motion: # 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.01 - # Optional: Height of the resized motion frame (default: 50) + # Optional: Height of the resized motion frame (default: 100) # 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: 100 @@ -361,6 +362,16 @@ record: # active_objects - save all recording segments with active/moving objects # NOTE: this mode only applies when the days setting above is greater than 0 mode: all + # Optional: Recording Export Settings + export: + # Optional: Timelapse Output Args (default: shown below). + # NOTE: The default args are set to fit 24 hours of recording into 1 hour playback. + # See https://stackoverflow.com/a/58268695 for more info on how these args work. + # As an example: if you wanted to go from 24 hours to 30 minutes that would be going + # from 86400 seconds to 1800 seconds which would be 1800 / 86400 = 0.02. + # The -r (framerate) dictates how smooth the output video is. + # So the args would be -vf setpts=0.02*PTS -r 30 in that case. + timelapse_args: "-vf setpts=0.04*PTS -r 30" # Optional: Event recording settings events: # Optional: Number of seconds before the event to include (default: shown below) @@ -425,7 +436,7 @@ rtmp: enabled: False # Optional: Restream configuration -# Uses https://github.com/AlexxIT/go2rtc (v1.6.2) +# Uses https://github.com/AlexxIT/go2rtc (v1.8.1) go2rtc: # Optional: jsmpeg stream configuration for WebUI @@ -516,7 +527,7 @@ cameras: # Required: List of x,y coordinates to define the polygon of the zone. # NOTE: Presence in a zone is evaluated only based on the bottom center of the objects bounding box. coordinates: 545,1077,747,939,788,805 - # Optional: Number of consecutive frames required for object to be considered present in the zone. Allowed values are 1-10 (default: shown below) + # Optional: Number of consecutive frames required for object to be considered present in the zone (default: shown below). inertia: 3 # Optional: List of objects that can trigger this zone (default: all tracked objects) objects: @@ -573,6 +584,23 @@ cameras: autotracking: # Optional: enable/disable object autotracking. (default: shown below) enabled: False + # Optional: calibrate the camera on startup (default: shown below) + # A calibration will move the PTZ in increments and measure the time it takes to move. + # The results are used to help estimate the position of tracked objects after a camera move. + # Frigate will update your config file automatically after a calibration with + # a "movement_weights" entry for the camera. You should then set calibrate_on_startup to False. + calibrate_on_startup: False + # Optional: the mode to use for zooming in/out on objects during autotracking. (default: shown below) + # Available options are: disabled, absolute, and relative + # disabled - don't zoom in/out on autotracked objects, use pan/tilt only + # absolute - use absolute zooming (supported by most PTZ capable cameras) + # relative - use relative zooming (not supported on all PTZs, but makes concurrent pan/tilt/zoom movements) + zooming: disabled + # Optional: A value to change the behavior of zooming on autotracked objects. (default: shown below) + # A lower value will keep more of the scene in view around a tracked object. + # A higher value will zoom in more on a tracked object, but Frigate may lose tracking more quickly. + # The value should be between 0.1 and 0.75 + zoom_factor: 0.3 # Optional: list of objects to track from labelmap.txt (default: shown below) track: - person @@ -580,9 +608,11 @@ cameras: required_zones: - zone_name # Required: Name of ONVIF preset in camera's firmware to return to when tracking is over. (default: shown below) - return_preset: preset_name + return_preset: home # Optional: Seconds to delay before returning to preset. (default: shown below) timeout: 10 + # Optional: Values generated automatically by a camera calibration. Do not modify these manually. (default: shown below) + movement_weights: [] # Optional: Configuration for how to sort the cameras in the Birdseye view. birdseye: @@ -624,7 +654,7 @@ ui: # Optional: Telemetry configuration telemetry: - # Optional: Enabled network interfaces for bandwidth stats monitoring (default: shown below) + # Optional: Enabled network interfaces for bandwidth stats monitoring (default: empty list, let nethogs search all) network_interfaces: - eth - enp @@ -639,6 +669,7 @@ telemetry: # Enable Intel GPU stats (default: shown below) intel_gpu_stats: True # Enable network bandwidth stats monitoring for camera ffmpeg processes, go2rtc, and object detectors. (default: shown below) + # NOTE: The container must either be privileged or have cap_net_admin, cap_net_raw capabilities enabled. network_bandwidth: False # Optional: Enable the latest version outbound check (default: shown below) # NOTE: If you use the HomeAssistant integration, disabling this will prevent it from reporting new versions diff --git a/docs/docs/configuration/live.md b/docs/docs/configuration/live.md index 63d83e4d9..452daa68c 100644 --- a/docs/docs/configuration/live.md +++ b/docs/docs/configuration/live.md @@ -9,11 +9,11 @@ Frigate has different live view options, some of which require the bundled `go2r Live view options can be selected while viewing the live stream. The options are: -| Source | Latency | Frame Rate | Resolution | Audio | Requires go2rtc | Other Limitations | -| ------ | ------- | ------------------------------------- | -------------- | ---------------------------- | --------------- | -------------------------------------------- | -| jsmpeg | low | same as `detect -> fps`, capped at 10 | same as detect | no | no | none | -| mse | low | native | native | yes (depends on audio codec) | yes | not supported on iOS, Firefox is h.264 only | -| webrtc | lowest | native | native | yes (depends on audio codec) | yes | requires extra config, doesn't support h.265 | +| Source | Latency | Frame Rate | Resolution | Audio | Requires go2rtc | Other Limitations | +| ------ | ------- | ------------------------------------- | -------------- | ---------------------------- | --------------- | ------------------------------------------------- | +| jsmpeg | low | same as `detect -> fps`, capped at 10 | same as detect | no | no | none | +| mse | low | native | native | yes (depends on audio codec) | yes | iPhone requires iOS 17.1+, Firefox is h.264 only | +| webrtc | lowest | native | native | yes (depends on audio codec) | yes | requires extra config, doesn't support h.265 | ### Audio Support @@ -37,12 +37,12 @@ There may be some cameras that you would prefer to use the sub stream for live v ```yaml go2rtc: streams: - rtsp_cam: + test_cam: - rtsp://192.168.1.5:554/live0 # <- stream which supports video & aac audio. - - "ffmpeg:rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to opus - rtsp_cam_sub: + - "ffmpeg:test_cam#audio=opus" # <- copy of the stream which transcodes audio to opus for webrtc + test_cam_sub: - rtsp://192.168.1.5:554/substream # <- stream which supports video & aac audio. - - "ffmpeg:rtsp_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus + - "ffmpeg:test_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus for webrtc cameras: test_cam: @@ -59,7 +59,7 @@ cameras: roles: - detect live: - stream_name: rtsp_cam_sub + stream_name: test_cam_sub ``` ### WebRTC extra configuration: @@ -78,7 +78,7 @@ WebRTC works by creating a TCP or UDP connection on port `8555`. However, it req - 192.168.1.10:8555 - stun:8555 ``` - + - For access through Tailscale, the Frigate system's Tailscale IP must be added as a WebRTC candidate. Tailscale IPs all start with `100.`, and are reserved within the `100.0.0.0/8` CIDR block. :::tip @@ -115,4 +115,4 @@ services: ::: -See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#module-webrtc) for more information about this. +See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#module-webrtc) for more information about this. diff --git a/docs/docs/configuration/object_detectors.md b/docs/docs/configuration/object_detectors.md index 10117a504..e1847ead4 100644 --- a/docs/docs/configuration/object_detectors.md +++ b/docs/docs/configuration/object_detectors.md @@ -235,10 +235,18 @@ An example `docker-compose.yml` fragment that converts the `yolov4-608` and `yol ```yml frigate: environment: - - YOLO_MODELS="yolov4-608,yolov7x-640" + - YOLO_MODELS=yolov4-608,yolov7x-640 - USE_FP16=false ``` +If you have multiple GPUs passed through to Frigate, you can specify which one to use for the model conversion. The conversion script will use the first visible GPU, however in systems with mixed GPU models you may not want to use the default index for object detection. Add the `TRT_MODEL_PREP_DEVICE` environment variable to select a specific GPU. + +```yml +frigate: + environment: + - TRT_MODEL_PREP_DEVICE=0 # Optionally, select which GPU is used for model optimization +``` + ### Configuration Parameters The TensorRT detector can be selected by specifying `tensorrt` as the model type. The GPU will need to be passed through to the docker container using the same methods described in the [Hardware Acceleration](hardware_acceleration.md#nvidia-gpu) section. If you pass through multiple GPUs, you can select which GPU is used for a detector with the `device` configuration parameter. The `device` parameter is an integer value of the GPU index, as shown by `nvidia-smi` within the container. diff --git a/docs/docs/configuration/restream.md b/docs/docs/configuration/restream.md index 7f4c73717..319884ff0 100644 --- a/docs/docs/configuration/restream.md +++ b/docs/docs/configuration/restream.md @@ -7,7 +7,7 @@ title: Restream Frigate can restream your video feed as an RTSP feed for other applications such as Home Assistant to utilize it at `rtsp://:8554/`. Port 8554 must be open. [This allows you to use a video feed for detection in Frigate and Home Assistant live view at the same time without having to make two separate connections to the camera](#reduce-connections-to-camera). The video feed is copied from the original video feed directly to avoid re-encoding. This feed does not include any annotation by Frigate. -Frigate uses [go2rtc](https://github.com/AlexxIT/go2rtc/tree/v1.6.2) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `go2rtc` in the config, see [go2rtc docs](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#configuration) for more advanced configurations and features. +Frigate uses [go2rtc](https://github.com/AlexxIT/go2rtc/tree/v1.8.1) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `go2rtc` in the config, see [go2rtc docs](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#configuration) for more advanced configurations and features. :::note @@ -53,31 +53,31 @@ One connection is made to the camera. One for the restream, `detect` and `record ```yaml go2rtc: streams: - rtsp_cam: # <- for RTSP streams + name_your_rtsp_cam: # <- for RTSP streams - rtsp://192.168.1.5:554/live0 # <- stream which supports video & aac audio - - "ffmpeg:rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to the missing codec (usually will be opus) - http_cam: # <- for other streams + - "ffmpeg:name_your_rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to the missing codec (usually will be opus) + name_your_http_cam: # <- for other streams - http://192.168.50.155/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=user&password=password # <- stream which supports video & aac audio - - "ffmpeg:http_cam#audio=opus" # <- copy of the stream which transcodes audio to the missing codec (usually will be opus) + - "ffmpeg:name_your_http_cam#audio=opus" # <- copy of the stream which transcodes audio to the missing codec (usually will be opus) cameras: - rtsp_cam: + name_your_rtsp_cam: ffmpeg: output_args: record: preset-record-generic-audio-copy inputs: - - path: rtsp://127.0.0.1:8554/rtsp_cam # <--- the name here must match the name of the camera in restream + - path: rtsp://127.0.0.1:8554/name_your_rtsp_cam # <--- the name here must match the name of the camera in restream input_args: preset-rtsp-restream roles: - record - detect - audio # <- only necessary if audio detection is enabled - http_cam: + name_your_http_cam: ffmpeg: output_args: record: preset-record-generic-audio-copy inputs: - - path: rtsp://127.0.0.1:8554/http_cam # <--- the name here must match the name of the camera in restream + - path: rtsp://127.0.0.1:8554/name_your_http_cam # <--- the name here must match the name of the camera in restream input_args: preset-rtsp-restream roles: - record @@ -92,44 +92,44 @@ Two connections are made to the camera. One for the sub stream, one for the rest ```yaml go2rtc: streams: - rtsp_cam: + name_your_rtsp_cam: - rtsp://192.168.1.5:554/live0 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg - - "ffmpeg:rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to opus - rtsp_cam_sub: + - "ffmpeg:name_your_rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to opus + name_your_rtsp_cam_sub: - rtsp://192.168.1.5:554/substream # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg - - "ffmpeg:rtsp_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus - http_cam: + - "ffmpeg:name_your_rtsp_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus + name_your_http_cam: - http://192.168.50.155/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=user&password=password # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg - - "ffmpeg:http_cam#audio=opus" # <- copy of the stream which transcodes audio to opus - http_cam_sub: + - "ffmpeg:name_your_http_cam#audio=opus" # <- copy of the stream which transcodes audio to opus + name_your_http_cam_sub: - http://192.168.50.155/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=user&password=password # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg - - "ffmpeg:http_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus + - "ffmpeg:name_your_http_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus cameras: - rtsp_cam: + name_your_rtsp_cam: ffmpeg: output_args: record: preset-record-generic-audio-copy inputs: - - path: rtsp://127.0.0.1:8554/rtsp_cam # <--- the name here must match the name of the camera in restream + - path: rtsp://127.0.0.1:8554/name_your_rtsp_cam # <--- the name here must match the name of the camera in restream input_args: preset-rtsp-restream roles: - record - - path: rtsp://127.0.0.1:8554/rtsp_cam_sub # <--- the name here must match the name of the camera_sub in restream + - path: rtsp://127.0.0.1:8554/name_your_rtsp_cam_sub # <--- the name here must match the name of the camera_sub in restream input_args: preset-rtsp-restream roles: - audio # <- only necessary if audio detection is enabled - detect - http_cam: + name_your_http_cam: ffmpeg: output_args: record: preset-record-generic-audio-copy inputs: - - path: rtsp://127.0.0.1:8554/http_cam # <--- the name here must match the name of the camera in restream + - path: rtsp://127.0.0.1:8554/name_your_http_cam # <--- the name here must match the name of the camera in restream input_args: preset-rtsp-restream roles: - record - - path: rtsp://127.0.0.1:8554/http_cam_sub # <--- the name here must match the name of the camera_sub in restream + - path: rtsp://127.0.0.1:8554/name_your_http_cam_sub # <--- the name here must match the name of the camera_sub in restream input_args: preset-rtsp-restream roles: - audio # <- only necessary if audio detection is enabled @@ -138,7 +138,7 @@ cameras: ## Advanced Restream Configurations -The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#source-exec) source in go2rtc can be used for custom ffmpeg commands. An example is below: +The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#source-exec) source in go2rtc can be used for custom ffmpeg commands. An example is below: NOTE: The output will need to be passed with two curly braces `{{output}}` diff --git a/docs/docs/configuration/zones.md b/docs/docs/configuration/zones.md index f8e463605..daca1786a 100644 --- a/docs/docs/configuration/zones.md +++ b/docs/docs/configuration/zones.md @@ -56,3 +56,27 @@ camera: ``` Only car objects can trigger the `front_yard_street` zone and only person can trigger the `entire_yard`. You will get events for person objects that enter anywhere in the yard, and events for cars only if they enter the street. + +### Zone Inertia + +Sometimes an objects bounding box may be slightly incorrect and the bottom center of the bounding box is inside the zone while the object is not actually in the zone. Zone inertia helps guard against this by requiring an object's bounding box to be within the zone for multiple consecutive frames. This value can be configured: + +```yaml +camera: + zones: + front_yard: + inertia: 3 + objects: + - person +``` + +There may also be cases where you expect an object to quickly enter and exit a zone, like when a car is pulling into the driveway, and you may want to have the object be considered present in the zone immediately: + +```yaml +camera: + zones: + driveway_entrance: + inertia: 1 + objects: + - car +``` diff --git a/docs/docs/development/contributing.md b/docs/docs/development/contributing.md index b98ceb035..c5393dc59 100644 --- a/docs/docs/development/contributing.md +++ b/docs/docs/development/contributing.md @@ -155,10 +155,6 @@ cd web && npm install cd web && npm run dev ``` -#### 3a. Run the development server against a non-local instance - -To run the development server against a non-local instance, you will need to modify the API_HOST default return in `web/src/env.js`. - #### 4. Making changes The Web UI is built using [Vite](https://vitejs.dev/), [Preact](https://preactjs.com), and [Tailwind CSS](https://tailwindcss.com). diff --git a/docs/docs/frigate/installation.md b/docs/docs/frigate/installation.md index 490b803cb..cfeb7bf9b 100644 --- a/docs/docs/frigate/installation.md +++ b/docs/docs/frigate/installation.md @@ -204,6 +204,8 @@ It is recommended to run Frigate in LXC for maximum performance. See [this discu For details on running Frigate using ESXi, please see the instructions [here](https://williamlam.com/2023/05/frigate-nvr-with-coral-tpu-igpu-passthrough-using-esxi-on-intel-nuc.html). +If you're running Frigate on a rack mounted server and want to passthough the Google Coral, [read this.](https://github.com/blakeblackshear/frigate/issues/305) + ## Synology NAS on DSM 7 These settings were tested on DSM 7.1.1-42962 Update 4 diff --git a/docs/docs/guides/configuring_go2rtc.md b/docs/docs/guides/configuring_go2rtc.md index d242086d0..37ea0f819 100644 --- a/docs/docs/guides/configuring_go2rtc.md +++ b/docs/docs/guides/configuring_go2rtc.md @@ -11,7 +11,7 @@ Use of the bundled go2rtc is optional. You can still configure FFmpeg to connect # Setup a go2rtc stream -First, you will want to configure go2rtc to connect to your camera stream by adding the stream you want to use for live view in your Frigate config file. If you set the stream name under go2rtc to match the name of your camera, it will automatically be mapped and you will get additional live view options for the camera. Avoid changing any other parts of your config at this step. Note that go2rtc supports [many different stream types](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#module-streams), not just rtsp. +First, you will want to configure go2rtc to connect to your camera stream by adding the stream you want to use for live view in your Frigate config file. If you set the stream name under go2rtc to match the name of your camera, it will automatically be mapped and you will get additional live view options for the camera. Avoid changing any other parts of your config at this step. Note that go2rtc supports [many different stream types](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#module-streams), not just rtsp. ```yaml go2rtc: @@ -24,7 +24,7 @@ The easiest live view to get working is MSE. After adding this to the config, re ### What if my video doesn't play? -If you are unable to see your video feed, first check the go2rtc logs in the Frigate UI under Logs in the sidebar. If go2rtc is having difficulty connecting to your camera, you should see some error messages in the log. If you do not see any errors, then the video codec of the stream may not be supported in your browser. If your camera stream is set to H265, try switching to H264. You can see more information about [video codec compatibility](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#codecs-madness) in the go2rtc documentation. If you are not able to switch your camera settings from H265 to H264 or your stream is a different format such as MJPEG, you can use go2rtc to re-encode the video using the [FFmpeg parameters](https://github.com/AlexxIT/go2rtc/tree/v1.6.2#source-ffmpeg). It supports rotating and resizing video feeds and hardware acceleration. Keep in mind that transcoding video from one format to another is a resource intensive task and you may be better off using the built-in jsmpeg view. Here is an example of a config that will re-encode the stream to H264 without hardware acceleration: +If you are unable to see your video feed, first check the go2rtc logs in the Frigate UI under Logs in the sidebar. If go2rtc is having difficulty connecting to your camera, you should see some error messages in the log. If you do not see any errors, then the video codec of the stream may not be supported in your browser. If your camera stream is set to H265, try switching to H264. You can see more information about [video codec compatibility](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#codecs-madness) in the go2rtc documentation. If you are not able to switch your camera settings from H265 to H264 or your stream is a different format such as MJPEG, you can use go2rtc to re-encode the video using the [FFmpeg parameters](https://github.com/AlexxIT/go2rtc/tree/v1.8.1#source-ffmpeg). It supports rotating and resizing video feeds and hardware acceleration. Keep in mind that transcoding video from one format to another is a resource intensive task and you may be better off using the built-in jsmpeg view. Here is an example of a config that will re-encode the stream to H264 without hardware acceleration: ```yaml go2rtc: diff --git a/docs/docs/integrations/api.md b/docs/docs/integrations/api.md index 50b4e6d75..f080c0a36 100644 --- a/docs/docs/integrations/api.md +++ b/docs/docs/integrations/api.md @@ -155,18 +155,25 @@ Version info Events from the database. Accepts the following query string parameters: -| param | Type | Description | -| -------------------- | ---- | --------------------------------------------- | -| `before` | int | Epoch time | -| `after` | int | Epoch time | -| `cameras` | str | , separated list of cameras | -| `labels` | str | , separated list of labels | -| `zones` | str | , separated list of zones | -| `limit` | int | Limit the number of events returned | -| `has_snapshot` | int | Filter to events that have snapshots (0 or 1) | -| `has_clip` | int | Filter to events that have clips (0 or 1) | -| `include_thumbnails` | int | Include thumbnails in the response (0 or 1) | -| `in_progress` | int | Limit to events in progress (0 or 1) | +| param | Type | Description | +| -------------------- | ----- | ----------------------------------------------------- | +| `before` | int | Epoch time | +| `after` | int | Epoch time | +| `cameras` | str | , separated list of cameras | +| `labels` | str | , separated list of labels | +| `zones` | str | , separated list of zones | +| `limit` | int | Limit the number of events returned | +| `has_snapshot` | int | Filter to events that have snapshots (0 or 1) | +| `has_clip` | int | Filter to events that have clips (0 or 1) | +| `include_thumbnails` | int | Include thumbnails in the response (0 or 1) | +| `in_progress` | int | Limit to events in progress (0 or 1) | +| `time_range` | str | Time range in format after,before (00:00,24:00) | +| `timezone` | str | Timezone to use for time range | +| `min_score` | float | Minimum score of the event | +| `max_score` | float | Maximum score of the event | +| `is_submitted` | int | Filter events that are submitted to Frigate+ (0 or 1) | +| `min_length` | float | Minimum length of the event | +| `max_length` | float | Maximum length of the event | ### `GET /api/timeline` @@ -252,7 +259,7 @@ Accepts the following query string parameters, but they are only applied when an Returns the snapshot image from the latest event for the given camera and label combo. Using `any` as the label will return the latest thumbnail regardless of type. -### `GET /api//recording//snapshot.png` +### `GET /api//recordings//snapshot.png` Returns the snapshot image from the specific point in that cameras recordings. @@ -313,13 +320,19 @@ Get PTZ info for the camera. ### `POST /api/events//