diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f687072fe..259bd9c7c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,19 +9,32 @@ "mhutchie.git-graph", "ms-azuretools.vscode-docker", "streetsidesoftware.code-spell-checker", - "eamodio.gitlens", "esbenp.prettier-vscode", - "ms-python.vscode-pylance" + "ms-python.vscode-pylance", + "dbaeumer.vscode-eslint", + "mikestead.dotenv", + "csstools.postcss", + "blanu.vscode-styled-jsx", + "bradlc.vscode-tailwindcss" ], "settings": { - "python.pythonPath": "/usr/bin/python3", "python.linting.pylintEnabled": true, "python.linting.enabled": true, "python.formatting.provider": "black", + "python.languageServer": "Pylance", "editor.formatOnPaste": false, "editor.formatOnSave": true, "editor.formatOnType": true, "files.trimTrailingWhitespace": true, - "terminal.integrated.shell.linux": "/bin/bash" + "eslint.workingDirectories": ["./web"], + "[json][jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsx][js][tsx][ts]": { + "editor.codeActionsOnSave": ["source.addMissingImports", "source.fixAll"], + "editor.tabSize": 2 + }, + "cSpell.ignoreWords": ["rtmp"], + "cSpell.words": ["preact"] } } diff --git a/.dockerignore b/.dockerignore index 6a4bc6eb8..9ce459f25 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,5 +7,6 @@ config/ .git core *.mp4 +*.jpg *.db *.ts \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 131863e97..fe0ceb86b 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -2,6 +2,9 @@ name: On pull request on: pull_request +env: + DEFAULT_PYTHON: 3.9 + jobs: web_lint: name: Web - Lint @@ -10,25 +13,11 @@ jobs: - uses: actions/checkout@master - uses: actions/setup-node@master with: - node-version: 14.x + node-version: 16.x - run: npm install working-directory: ./web - name: Lint - run: npm run lint:cmd - working-directory: ./web - - web_build: - name: Web - Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: actions/setup-node@master - with: - node-version: 14.x - - run: npm install - working-directory: ./web - - name: Build - run: npm run build + run: npm run lint working-directory: ./web web_test: @@ -38,33 +27,54 @@ jobs: - uses: actions/checkout@master - uses: actions/setup-node@master with: - node-version: 14.x + node-version: 16.x - run: npm install working-directory: ./web - name: Test run: npm run test working-directory: ./web - - docker_tests_on_aarch64: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - 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" - docker_tests_on_amd64: + python_checks: runs-on: ubuntu-latest + name: Python checks + steps: + - name: Check out the repository + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + uses: actions/setup-python@v2.2.2 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Install requirements + run: | + pip install pip + pip install -r requirements-dev.txt + - name: Lint + run: | + python3 -m black frigate --check + + python_tests: + runs-on: ubuntu-latest + name: Python Tests steps: - name: Check out code uses: actions/checkout@v2 + - uses: actions/setup-node@master + with: + node-version: 16.x + - run: npm install + working-directory: ./web + - name: Build web + run: npm run build + working-directory: ./web - name: Set up QEMU uses: docker/setup-qemu-action@v1 - 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" + - name: Create Version Module + run: make version + - name: Build + run: make + - name: Run mypy + run: docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate + - name: Run tests + run: docker run --rm --entrypoint=python3 frigate:latest -u -m unittest diff --git a/.gitignore b/.gitignore index 8de9cbdf9..6fe616b5c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ web/build web/node_modules web/coverage core +!/web/**/*.ts diff --git a/Makefile b/Makefile index 4286c438d..6702690b9 100644 --- a/Makefile +++ b/Makefile @@ -1,74 +1,39 @@ -default_target: amd64_frigate +default_target: local COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1) +VERSION = 0.11.0 +CURRENT_UID := $(shell id -u) +CURRENT_GID := $(shell id -g) version: - echo "VERSION='0.10.1-$(COMMIT_HASH)'" > frigate/version.py + echo "VERSION=\"$(VERSION)-$(COMMIT_HASH)\"" > frigate/version.py -web: - docker build --tag frigate-web --file docker/Dockerfile.web web/ - -amd64_wheels: - docker build --tag blakeblackshear/frigate-wheels:1.0.3-amd64 --file docker/Dockerfile.wheels . - -amd64_ffmpeg: - docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.2.0-amd64 --file docker/Dockerfile.ffmpeg.amd64 . +build_web: + docker run --volume ${PWD}/web:/web -w /web --volume /etc/passwd:/etc/passwd:ro --volume /etc/group:/etc/group:ro -u $(CURRENT_UID):$(CURRENT_GID) node:16 /bin/bash -c "npm install && npm run build" 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 --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 . +local: + DOCKER_BUILDKIT=1 docker build -t frigate -f docker/Dockerfile . -amd64_all: amd64_wheels amd64_ffmpeg amd64_frigate +amd64: + docker buildx build --platform linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . -amd64nvidia_wheels: - docker build --tag blakeblackshear/frigate-wheels:1.0.3-amd64nvidia --file docker/Dockerfile.wheels . +arm64: + docker buildx build --platform linux/arm64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . -amd64nvidia_ffmpeg: - docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.2.0-amd64nvidia --file docker/Dockerfile.ffmpeg.amd64nvidia . +armv7: + docker buildx build --platform linux/arm/v7 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . -amd64nvidia_frigate: version web - 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 . +build: version amd64 arm64 armv7 + docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . -amd64nvidia_all: amd64nvidia_wheels amd64nvidia_ffmpeg amd64nvidia_frigate +push: build + docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . -aarch64_wheels: - docker build --tag blakeblackshear/frigate-wheels:1.0.3-aarch64 --file docker/Dockerfile.wheels . +run_tests: frigate + docker run --rm --entrypoint=python3 frigate:latest -u -m unittest + docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate -aarch64_ffmpeg: - docker build --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.3.0-aarch64 --file docker/Dockerfile.ffmpeg.aarch64 . - -aarch64_frigate: version web - 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 . - -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 --no-cache --pull --tag blakeblackshear/frigate-ffmpeg:1.2.0-armv7 --file docker/Dockerfile.ffmpeg.armv7 . - -armv7_frigate: version web - 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 - -run_tests: - # PLATFORM: linux/arm64/v8 linux/amd64 or linux/arm/v7 - # ARCH: aarch64 amd64 or armv7 - @cat docker/Dockerfile.base docker/Dockerfile.$(ARCH) > docker/Dockerfile.test - @sed -i "s/FROM frigate-web as web/#/g" docker/Dockerfile.test - @sed -i "s/COPY --from=web \/opt\/frigate\/build web\//#/g" docker/Dockerfile.test - @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 WHEELS_VERSION=1.0.3 --file docker/Dockerfile.test . - @rm docker/Dockerfile.test - -.PHONY: web run_tests +.PHONY: run_tests diff --git a/docker-compose.yml b/docker-compose.yml index 197d9e11e..84547503a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,20 +3,28 @@ services: dev: container_name: frigate-dev user: vscode - privileged: true + # add groups from host for render, plugdev, video + group_add: + - "109" # render + - "110" # render + - "44" # video + - "46" # plugdev shm_size: "256mb" build: context: . dockerfile: docker/Dockerfile.dev + devices: + - /dev/bus/usb:/dev/bus/usb + - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware 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" + - "3000:3000" - "5000:5000" - "5001:5001" - "8080:8080" diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..37b639520 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,148 @@ +FROM blakeblackshear/frigate-nginx:1.0.2 as nginx + +FROM debian:11 as wheels +ARG TARGETARCH + +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 \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E \ + && echo "deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi" | 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 if [ "${TARGETARCH}" = "arm" ]; \ + then echo "[global]" > /etc/pip.conf \ + && echo "extra-index-url=https://www.piwheels.org/simple" >> /etc/pip.conf; \ + fi + +COPY requirements.txt /requirements.txt +RUN pip3 install -r requirements.txt + +COPY requirements-wheels.txt /requirements-wheels.txt +RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt + +# Frigate Container +FROM debian:11-slim +ARG TARGETARCH + +# https://askubuntu.com/questions/972516/debian-frontend-environment-variable +ARG DEBIAN_FRONTEND="noninteractive" +# http://stackoverflow.com/questions/48162574/ddg#49462622 +ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn +# https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support) +ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" + +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 + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E \ + && echo "deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi" | tee /etc/apt/sources.list.d/raspi.list \ + # add coral repo + && 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 \ + # enable non-free repo + && sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list \ + && apt-get -qq update \ + && apt-get -qq install --no-install-recommends --no-install-suggests -y \ + # coral drivers + libedgetpu1-max python3-tflite-runtime python3-pycoral \ + && pip3 install -U /wheels/*.whl \ + # 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 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 \ + libva-drm2 mesa-va-drivers; \ + fi \ + # not sure why 32bit arm requires all these + && if [ "${TARGETARCH}" = "arm" ]; then \ + apt-get -qq install --no-install-recommends --no-install-suggests -y \ + 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; \ + fi \ + && rm -rf /wheels \ + && apt-get remove gnupg apt-transport-https -y \ + && apt-get clean autoclean -y \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* + +ENV PATH=$PATH:/usr/lib/btbn-ffmpeg/bin + +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 web/dist web/ + +COPY docker/rootfs/ / + +# s6-overlay +RUN S6_ARCH="${TARGETARCH}" \ + && if [ "${TARGETARCH}" = "amd64" ]; then S6_ARCH="amd64"; fi \ + && if [ "${TARGETARCH}" = "arm" ]; then S6_ARCH="armhf"; 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 / + +EXPOSE 5000 +EXPOSE 1935 + +ENTRYPOINT ["/init"] + +CMD ["python3", "-u", "-m", "frigate"] diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 deleted file mode 100644 index 30d69fc83..000000000 --- a/docker/Dockerfile.aarch64 +++ /dev/null @@ -1,28 +0,0 @@ -FROM frigate-base -LABEL maintainer "blakeb@blakeshome.com" - -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 \ - && rm -rf /var/lib/apt/lists/* \ - && (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 deleted file mode 100644 index d583e43f8..000000000 --- a/docker/Dockerfile.amd64 +++ /dev/null @@ -1,28 +0,0 @@ -FROM frigate-base -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-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) - -# 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 deleted file mode 100644 index f893d684f..000000000 --- a/docker/Dockerfile.amd64nvidia +++ /dev/null @@ -1,51 +0,0 @@ -FROM frigate-base -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 \ - && rm -rf /var/lib/apt/lists/* \ - && (apt-get autoremove -y; apt-get autoclean -y) - - -# nvidia layer (see https://gitlab.com/nvidia/container-images/cuda/blob/master/dist/11.1/ubuntu20.04-x86_64/base/Dockerfile) -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gnupg2 curl ca-certificates && \ - curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub | apt-key add - && \ - echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \ - echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list && \ - apt-get purge --autoremove -y curl \ - && rm -rf /var/lib/apt/lists/* - -ENV CUDA_VERSION 11.1.1 - -# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a -RUN apt-get update && apt-get install -y --no-install-recommends \ - cuda-cudart-11-1=11.1.74-1 \ - cuda-compat-11-1 \ - && ln -s cuda-11.1 /usr/local/cuda && \ - rm -rf /var/lib/apt/lists/* - -# Required for nvidia-docker v1 -RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ - echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf - -ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} -ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 - -# nvidia-container-runtime -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 deleted file mode 100644 index af44301b8..000000000 --- a/docker/Dockerfile.armv7 +++ /dev/null @@ -1,30 +0,0 @@ -FROM frigate-base -LABEL maintainer "blakeb@blakeshome.com" - -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 \ - && rm -rf /var/lib/apt/lists/* \ - && (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 deleted file mode 100644 index ec1b5a0aa..000000000 --- a/docker/Dockerfile.base +++ /dev/null @@ -1,55 +0,0 @@ -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 -LABEL maintainer "blakeb@blakeshome.com" - -COPY --from=ffmpeg /usr/local /usr/local/ - -COPY --from=wheels /wheels/. /wheels/ - -ENV FLASK_ENV=development -# ENV FONTCONFIG_PATH=/etc/fonts -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 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 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 \ - ws4py - -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/ / - -EXPOSE 5000 -EXPOSE 1935 diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index ba36d92e9..7f47c3768 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -6,7 +6,7 @@ ARG USER_GID=$USER_UID # Create the user RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \ # # [Optional] Add sudo support. Omit if you don't need to install software after connecting. && apt-get update \ @@ -17,10 +17,11 @@ RUN groupadd --gid $USER_GID $USERNAME \ RUN apt-get update \ && apt-get install -y git curl vim htop -RUN pip3 install pylint black +COPY requirements-dev.txt /opt/frigate/requirements-dev.txt +RUN pip3 install -r requirements-dev.txt -# Install Node 14 -RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \ +# Install Node 16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \ && apt-get install -y nodejs RUN npm install -g npm@latest diff --git a/docker/Dockerfile.ffmpeg.aarch64 b/docker/Dockerfile.ffmpeg.aarch64 deleted file mode 100644 index b53dda2ee..000000000 --- a/docker/Dockerfile.ffmpeg.aarch64 +++ /dev/null @@ -1,486 +0,0 @@ -# inspired by: -# https://github.com/collelog/ffmpeg/blob/master/4.3.1-alpine-rpi4-arm64v8.Dockerfile -# https://github.com/mmastrac/ffmpeg-omx-rpi-docker/blob/master/Dockerfile -# https://github.com/jrottenberg/ffmpeg/pull/158/files -# https://github.com/jrottenberg/ffmpeg/pull/239 -FROM ubuntu:20.04 AS base - -WORKDIR /tmp/workdir - -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get -yqq update && \ - 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.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="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" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" - - -ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -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" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265_${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - export CXXFLAGS="${CXXFLAGS} -fPIC" && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -o config.guess && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -o config.sub && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/lame/lame/$(echo ${LAME_VERSION} | sed -e 's/[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)/\1.\2/')/lame-${LAME_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - export CFLAGS="${CFLAGS} -DPNG_ARM_NEON_OPT=0" && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -o config.guess && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -o config.sub && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb-proto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libxcb-${LIBXCB_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libxcb-${LIBXCB_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make check && \ - 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} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 - -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-shared \ - --enable-avresample \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-gpl \ - --enable-libfreetype \ - --enable-libvidstab \ - --enable-libmp3lame \ - --enable-libopus \ - --enable-libtheora \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libxcb \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libx264 \ - --enable-nonfree \ - --enable-openssl \ - --enable-libfdk_aac \ - --enable-postproc \ - --enable-small \ - --enable-version3 \ - --enable-libzmq \ - --extra-libs=-ldl \ - --prefix="${PREFIX}" \ - --enable-libopenjpeg \ - --enable-libkvazaar \ - --enable-libaom \ - --extra-libs=-lpthread \ - --enable-rkmpp \ - --enable-libdrm \ - # --enable-omx \ - # --enable-omx-rpi \ - # --enable-mmal \ - --enable-v4l2_m2m \ - --enable-neon \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - 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##*/}"; \ - done - -FROM base AS release - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64:/lib:/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -# Run ffmpeg with -c:v h264_v4l2m2m to enable HW accell for decoding on raspberry pi4 64-bit \ No newline at end of file diff --git a/docker/Dockerfile.ffmpeg.amd64 b/docker/Dockerfile.ffmpeg.amd64 deleted file mode 100644 index 5dc005505..000000000 --- a/docker/Dockerfile.ffmpeg.amd64 +++ /dev/null @@ -1,468 +0,0 @@ -# inspired by: -# https://github.com/collelog/ffmpeg/blob/master/4.3.1-alpine-rpi4-arm64v8.Dockerfile -# https://github.com/jrottenberg/ffmpeg/pull/158/files -# https://github.com/jrottenberg/ffmpeg/pull/239 -FROM ubuntu:20.04 AS base - -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 autoremove -y && \ - apt-get clean -y - -FROM base as build - -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" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" - - -ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -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" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265_${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/lame/lame/$(echo ${LAME_VERSION} | sed -e 's/[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)/\1.\2/')/lame-${LAME_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb-proto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libxcb-${LIBXCB_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libxcb-${LIBXCB_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 - - - -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-shared \ - --enable-avresample \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-gpl \ - --enable-libfreetype \ - --enable-libvidstab \ - --enable-libmfx \ - --enable-libmp3lame \ - --enable-libopus \ - --enable-libtheora \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libxcb \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libx264 \ - --enable-nonfree \ - --enable-openssl \ - --enable-libfdk_aac \ - --enable-postproc \ - --enable-small \ - --enable-version3 \ - --enable-libzmq \ - --extra-libs=-ldl \ - --prefix="${PREFIX}" \ - --enable-libopenjpeg \ - --enable-libkvazaar \ - --enable-libaom \ - --extra-libs=-lpthread \ - --enable-vaapi \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - 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##*/}"; \ - done - -FROM base AS release - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64:/lib:/lib64 - -CMD ["--help"] -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/* diff --git a/docker/Dockerfile.ffmpeg.amd64nvidia b/docker/Dockerfile.ffmpeg.amd64nvidia deleted file mode 100644 index 71f91fe4f..000000000 --- a/docker/Dockerfile.ffmpeg.amd64nvidia +++ /dev/null @@ -1,549 +0,0 @@ -# inspired by https://github.com/jrottenberg/ffmpeg/blob/master/docker-images/4.3/ubuntu1804/Dockerfile - -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM nvidia/cuda:11.1-devel-ubuntu20.04 AS devel-base - -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=noninteractive - -WORKDIR /tmp/workdir - -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 nvidia/cuda:11.1-runtime-ubuntu20.04 AS runtime-base - -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=noninteractive - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ - apt-get autoremove -y && \ - apt-get clean -y - - -FROM devel-base as build - -ENV NVIDIA_HEADERS_VERSION=9.1.23.1 - -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" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -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" && \ - 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}" && \ - rm -rf ${DIR} - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265_${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/lame/lame/$(echo ${LAME_VERSION} | sed -e 's/[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)/\1.\2/')/lame-${LAME_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb-proto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libxcb-${LIBXCB_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libxcb-${LIBXCB_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -## ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 - - - -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-shared \ - --enable-avresample \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-gpl \ - --enable-libfreetype \ - --enable-libvidstab \ - --enable-libmp3lame \ - --enable-libopus \ - --enable-libtheora \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libxcb \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libx264 \ - --enable-nonfree \ - --enable-openssl \ - --enable-libfdk_aac \ - --enable-postproc \ - --enable-small \ - --enable-version3 \ - --enable-libzmq \ - --extra-libs=-ldl \ - --prefix="${PREFIX}" \ - --enable-libopenjpeg \ - --enable-libkvazaar \ - --enable-libaom \ - --extra-libs=-lpthread \ - --enable-libsrt \ - --enable-libaribb24 \ - --enable-nvenc \ - --enable-cuda \ - --enable-cuvid \ - --enable-libnpp \ - --extra-cflags="-I${PREFIX}/include -I${PREFIX}/include/ffnvcodec -I/usr/local/cuda/include/" \ - --extra-ldflags="-L${PREFIX}/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/" && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - LD_LIBRARY_PATH="${PREFIX}/lib:${PREFIX}/lib64:${LD_LIBRARY_PATH}" ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/* /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - 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##*/}"; \ - done - - - -FROM runtime-base AS release - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -# 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/ -COPY --from=build /usr/local/include /usr/local/include/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output \ No newline at end of file diff --git a/docker/Dockerfile.ffmpeg.armv7 b/docker/Dockerfile.ffmpeg.armv7 deleted file mode 100644 index 0c40cef85..000000000 --- a/docker/Dockerfile.ffmpeg.armv7 +++ /dev/null @@ -1,490 +0,0 @@ -# inspired by: -# https://github.com/collelog/ffmpeg/blob/master/4.3.1-alpine-rpi4-arm64v8.Dockerfile -# https://github.com/mmastrac/ffmpeg-omx-rpi-docker/blob/master/Dockerfile -# https://github.com/jrottenberg/ffmpeg/pull/158/files -# https://github.com/jrottenberg/ffmpeg/pull/239 -FROM ubuntu:20.04 AS base - -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 autoremove -y && \ - apt-get clean -y - -FROM base as build - -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" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" - - -ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/vc/lib/pkgconfig" -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" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -# ### x265 http://x265.org/ -# RUN \ -# DIR=/tmp/x265 && \ -# mkdir -p ${DIR} && \ -# cd ${DIR} && \ -# curl -sL https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | \ -# tar -zx && \ -# cd x265_${X265_VERSION}/build/linux && \ -# sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ -# sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ -# # export CXXFLAGS="${CXXFLAGS} -fPIC" && \ -# ./multilib.sh && \ -# make -C 8bit install && \ -# rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -o config.guess && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -o config.sub && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://versaweb.dl.sourceforge.net/project/lame/lame/$(echo ${LAME_VERSION} | sed -e 's/[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)/\1.\2/')/lame-${LAME_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - export CFLAGS="${CFLAGS} -DPNG_ARM_NEON_OPT=0" && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -# RUN \ -# DIR=/tmp/aom && \ -# git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ -# cd ${DIR} ; \ -# rm -rf CMakeCache.txt CMakeFiles ; \ -# mkdir -p ./aom_build ; \ -# cd ./aom_build ; \ -# cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ -# make ; \ -# make install ; \ -# rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -o config.guess && \ - curl -sL 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -o config.sub && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb-proto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xcb-proto-${XCBPROTO_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libxcb && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libxcb-${LIBXCB_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libxcb-${LIBXCB_VERSION}.tar.gz && \ - ACLOCAL_PATH="${PREFIX}/share/aclocal" ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make -j $(nproc) && \ - # make check && \ - make -j $(nproc) install && \ - rm -rf ${DIR} - -## userland https://github.com/raspberrypi/userland -RUN \ - DIR=/tmp/userland && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone --depth 1 https://github.com/raspberrypi/userland.git . && \ - ./buildme && \ - rm -rf ${DIR} - -## ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 - -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-shared \ - --enable-avresample \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-gpl \ - --enable-libfreetype \ - --enable-libvidstab \ - --enable-libmp3lame \ - --enable-libopus \ - --enable-libtheora \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libxcb \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libx264 \ - --enable-nonfree \ - --enable-openssl \ - --enable-libfdk_aac \ - --enable-postproc \ - --enable-small \ - --enable-version3 \ - --enable-libzmq \ - --extra-libs=-ldl \ - --prefix="${PREFIX}" \ - --enable-libopenjpeg \ - --enable-libkvazaar \ - --enable-libaom \ - --extra-libs=-lpthread \ - --enable-omx \ - --enable-omx-rpi \ - --enable-mmal \ - --enable-v4l2_m2m \ - --enable-neon \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" && \ - make -j $(nproc) && \ - make -j $(nproc) install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - # copy userland lib too - ldd ${PREFIX}/bin/ffmpeg | grep opt/vc | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - 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##*/}"; \ - done - -FROM base AS release - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64:/lib:/lib64 - -RUN \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends libx265-dev libaom-dev && \ - apt-get autoremove -y && \ - apt-get clean -y - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ diff --git a/docker/Dockerfile.nginx b/docker/Dockerfile.nginx deleted file mode 100644 index 72e15f8e0..000000000 --- a/docker/Dockerfile.nginx +++ /dev/null @@ -1,52 +0,0 @@ -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.web b/docker/Dockerfile.web deleted file mode 100644 index 54cdce3fe..000000000 --- a/docker/Dockerfile.web +++ /dev/null @@ -1,9 +0,0 @@ -ARG NODE_VERSION=14.0 - -FROM node:${NODE_VERSION} - -WORKDIR /opt/frigate - -COPY . . - -RUN npm install && npm run build diff --git a/docker/Dockerfile.wheels b/docker/Dockerfile.wheels deleted file mode 100644 index a6fa222ec..000000000 --- a/docker/Dockerfile.wheels +++ /dev/null @@ -1,41 +0,0 @@ -FROM ubuntu:20.04 as build - -ENV DEBIAN_FRONTEND=noninteractive - -RUN 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 cython - -RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ - && python3 get-pip.py "pip==20.2.4" - -RUN pip3 install scikit-build - -RUN pip3 wheel --wheel-dir=/wheels \ - opencv-python-headless \ - numpy \ - imutils \ - scipy \ - psutil \ - Flask \ - paho-mqtt \ - PyYAML \ - matplotlib \ - click \ - setproctitle \ - peewee - -FROM scratch - -COPY --from=build /wheels /wheels diff --git a/docker/rootfs/usr/local/nginx/conf/nginx.conf b/docker/rootfs/usr/local/nginx/conf/nginx.conf index a392b5372..881bbefdb 100644 --- a/docker/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/rootfs/usr/local/nginx/conf/nginx.conf @@ -30,17 +30,17 @@ http { gzip_vary on; upstream frigate_api { - server localhost:5001; + server 127.0.0.1:5001; keepalive 1024; } upstream mqtt_ws { - server localhost:5002; + server 127.0.0.1:5002; keepalive 1024; } upstream jsmpeg { - server localhost:8082; + server 127.0.0.1:8082; keepalive 1024; } @@ -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; @@ -81,11 +82,13 @@ http { 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; + add_header Cache-Control "no-store"; + expires off; } location /stream/ { - add_header 'Cache-Control' 'no-cache'; + 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'; @@ -170,10 +173,23 @@ http { proxy_set_header Host $host; } - location /api/ { + 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; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + 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'; proxy_pass http://frigate_api/; proxy_pass_request_headers on; proxy_set_header Host $host; @@ -181,21 +197,23 @@ http { proxy_set_header X-Forwarded-Proto $scheme; } - location / { - add_header Cache-Control "no-cache"; + add_header Cache-Control "no-store"; + expires off; - location ~* \.(?:js|css|svg|ico|png)$ { + location /assets/ { access_log off; expires 1y; add_header Cache-Control "public"; } - sub_filter 'href="/' 'href="$http_x_ingress_path/'; - sub_filter 'url(/' 'url($http_x_ingress_path/'; - sub_filter '"/dist/' '"$http_x_ingress_path/dist/'; - sub_filter '"/js/' '"$http_x_ingress_path/js/'; - sub_filter '
' ''; + sub_filter 'href="/BASE_PATH/' 'href="$http_x_ingress_path/'; + sub_filter 'url(/BASE_PATH/' 'url($http_x_ingress_path/'; + sub_filter '"/BASE_PATH/dist/' '"$http_x_ingress_path/dist/'; + sub_filter '"/BASE_PATH/js/' '"$http_x_ingress_path/js/'; + sub_filter '"/BASE_PATH/assets/' '"$http_x_ingress_path/assets/'; + sub_filter '="/BASE_PATH/"' '=window.baseUrl'; + sub_filter '' ''; sub_filter_types text/css application/javascript; sub_filter_once off; diff --git a/docs/docs/configuration/advanced.md b/docs/docs/configuration/advanced.md index 790b494f7..8e6727bcd 100644 --- a/docs/docs/configuration/advanced.md +++ b/docs/docs/configuration/advanced.md @@ -67,3 +67,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/birdseye.md b/docs/docs/configuration/birdseye.md new file mode 100644 index 000000000..a3f05a107 --- /dev/null +++ b/docs/docs/configuration/birdseye.md @@ -0,0 +1,14 @@ +# Birdseye + +Birdseye allows a heads-up view of your cameras to see what is going on around your property / space without having to watch all cameras that may have nothing happening. Birdseye allows specific modes that intelligently show and disappear based on what you care about. + +### Birdseye Modes + +Birdseye offers different modes to customize which cameras show under which circumstances. + - **continuous:** All cameras are always included + - **motion:** Cameras that have detected motion within the last 30 seconds are included + - **objects:** Cameras that have tracked an active object within the last 30 seconds are included + +### Custom Birdseye Icon + +A custom icon can be added to the birdseye background by provided a file `custom.png` inside of the Frigate `media` folder. The file must be a png with the icon as transparent, any non-transparent pixels will be white when displayed in the birdseye view. diff --git a/docs/docs/configuration/camera_specific.md b/docs/docs/configuration/camera_specific.md index 465e0a5ce..21275518c 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 @@ -102,7 +101,7 @@ 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 + input_args: -avoid_negative_ts make_zero -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 ``` ### UDP Only Cameras @@ -111,5 +110,16 @@ 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 + 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 e2153f4f2..c3b717f24 100644 --- a/docs/docs/configuration/hardware_acceleration.md +++ b/docs/docs/configuration/hardware_acceleration.md @@ -5,51 +5,29 @@ title: Hardware Acceleration It is recommended to update your configuration to enable hardware accelerated decoding in ffmpeg. Depending on your system, these parameters may not be compatible. More information on hardware accelerated decoding for ffmpeg can be found here: https://trac.ffmpeg.org/wiki/HWAccelIntro -### Raspberry Pi 3/4 (32-bit OS) +### Raspberry Pi 3/4 Ensure you increase the allocated RAM for your GPU to at least 128 (raspi-config > Performance Options > GPU Memory). **NOTICE**: If you are using the addon, you may need to turn off `Protection mode` for hardware acceleration. ```yaml ffmpeg: - hwaccel_args: - - -c:v - - h264_mmal -``` - -### Raspberry Pi 3/4 (64-bit OS) - -**NOTICE**: If you are using the addon, you may need to turn off `Protection mode` for hardware acceleration. - -```yaml -ffmpeg: - hwaccel_args: - - -c:v - - h264_v4l2m2m + hwaccel_args: -c:v h264_v4l2m2m ``` ### Intel-based CPUs (<10th Generation) via Quicksync ```yaml ffmpeg: - hwaccel_args: - - -hwaccel - - vaapi - - -hwaccel_device - - /dev/dri/renderD128 - - -hwaccel_output_format - - yuv420p + 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=i965` to your docker-compose file. ### Intel-based CPUs (>=10th Generation) via Quicksync ```yaml ffmpeg: - hwaccel_args: - - -hwaccel - - qsv - - -qsv_device - - /dev/dri/renderD128 + hwaccel_args: -c:v h264_qsv ``` ### AMD/ATI GPUs (Radeon HD 2000 and newer GPUs) via libva-mesa-driver @@ -58,13 +36,83 @@ ffmpeg: ```yaml ffmpeg: - hwaccel_args: - - -hwaccel - - vaapi - - -hwaccel_device - - /dev/dri/renderD128 + hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p ``` ### NVIDIA GPU -NVIDIA GPU based decoding via NVDEC is supported, but requires special configuration. See the [NVIDIA NVDEC documentation](/configuration/nvdec) for more details. +[Supported Nvidia GPUs for Decoding](https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new) + +These instructions are based on the [jellyfin documentation](https://jellyfin.org/docs/general/administration/hardware-acceleration.html#nvidia-hardware-acceleration-on-docker-linux) + +Add `--gpus all` to your docker run command or update your compose file. + +```yaml +services: + frigate: + ... + image: blakeblackshear/frigate:stable + deploy: # <------------- Add this section + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] +``` + +The decoder you need to pass in the `hwaccel_args` will depend on the input video. + +A list of supported codecs (you can use `ffmpeg -decoders | grep cuvid` in the container to get a list) + +```shell + V..... h263_cuvid Nvidia CUVID H263 decoder (codec h263) + V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264) + V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc) + V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg) + V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video) + V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video) + V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4) + V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1) + V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8) + V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9) +``` + +For example, for H264 video, you'll select `h264_cuvid`. + +```yaml +ffmpeg: + hwaccel_args: -c:v h264_cuvid +``` + +If everything is working correctly, you should see a significant improvement in performance. +Verify that hardware decoding is working by running `nvidia-smi`, which should show the ffmpeg +processes: + +``` ++-----------------------------------------------------------------------------+ +| NVIDIA-SMI 455.38 Driver Version: 455.38 CUDA Version: 11.1 | +|-------------------------------+----------------------+----------------------+ +| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | +| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | +| | | MIG M. | +|===============================+======================+======================| +| 0 GeForce GTX 166... Off | 00000000:03:00.0 Off | N/A | +| 38% 41C P2 36W / 125W | 2082MiB / 5942MiB | 5% Default | +| | | N/A | ++-------------------------------+----------------------+----------------------+ + ++-----------------------------------------------------------------------------+ +| Processes: | +| GPU GI CI PID Type Process name GPU Memory | +| ID ID Usage | +|=============================================================================| +| 0 N/A N/A 12737 C ffmpeg 249MiB | +| 0 N/A N/A 12751 C ffmpeg 249MiB | +| 0 N/A N/A 12772 C ffmpeg 249MiB | +| 0 N/A N/A 12775 C ffmpeg 249MiB | +| 0 N/A N/A 12800 C ffmpeg 249MiB | +| 0 N/A N/A 12811 C ffmpeg 417MiB | +| 0 N/A N/A 12827 C ffmpeg 417MiB | ++-----------------------------------------------------------------------------+ +``` diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 61ac9aa90..57bc815dd 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -114,6 +114,7 @@ environment_vars: EXAMPLE_VAR: value # Optional: birdseye configuration +# NOTE: Can (enabled, mode) be overridden at the camera level birdseye: # Optional: Enable birdseye view (default: shown below) enabled: True @@ -138,7 +139,7 @@ ffmpeg: # NOTE: See hardware acceleration docs for your specific device hwaccel_args: [] # Optional: global input args (default: shown below) - input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 + input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 # Optional: global output args output_args: # Optional: output args for detect streams (default: shown below) @@ -202,6 +203,10 @@ objects: min_area: 5000 # Optional: maximum width*height of the bounding box for the detected object (default: 24000000) max_area: 100000 + # Optional: minimum width/height of the bounding box for the detected object (default: 0) + min_ratio: 0.5 + # Optional: maximum width/height of the bounding box for the detected object (default: 24000000) + max_ratio: 2.0 # Optional: minimum score for the object to initiate tracking (default: shown below) min_score: 0.5 # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below) @@ -245,12 +250,14 @@ motion: # Enables dynamic contrast improvement. This should help improve night detections at the cost of making motion detection more sensitive # for daytime. improve_contrast: False + # Optional: Delay when updating camera motion through MQTT from ON -> OFF (default: shown below). + mqtt_off_delay: 30 # Optional: Record configuration # NOTE: Can be overridden at the camera level record: # Optional: Enable recording (default: shown below) - # WARNING: If recording is disabled in the config, turning it on via + # WARNING: If recording is disabled in the config, turning it on via # the UI or MQTT later will have no effect. # WARNING: Frigate does not currently support limiting recordings based # on available disk space automatically. If using recordings, @@ -275,10 +282,6 @@ record: mode: all # Optional: Event recording settings events: - # Optional: Maximum length of time to retain video during long events. (default: shown below) - # NOTE: If an object is being tracked for longer than this amount of time, the retained recordings - # will be the last x seconds of the event unless retain->days under record is > 0. - max_seconds: 300 # Optional: Number of seconds before the event to include (default: shown below) pre_capture: 5 # Optional: Number of seconds after the event to include (default: shown below) @@ -447,4 +450,12 @@ cameras: quality: 70 # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones) required_zones: [] + + # Optional: Configuration for how camera is handled in the GUI. + ui: + # Optional: Adjust sort order of cameras in the UI. Larger numbers come later (default: shown below) + # By default the cameras are sorted alphabetically. + order: 0 + # Optional: Whether or not to show the camera in the Frigate UI (default: shown below) + dashboard: True ``` diff --git a/docs/docs/configuration/nvdec.md b/docs/docs/configuration/nvdec.md deleted file mode 100644 index 69889241b..000000000 --- a/docs/docs/configuration/nvdec.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -id: nvdec -title: NVIDIA hardware decoder ---- - -Certain nvidia cards include a hardware decoder, which can greatly improve the -performance of video decoding. In order to use NVDEC, a special build of -ffmpeg with NVDEC support is required. The special docker architecture 'amd64nvidia' -includes this support for amd64 platforms. An aarch64 for the Jetson, which -also includes NVDEC may be added in the future. - -Some more detailed setup instructions are also available in [this issue](https://github.com/blakeblackshear/frigate/issues/1847#issuecomment-932076731). - -## Docker setup - -### Requirements - -[nVidia closed source driver](https://www.nvidia.com/en-us/drivers/unix/) required to access NVDEC. -[nvidia-docker](https://github.com/NVIDIA/nvidia-docker) required to pass NVDEC to docker. - -### Setting up docker-compose - -In order to pass NVDEC, the docker engine must be set to `nvidia` and the environment variables -`NVIDIA_VISIBLE_DEVICES=all` and `NVIDIA_DRIVER_CAPABILITIES=compute,utility,video` must be set. - -In a docker compose file, these lines need to be set: - -```yaml -services: - frigate: - ... - image: blakeblackshear/frigate:stable-amd64nvidia - runtime: nvidia - environment: - - NVIDIA_VISIBLE_DEVICES=all - - NVIDIA_DRIVER_CAPABILITIES=compute,utility,video -``` - -### Setting up the configuration file - -In your frigate config.yml, you'll need to set ffmpeg to use the hardware decoder. -The decoder you choose will depend on the input video. - -A list of supported codecs (you can use `ffmpeg -decoders | grep cuvid` in the container to get a list) - -```shell - V..... h263_cuvid Nvidia CUVID H263 decoder (codec h263) - V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264) - V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc) - V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg) - V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video) - V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video) - V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4) - V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1) - V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8) - V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9) -``` - -For example, for H265 video (hevc), you'll select `hevc_cuvid`. Add -`-c:v hevc_cuvid` to your ffmpeg input arguments: - -```yaml -ffmpeg: - input_args: ... - - -c:v - - hevc_cuvid -``` - -If everything is working correctly, you should see a significant improvement in performance. -Verify that hardware decoding is working by running `nvidia-smi`, which should show the ffmpeg -processes: - -``` -+-----------------------------------------------------------------------------+ -| NVIDIA-SMI 455.38 Driver Version: 455.38 CUDA Version: 11.1 | -|-------------------------------+----------------------+----------------------+ -| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | -| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | -| | | MIG M. | -|===============================+======================+======================| -| 0 GeForce GTX 166... Off | 00000000:03:00.0 Off | N/A | -| 38% 41C P2 36W / 125W | 2082MiB / 5942MiB | 5% Default | -| | | N/A | -+-------------------------------+----------------------+----------------------+ - -+-----------------------------------------------------------------------------+ -| Processes: | -| GPU GI CI PID Type Process name GPU Memory | -| ID ID Usage | -|=============================================================================| -| 0 N/A N/A 12737 C ffmpeg 249MiB | -| 0 N/A N/A 12751 C ffmpeg 249MiB | -| 0 N/A N/A 12772 C ffmpeg 249MiB | -| 0 N/A N/A 12775 C ffmpeg 249MiB | -| 0 N/A N/A 12800 C ffmpeg 249MiB | -| 0 N/A N/A 12811 C ffmpeg 417MiB | -| 0 N/A N/A 12827 C ffmpeg 417MiB | -+-----------------------------------------------------------------------------+ -``` diff --git a/docs/docs/configuration/user_interface.md b/docs/docs/configuration/user_interface.md new file mode 100644 index 000000000..72ce5a5d6 --- /dev/null +++ b/docs/docs/configuration/user_interface.md @@ -0,0 +1,15 @@ +--- +id: user_interface +title: User Interface Configurations +--- + +### Experimental UI + +While developing and testing new components, users may decide to opt-in to test potential new features on the front-end. + +```yaml +ui: + use_experimental: true +``` + +Note that experimental changes may contain bugs or may be removed at any time in future releases of the software. Use of these features are presented as-is and with no functional guarantee. diff --git a/docs/docs/contributing.md b/docs/docs/contributing.md index a818000b4..0d5c49262 100644 --- a/docs/docs/contributing.md +++ b/docs/docs/contributing.md @@ -40,9 +40,7 @@ Fork [blakeblackshear/frigate-hass-integration](https://github.com/blakeblackshe ### Setup -#### 1. Build the docker container locally with the appropriate make command - -For x86 machines, use `make amd64_frigate` +#### 1. Build the version information and docker container locally by running `make` #### 2. Create a local config file for testing @@ -90,6 +88,38 @@ VSCode will start the docker compose file for you and open a terminal window con After closing VSCode, you may still have containers running. To close everything down, just run `docker-compose down -v` to cleanup all containers. +### Testing + +#### FFMPEG Hardware Acceleration + +The following commands are used inside the container to ensure hardware acceleration is working properly. + +**Raspberry Pi (64bit)** + +This should show <50% CPU in top, and ~80% CPU without `-c:v h264_v4l2m2m`. + +```shell +ffmpeg -c:v h264_v4l2m2m -re -stream_loop -1 -i https://streams.videolan.org/ffmpeg/incoming/720p60.mp4 -f rawvideo -pix_fmt yuv420p pipe: > /dev/null +``` + +**NVIDIA** + +```shell +ffmpeg -c:v h264_cuvid -re -stream_loop -1 -i https://streams.videolan.org/ffmpeg/incoming/720p60.mp4 -f rawvideo -pix_fmt yuv420p pipe: > /dev/null +``` + +**VAAPI** + +```shell +ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p -re -stream_loop -1 -i https://streams.videolan.org/ffmpeg/incoming/720p60.mp4 -f rawvideo -pix_fmt yuv420p pipe: > /dev/null +``` + +**QSV** + +```shell +ffmpeg -c:v h264_qsv -re -stream_loop -1 -i https://streams.videolan.org/ffmpeg/incoming/720p60.mp4 -f rawvideo -pix_fmt yuv420p pipe: > /dev/null +``` + ## Web Interface ### Prerequisites @@ -117,20 +147,16 @@ cd web && npm install #### 3. Run the development server ```console -cd web && npm run start +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 provide an environment variable, `SNOWPACK_PUBLIC_API_HOST` that tells the web application how to connect to the Frigate API: - -```console -cd web && SNOWPACK_PUBLIC_API_HOST=http://