Skip to content

Instantly share code, notes, and snippets.

@ilio
Created April 8, 2023 19:32
Show Gist options
  • Save ilio/8cc39b6599088a7ad8d791551ec91124 to your computer and use it in GitHub Desktop.
Save ilio/8cc39b6599088a7ad8d791551ec91124 to your computer and use it in GitHub Desktop.
qnap QBoat Sunny web camera rtsp
FROM debian
RUN apt update && apt install -y tzdata; \
apt clean;
# sshd
RUN mkdir /var/run/sshd; \
apt install -y openssh-server; \
sed -i 's/^#\(PermitRootLogin\) .*/\1 yes/' /etc/ssh/sshd_config; \
sed -i 's/^\(UsePAM yes\)/# \1/' /etc/ssh/sshd_config; \
apt clean;
RUN apt install -y build-essential libevent-dev libjpeg-dev libbsd-dev v4l-utils usbutils \
hwinfo git sudo curl nano ffmpeg;
# RUN cd /root; \
# git clone --depth=1 https://github.com/pikvm/ustreamer; \
# cd ustreamer/; \
# make; \
RUN echo 'install mediamtx'; \
cd /root; \
curl -OJLv https://github.com/aler9/mediamtx/releases/download/v0.22.0/mediamtx_v0.22.0_linux_armv7.tar.gz; \
ls -la; \
mkdir mediamtx; \
tar -C mediamtx -xf mediamtx_v0.22.0_linux_armv7.tar.gz; \
{ \
echo ' cam:'; \
echo ' runOnInit: ffmpeg -f v4l2 -i /dev/video0 -pix_fmt yuv420p -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH'; \
echo ' runOnInitRestart: yes'; \
} >> mediamtx/mediamtx.yml; \
sed -i 's/^api: no/api: yes/' mediamtx/mediamtx.yml; \
sed -i 's/^apiAddress: 127.0.0.0:9997/apiAddress: :9997/' mediamtx/mediamtx.yml;
# entrypoint
RUN { \
echo '#!/bin/bash -eu'; \
echo 'ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime'; \
echo 'echo "root:${ROOT_PASSWORD}" | chpasswd'; \
echo 'v4l2-ctl --set-fmt-video width=1920,height=1080,pixelformat=MJPG'; \
echo '/root/mediamtx/mediamtx /root/mediamtx/mediamtx.yml &'; \
echo 'exec "$@"'; \
} > /usr/local/bin/entry_point.sh; \
chmod +x /usr/local/bin/entry_point.sh;
ENV TZ Asia/Jerusalem
ENV ROOT_PASSWORD root
EXPOSE 22
EXPOSE 8080
EXPOSE 8554
EXPOSE 8000
EXPOSE 8001
EXPOSE 1935
EXPOSE 8888
EXPOSE 8889
EXPOSE 9997
ENTRYPOINT ["entry_point.sh"]
CMD ["/usr/sbin/sshd", "-D", "-e"]
@ilio
Copy link
Author

ilio commented Aug 26, 2023

apt install iproute2

ip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment