diff --git a/.github/ISSUE_TEMPLATE/edgetpu_support_request.yml b/.github/ISSUE_TEMPLATE/edgetpu_support_request.yml new file mode 100644 index 0000000000..aad464edf0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/edgetpu_support_request.yml @@ -0,0 +1,84 @@ +name: EdgeTpu Support Request +description: Support for setting up EdgeTPU in Frigate +title: "[EdgeTPU Support]: " +labels: ["support", "triage"] +assignees: [] +body: + - type: textarea + id: description + attributes: + label: Describe the problem you are having + validations: + required: true + - type: input + id: version + attributes: + label: Version + description: Visible on the Debug page in the Web UI + validations: + required: true + - type: textarea + id: config + attributes: + label: Frigate config file + description: This will be automatically formatted into code, so no need for backticks. + render: yaml + validations: + required: true + - type: textarea + id: docker + attributes: + label: docker-compose file or Docker CLI command + description: This will be automatically formatted into code, so no need for backticks. + render: yaml + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + validations: + required: true + - type: dropdown + id: os + attributes: + label: Operating system + options: + - HassOS + - Debian + - Other Linux + - Proxmox + - UNRAID + - Windows + - Other + validations: + required: true + - type: dropdown + id: install-method + attributes: + label: Install method + options: + - HassOS Addon + - Docker Compose + - Docker CLI + validations: + required: true + - type: dropdown + id: coral + attributes: + label: Coral version + options: + - USB + - PCIe + - M.2 + - Dev Board + - Other + - CPU (no coral) + validations: + required: true + - type: textarea + id: other + attributes: + label: Any other information that may be helpful diff --git a/.github/ISSUE_TEMPLATE/hwaccel_support_request.yml b/.github/ISSUE_TEMPLATE/hwaccel_support_request.yml new file mode 100644 index 0000000000..82c64c4c37 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/hwaccel_support_request.yml @@ -0,0 +1,96 @@ +name: Hardware Acceleration Support Request +description: Support for setting up GPU hardware acceleration in Frigate +title: "[HW Accel Support]: " +labels: ["support", "triage"] +assignees: [] +body: + - type: textarea + id: description + attributes: + label: Describe the problem you are having + validations: + required: true + - type: input + id: version + attributes: + label: Version + description: Visible on the Debug page in the Web UI + validations: + required: true + - type: textarea + id: config + attributes: + label: Frigate config file + description: This will be automatically formatted into code, so no need for backticks. + render: yaml + validations: + required: true + - type: textarea + id: docker + attributes: + label: docker-compose file or Docker CLI command + description: This will be automatically formatted into code, so no need for backticks. + render: yaml + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + validations: + required: true + - type: textarea + id: ffprobe + attributes: + label: FFprobe output from your camera + description: Run `ffprobe ` and provide output below + render: shell + validations: + required: true + - type: dropdown + id: os + attributes: + label: Operating system + options: + - HassOS + - Debian + - Other Linux + - Proxmox + - UNRAID + - Windows + - Other + validations: + required: true + - type: dropdown + id: install-method + attributes: + label: Install method + options: + - HassOS Addon + - Docker Compose + - Docker CLI + validations: + required: true + - type: dropdown + id: network + attributes: + label: Network connection + options: + - Wired + - Wireless + - Mixed + validations: + required: true + - type: input + id: camera + attributes: + label: Camera make and model + description: Dahua, hikvision, amcrest, reolink, etc and model number + validations: + required: true + - type: textarea + id: other + attributes: + label: Any other information that may be helpful diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 9d88dc9eb4..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 30 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 3 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..a63f1b9ae9 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,25 @@ +# Close Stale Issues +# Warns and then closes issues and PRs that have had no activity for a specified amount of time. +# https://github.com/actions/stale + +name: "Stalebot" +on: + schedule: + - cron: "0 0 * * *" # run stalebot once a day + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@main + id: stale + with: + stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' + close-issue-message: '' + days-before-stale: 30 + days-before-close: 3 + exempt-draft-pr: true + exempt-issue-labels: 'pinned,security' + exempt-pr-labels: 'pinned,security' + - name: Print outputs + run: echo ${{ join(steps.stale.outputs.*, ',') }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 6cf5e62bd5..37b6395205 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -46,7 +46,6 @@ RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt FROM debian:11-slim ARG TARGETARCH -ARG JELLYFIN_FFMPEG_VERSION=5.0.1-7 # https://askubuntu.com/questions/972516/debian-frontend-environment-variable ARG DEBIAN_FRONTEND="noninteractive" # http://stackoverflow.com/questions/48162574/ddg#49462622 @@ -80,14 +79,21 @@ RUN apt-get -qq update \ # coral drivers libedgetpu1-max python3-tflite-runtime python3-pycoral \ && pip3 install -U /wheels/*.whl \ - # jellyfin-ffmpeg - && wget -O jellyfin.deb "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/${JELLYFIN_FFMPEG_VERSION}/jellyfin-ffmpeg5_${JELLYFIN_FFMPEG_VERSION}-$( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release )_$( dpkg --print-architecture ).deb" \ - && apt-get -qq install --no-install-recommends --no-install-suggests -y ./jellyfin.deb \ - && rm jellyfin.deb \ + # btbn-ffmpeg -> amd64 / arm64 + && if [ "${TARGETARCH}" = "amd64" ] || [ "${TARGETARCH}" = "arm64" ]; then \ + mkdir -p /usr/lib/btbn-ffmpeg \ + && wget -O btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linux$( [ "$TARGETARCH" = "amd64" ] && echo "64" || echo "arm64" )-gpl-5.1.tar.xz" \ + && tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/btbn-ffmpeg --strip-components 1 \ + && rm btbn-ffmpeg.tar.xz; \ + fi \ + # ffmpeg -> arm32 + && if [ "${TARGETARCH}" = "arm" ]; then \ + apt-get -qq install --no-install-recommends --no-install-suggests -y ffmpeg; \ + fi \ # arch specific packages && if [ "${TARGETARCH}" = "amd64" ]; then \ apt-get -qq install --no-install-recommends --no-install-suggests -y \ - mesa-va-drivers intel-media-va-driver-non-free; \ + mesa-va-drivers libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1; \ fi \ && if [ "${TARGETARCH}" = "arm64" ]; then \ apt-get -qq install --no-install-recommends --no-install-suggests -y \ @@ -109,7 +115,7 @@ RUN apt-get -qq update \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* -ENV PATH=$PATH:/usr/lib/jellyfin-ffmpeg +ENV PATH=$PATH:/usr/lib/btbn-ffmpeg/bin COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/ diff --git a/docker/rootfs/usr/local/nginx/conf/nginx.conf b/docker/rootfs/usr/local/nginx/conf/nginx.conf index 7437f42fd0..881bbefdbb 100644 --- a/docker/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/rootfs/usr/local/nginx/conf/nginx.conf @@ -55,6 +55,7 @@ http { vod_upstream_location /api; vod_align_segments_to_key_frames on; vod_manifest_segment_durations_mode accurate; + vod_ignore_edit_list on; # vod caches vod_metadata_cache metadata_cache 512m; @@ -172,10 +173,11 @@ http { proxy_set_header Host $host; } - location ~* /api/(.*\.(jpg|jpeg|png)$) { + location ~* /api/.*\.(jpg|jpeg|png)$ { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; - proxy_pass http://frigate_api/$1$is_args$args; + rewrite ^/api/(.*)$ $1 break; + proxy_pass http://frigate_api; proxy_pass_request_headers on; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/docs/docs/configuration/advanced.md b/docs/docs/configuration/advanced.md index 1c8e4c3b82..5a6d9fec31 100644 --- a/docs/docs/configuration/advanced.md +++ b/docs/docs/configuration/advanced.md @@ -81,3 +81,14 @@ model: ``` Note that if you rename objects in the labelmap, you will also need to update your `objects -> track` list as well. + +## Custom ffmpeg build + +Included with Frigate is a build of ffmpeg that works for the vast majority of users. However, there exists some hardware setups which have incompatibilities with the included build. In this case, a docker volume mapping can be used to overwrite the included ffmpeg build with an ffmpeg build that works for your specific hardware setup. + +To do this: +1. Download your ffmpeg build and uncompress to a folder on the host (let's use `/home/appdata/frigate/custom-ffmpeg` for this example). +2. Update your docker-compose or docker CLI to include `'/home/appdata/frigate/custom-ffmpeg':'/usr/lib/btbn-ffmpeg':'ro'` in the volume mappings. +3. Restart frigate and the custom version will be used if the mapping was done correctly. + +NOTE: The folder that is mapped from the host needs to be the folder that contains `/bin`. So if the full structure is `/home/appdata/frigate/custom-ffmpeg/bin/ffmpeg` then `/home/appdata/frigate/custom-ffmpeg` needs to be mapped to `/usr/lib/btbn-ffmpeg`. diff --git a/docs/docs/configuration/camera_specific.md b/docs/docs/configuration/camera_specific.md index 04e1ddeb5c..21275518c2 100644 --- a/docs/docs/configuration/camera_specific.md +++ b/docs/docs/configuration/camera_specific.md @@ -58,18 +58,17 @@ ffmpeg: ### 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. +According to [this discussion](https://github.com/blakeblackshear/frigate/issues/3235#issuecomment-1135876973), 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 + - +genpts+discardcorrupt - -flags - low_delay - -strict @@ -113,3 +112,14 @@ If your cameras do not support TCP connections for RTSP, you can use UDP. ffmpeg: input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport udp -timeout 5000000 -use_wallclock_as_timestamps 1 ``` + +### Unifi Protect Cameras + +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. + +```yaml +ffmpeg: + output_args: + record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -ar 44100 -c:a aac + rtmp: -c:v copy -f flv -ar 44100 -c:a aac +``` diff --git a/docs/docs/configuration/hardware_acceleration.md b/docs/docs/configuration/hardware_acceleration.md index 9d67f31d30..c3b717f24a 100644 --- a/docs/docs/configuration/hardware_acceleration.md +++ b/docs/docs/configuration/hardware_acceleration.md @@ -21,7 +21,7 @@ ffmpeg: ffmpeg: hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p ``` -**NOTICE**: With some of the processors, like the J4125, the default driver `iHD` doesn't seem to work correctly for hardware acceleration. You may need to change the driver to `i965` by adding the following environment variable `LIBVA_DRIVER_NAME_JELLYFIN=i965` to your docker-compose file. +**NOTICE**: With some of the processors, like the J4125, the default driver `iHD` doesn't seem to work correctly for hardware acceleration. You may need to change the driver to `i965` by adding the following environment variable `LIBVA_DRIVER_NAME=i965` to your docker-compose file. ### Intel-based CPUs (>=10th Generation) via Quicksync diff --git a/docs/docs/guides/events_setup.md b/docs/docs/guides/events_setup.md new file mode 100644 index 0000000000..bc5c46e945 --- /dev/null +++ b/docs/docs/guides/events_setup.md @@ -0,0 +1,10 @@ +--- +id: events_setup +title: Setting Up Events +--- + +[Snapshots](../configuration/snapshots.md) and/or [Recordings](../configuration/record.md) must be enabled for events to be created for detected objects. + +## Limiting Events to Areas of Interest + +The best way to limit events to areas of interest is to use [zones](../configuration/zones.md) along with `required_zones` for events and snapshots to only have events created in areas of interest. diff --git a/docs/docs/guides/getting_started.md b/docs/docs/guides/getting_started.md index 5fe51cb005..d33bed9bb0 100644 --- a/docs/docs/guides/getting_started.md +++ b/docs/docs/guides/getting_started.md @@ -45,6 +45,12 @@ More details on available detectors can be found [here](/configuration/detectors Now let's add the first camera: +:::caution + +Note that passwords that contain special characters often cause issues with ffmpeg connecting to the cameara. If recieving `end-of-file` or `unauthorized` errors with a verified correct password, try changing the password to something simple to rule out the possibility that the password is the issue. + +::: + ```yaml mqtt: host: diff --git a/docs/docs/guides/stationary_objects.md b/docs/docs/guides/stationary_objects.md index fabb97a3c0..269a1c80df 100644 --- a/docs/docs/guides/stationary_objects.md +++ b/docs/docs/guides/stationary_objects.md @@ -3,7 +3,7 @@ id: stationary_objects title: Avoiding stationary objects --- -Many people use Frigate to detect cars entering their driveway, and they often run into an issue with repeated events of a parked car being repeatedly detected. This is because object tracking stops when motion ends and the event ends. Motion detection works by determining if a sufficient number of pixels have changed between frames. Shadows or other lighting changes will be detected as motion. This will often cause a new event for a parked car. +Many people use Frigate to detect cars entering their driveway, and they often run into an issue with repeated events of a parked car being repeatedly detected over the course of multiple days (for example if the car is lost at night and detected again the following morning. You can use zones to restrict events and notifications to objects that have entered specific areas. diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 74b289969c..470c376db2 100644 --- a/docs/docs/hardware.md +++ b/docs/docs/hardware.md @@ -23,15 +23,15 @@ I may earn a small commission for my endorsement, recommendation, testimonial, o My current favorite is the Minisforum GK41 because of the dual NICs that allow you to setup a dedicated private network for your cameras where they can be blocked from accessing the internet. There are many used workstation options on eBay that work very well. Anything with an Intel CPU and capable of running Debian should work fine. As a bonus, you may want to look for devices with a M.2 or PCIe express slot that is compatible with the Google Coral. I may earn a small commission for my endorsement, recommendation, testimonial, or link to any products or services from this website. -| Name | Inference Speed | Coral Compatibility | Notes | -| ------------------------------------------------------------------------------------------------------------------------------- | --------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| Odyssey X86 Blue J4125 (affiliate link) | 9-10ms | M.2 B+M | Dual gigabit NICs for easy isolated camera network. Easily handles several 1080p cameras. | -| Minisforum GK41 (affiliate link) | 9-10ms | USB | Dual gigabit NICs for easy isolated camera network. Easily handles several 1080p cameras. | -| Beelink GK55 (affiliate link) | 9-10ms | USB | Dual gigabit NICs for easy isolated camera network. Easily handles several 1080p cameras. | -| Intel NUC (affiliate link) | 8-10ms | USB | Overkill for most, but great performance. Can handle many cameras at 5fps depending on typical amounts of motion. Requires extra parts. | -| BMAX B2 Plus (affiliate link) | 10-12ms | USB | Good balance of performance and cost. Also capable of running many other services at the same time as frigate. | -| Atomic Pi (affiliate link) | 16ms | USB | Good option for a dedicated low power board with a small number of cameras. Can leverage Intel QuickSync for stream decoding. | -| Raspberry Pi 4 (64bit) (affiliate link) | 10-15ms | USB | Can handle a small number of cameras. | +| Name | Inference Speed | Coral Compatibility | Notes | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| Odyssey X86 Blue J4125 (Amazon) (SeeedStudio) | 9-10ms | M.2 B+M, USB | Dual gigabit NICs for easy isolated camera network. Easily handles several 1080p cameras. | +| Minisforum GK41 (Amazon) | 9-10ms | USB | Dual gigabit NICs for easy isolated camera network. Easily handles several 1080p cameras. | +| Beelink GK55 (Amazon) | 9-10ms | USB | Dual gigabit NICs for easy isolated camera network. Easily handles several 1080p cameras. | +| Intel NUC (Amazon) | 8-10ms | USB | Overkill for most, but great performance. Can handle many cameras at 5fps depending on typical amounts of motion. Requires extra parts. | +| BMAX B2 Plus (Amazon) | 10-12ms | USB | Good balance of performance and cost. Also capable of running many other services at the same time as frigate. | +| Atomic Pi (Amazon) | 16ms | USB | Good option for a dedicated low power board with a small number of cameras. Can leverage Intel QuickSync for stream decoding. | +| Raspberry Pi 4 (64bit) (Amazon) | 10-15ms | USB | Can handle a small number of cameras. | ## Google Coral TPU diff --git a/docs/sidebars.js b/docs/sidebars.js index d8a3f5b98d..e5192d2cdc 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -4,6 +4,7 @@ module.exports = { Guides: [ "guides/camera_setup", "guides/getting_started", + "guides/events_setup", "guides/false_positives", "guides/ha_notifications", "guides/stationary_objects", diff --git a/frigate/http.py b/frigate/http.py index b7ed517834..f6c9ca003d 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -8,6 +8,7 @@ import time from functools import reduce from pathlib import Path +from urllib.parse import unquote import cv2 @@ -341,6 +342,7 @@ def event_thumbnail(id, max_cache_age=2592000): @bp.route("//