diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 4ed9b46c7..131863e97 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -55,7 +55,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Build and run tests - run: make run_tests PLATFORM="linux/arm64/v8" ARCH="aarch64" FFMPEG_ARCH="arm64" + run: make run_tests PLATFORM="linux/arm64/v8" ARCH="aarch64" docker_tests_on_amd64: runs-on: ubuntu-latest @@ -67,4 +67,4 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Build and run tests - run: make run_tests PLATFORM="linux/amd64" ARCH="amd64" FFMPEG_ARCH="amd64" + run: make run_tests PLATFORM="linux/amd64" ARCH="amd64" diff --git a/Makefile b/Makefile index ee1d7899f..cc4ac2d2d 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.10.0-$(COMMIT_HASH)'" > frigate/version.py + echo "VERSION='0.11.0-$(COMMIT_HASH)'" > frigate/version.py web: docker build --tag frigate-web --file docker/Dockerfile.web web/ @@ -91,7 +91,7 @@ run_tests: @sed -i "s/FROM frigate-base/#/g" docker/Dockerfile.test @echo "" >> docker/Dockerfile.test @echo "RUN python3 -m unittest" >> docker/Dockerfile.test - @docker buildx build --platform=$(PLATFORM) --tag frigate-base --build-arg NGINX_VERSION=1.0.2 --build-arg FFMPEG_VERSION=1.0.0 --build-arg ARCH=$(ARCH) --build-arg FFMPEG_ARCH=$(FFMPEG_ARCH) --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.test . + @docker buildx build --platform=$(PLATFORM) --tag frigate-base --build-arg NGINX_VERSION=1.0.2 --build-arg FFMPEG_VERSION=1.0.0 --build-arg ARCH=$(ARCH) --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.test . @rm docker/Dockerfile.test .PHONY: web run_tests diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..9363a8fb3 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,127 @@ +FROM blakeblackshear/frigate-nginx:1.0.2 as nginx + +FROM node:14 as web + +WORKDIR /opt/frigate + +COPY web/ . + +RUN npm install && npm run build + +FROM debian:11 as wheels + +ENV DEBIAN_FRONTEND=noninteractive + +# Use a separate container to build wheels to prevent build dependencies in final image +RUN apt-get -qq update \ + && apt-get -qq install -y \ + apt-transport-https \ + gnupg \ + wget \ + && wget -O - http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - \ + && echo "deb http://archive.raspberrypi.org/debian/ bullseye main" | tee /etc/apt/sources.list.d/raspi.list \ + && apt-get -qq update \ + && apt-get -qq install -y \ + python3 \ + python3-dev \ + wget \ + # opencv dependencies + build-essential cmake git pkg-config libgtk-3-dev \ + libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ + libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \ + gfortran openexr libatlas-base-dev libssl-dev\ + libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \ + libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \ + # scipy dependencies + gcc gfortran libopenblas-dev liblapack-dev + +RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ + && python3 get-pip.py "pip" + +RUN pip3 install scikit-build + +# TODO: lock with requirements.txt +RUN pip3 wheel --wheel-dir=/wheels \ + opencv-python-headless \ + numpy \ + imutils \ + scipy \ + psutil \ + Flask \ + paho-mqtt \ + PyYAML \ + matplotlib \ + click \ + setproctitle \ + peewee \ + peewee_migrate \ + pydantic \ + zeroconf \ + ws4py + +# Frigate Container +FROM debian:11-slim +ARG TARGETARCH +ARG S6_OVERLAY_VERSION=3.0.0.2 + +ENV DEBIAN_FRONTEND=noninteractive +ENV FLASK_ENV=development + +COPY --from=wheels /wheels /wheels + +# Install ffmpeg +RUN apt-get -qq update \ + && apt-get -qq install --no-install-recommends -y \ + apt-transport-https \ + gnupg \ + wget \ + unzip tzdata libxml2 xz-utils \ + python3-pip \ + # add raspberry pi repo + && wget -O - http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - \ + && echo "deb http://archive.raspberrypi.org/debian/ bullseye main" | tee /etc/apt/sources.list.d/raspi.list \ + # add coral repo + && 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 \ + ffmpeg \ + # coral drivers + libedgetpu1-max python3-tflite-runtime python3-pycoral \ + && pip3 install -U /wheels/*.whl \ + && rm -rf /var/lib/apt/lists/* /wheels \ + && (apt-get autoremove -y; apt-get autoclean -y) + +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/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/ +ADD migrations migrations/ + +COPY --from=web /opt/frigate/build web/ + +COPY docker/rootfs/ / + +# s6-overlay +RUN S6_ARCH="${TARGETARCH}" \ + && if [ "${TARGETARCH}" = "amd64" ]; then S6_ARCH="amd64"; fi \ + && if [ "${TARGETARCH}" = "arm64" ]; then S6_ARCH="aarch64"; fi \ + && wget -O /tmp/s6-overlay-installer "https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-${S6_ARCH}-installer" \ + && chmod +x /tmp/s6-overlay-installer && /tmp/s6-overlay-installer / +# && wget -O - "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch-${S6_OVERLAY_VERSION}.tar.xz" \ +# | tar -C / -Jxpf - \ +# && wget -O - "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}-${S6_OVERLAY_VERSION}.tar.xz" \ +# | tar -C / -Jxpf - + +EXPOSE 5000 +EXPOSE 1935 + +ENTRYPOINT ["/init"] + +CMD ["python3", "-u", "-m", "frigate"] diff --git a/docs/docs/configuration/advanced.md b/docs/docs/configuration/advanced.md index 18521b7d5..790b494f7 100644 --- a/docs/docs/configuration/advanced.md +++ b/docs/docs/configuration/advanced.md @@ -43,6 +43,11 @@ If you are storing your database on a network share (SMB, NFS, etc), you may get This may need to be in a custom location if network storage is used for the media folder. +```yaml +database: + path: /path/to/frigate.db +``` + ### `model` If using a custom model, the width and height will need to be specified. diff --git a/docs/docs/configuration/camera_specific.md b/docs/docs/configuration/camera_specific.md index a82a58f84..465e0a5ce 100644 --- a/docs/docs/configuration/camera_specific.md +++ b/docs/docs/configuration/camera_specific.md @@ -19,6 +19,34 @@ output_args: rtmp: -c:v libx264 -an -f flv ``` +### JPEG Stream Cameras + +Cameras using a live changing jpeg image will need input parameters as below + +```yaml +input_args: +- -r +- 5 # << enter FPS here +- -stream_loop +- -1 +- -f +- image2 +- -avoid_negative_ts +- make_zero +- -fflags +- nobuffer +- -flags +- low_delay +- -strict +- experimental +- -fflags +- +genpts+discardcorrupt +- -use_wallclock_as_timestamps +- 1 +``` + +Outputting the stream will have the same args and caveats as per [MJPEG Cameras](#mjpeg-cameras) + ### RTMP Cameras The input parameters need to be adjusted for RTMP cameras diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index e334d88ee..5d8638745 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -238,6 +238,11 @@ motion: # NOTE: Can be overridden at the camera level record: # Optional: Enable recording (default: shown below) + # WARNING: Frigate does not currently support limiting recordings based + # on available disk space automatically. If using recordings, + # you must specify retention settings for a number of days that + # will fit within the available disk space of your drive or Frigate + # will crash. enabled: False # Optional: Number of minutes to wait between cleanup runs (default: shown below) # This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o diff --git a/docs/docs/configuration/objects.mdx b/docs/docs/configuration/objects.mdx index fd42a4399..1d236bf42 100644 --- a/docs/docs/configuration/objects.mdx +++ b/docs/docs/configuration/objects.mdx @@ -5,7 +5,11 @@ title: Objects import labels from "../../../labelmap.txt"; -By default, Frigate includes the following object models from the Google Coral test data. Note that `car` is listed twice because `truck` has been renamed to `car` by default. These object types are frequently confused. +Frigate includes the object models listed below from the Google Coral test data. + +Please note: + - `car` is listed twice because `truck` has been renamed to `car` by default. These object types are frequently confused. + - `person` is the only tracked object by default. See the [full configuration reference](https://docs.frigate.video/configuration/index#full-configuration-reference) for an example of expanding the list of tracked objects. + {retain_indefinitely ? 'True' : 'False'} {start.toLocaleDateString()} {start.toLocaleTimeString()} {end === null ? 'In progress' : end.toLocaleTimeString()}