mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
d8123d2497
* Pull go2rtc dependency * Add go2rtc to local services and add to s6 * Add relay controller for go2rtc * Add restream role * Add restream role * Add restream to nginx * Add camera live source config * Disable RTMP by default and use restream * Use go2rtc for camera config * Fix go2rtc move * Start restream on frigate start * Send restream to camera level * Fix restream * Make sure jsmpeg works as expected * Make view rspect live size config * Tweak player options to fit live view * Adjust VideoPlayer to accept live option which disables irrelevant controls * Add multiple options from restream live view * Add base for webrtc option * Setup specific restream modules * Make mp4 the default streaming for now * Expose 8554 for rtsp relay from go2rtc * Formatting * Update docs to suggest new restream method. * Update docs to reflect restream role * Update docs to reflect restream role * Add webrtc player * Improvements to webRTC * Support webrtc * Cleanup * Adjust rtmp test and add restream test * Fix tests * Add restream tests * Add live view docs and show different options * Small docs tweak * Support all stream types * Update to beta 9 of go2rtc * Formatting * Make jsmpeg the default * Support wss if made from https * Support wss if made from https * Use onEffect * Set url outside onEffect * Fix passed deps * Update docs about required host mode * Try memo instead * Close websocket on changing camera * Formatting * Close pc connection * Set video source to null on cleanup * Use full path since go2rtc can't see PATH var * Adjust audio codec to enable browser audio by default * Cleanup stream creation * Add restream tests * Format tests * Mock requests * Adjust paths * Move stream configs to restream * Remove live source * Remove live config * Use live persistence for which view to use on each camera * Fix live sizes * Only use jsmpeg sizes for jsmpeg live * Set max live size * Remove access of live config * Add selector for live view source in web view * Remove RTMP from default list of roles * Update docs * Fix tests * Fix docs for live view modes * make default undefined to avoid race condition * Wait until camera source is loaded to avoid race condition * Fix tests * Add config to go2rtc * Work with config * Set full path for config * Set to use stun * Check for mounted file * Look for frigate-go2rtc * Update docs to reflect webRTC configuration. * Add link to go2rtc config * Update docs to be more clear * Update docs to be more clear * Update format Co-authored-by: Felipe Santos <felipecassiors@gmail.com> * Update live docs * Improve bash startup script * Add option to force audio compatibility * Formatting * Fix mapping * Fix broken link * Update go2rtc version * Get go2rtc webui working * Add support for mse * Remove mp4 option * Undo changes to video player * Update docs for new live view options * Make separate path for mse * Remove unused * Remove mp4 path * Try to get go2rtc proxy working * Try to get go2rtc proxy working * Remove unused callback * Allow websocket on restrea dashboard * Make mse default stream option * Fix mse sizing * don't assume roles is defined * Remove nginx mapping to go2rtc ui Co-authored-by: Felipe Santos <felipecassiors@gmail.com> Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
157 lines
6.2 KiB
Docker
157 lines
6.2 KiB
Docker
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
|
|
|
|
# install go2rtc
|
|
RUN wget -O go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-beta.10/go2rtc_linux_${TARGETARCH}" \
|
|
&& chmod +x go2rtc \
|
|
&& mkdir -p /usr/local/go2rtc/sbin/ \
|
|
&& mv go2rtc /usr/local/go2rtc/sbin/go2rtc
|
|
|
|
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
|
|
EXPOSE 8554
|
|
EXPOSE 8555
|
|
|
|
ENTRYPOINT ["/init"]
|
|
|
|
CMD ["python3", "-u", "-m", "frigate"]
|