Skip to content

CCTV

Network setup for cameras

sudo pacman -S dhcpd
/etc/systemd/network/enp10s0f3u2.network
[Match]
Name=enp10s0f3u2

[Network]
Address=10.0.0.1/24
IPForward=yes
sudo systemctl edit dhcpd4.service

Add these lines

[Service]
ExecStart=/usr/bin/dhcpd -4 -q -cf /etc/dhcpd.conf -pf /run/dhcpd4/dhcpd.pid enp0s29u1u2
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
sudo systemctl enable dhcpd4.service
sudo systemctl start dhcpd4.service
/etc/dhcpd.conf
# dhcpd.conf
# # Global settings
default-lease-time 600;
max-lease-time 7200;
authoritative;

# Subnet configuration
subnet 10.0.0.0 netmask 255.255.255.0 {
    range 10.0.0.10 10.0.0.100;
    option routers 10.0.0.1;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 8.8.8.8, 8.8.4.4;
    option broadcast-address 10.0.0.255;
}

Frigate

source: https://ipv6.rs/tutorial/Arch_Linux/Frigate/

sudo pacman -S git python ffmpeg sudo pacman -S docker docker-buildx sudo systemctl start docker sudo systemctl enable docker
git clone --depth 1 https://github.com/blakeblackshear/frigate.git
cd frigate
cp config/config.yml.example config/config.yml
DOCKER_BUILDKIT=1 docker build -f docker/main/Dockerfile -t frigate .

Check out: https://github.com/blakeblackshear/frigate/discussions/4161

make
make version

Find out the rtsp link for your camera. For mine it turned out to be:

ffmpeg -i "rtsp://admin:L288B3D8@10.0.0.12:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif" result.mp4

proto=Onvif

Without "proto=Onvif" I got no stream.

Where L288B3D8 was the safety code written on camera. In the link proto=Onvif was necessary. This page really helped: https://www.ispyconnect.com/camera/imou

~/frigate/config.yaml
mqtt:
  enabled: false

# ffmpeg:
#   hwaccel_args: preset-nvidia-h264

# detectors:
#   coral:
#     type: edgetpu
#     device: usb

record:
  enabled: True
  retain:
    days: 7
    mode: motion
  alerts:
    retain:
      days: 30
  detections:
    retain:
      days: 30

snapshots:
  enabled: True
  retain:
    default: 30

cameras:
  nomi_bf:
    enabled: true
    ffmpeg:
      inputs:
        # If your camera supports dual streams, use substream for detection
        - path: rtsp://admin:L288B3D8@10.0.0.34:554/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif
          roles:
            - record
        - path: rtsp://admin:L288B3D8@10.0.0.34:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
          roles:
            - detect
    detect:
      enabled: true
      width: 640
      height: 360
      fps: 5

detect:
  enabled: true
version: 0.16-0

Finally:

docker run --name frigate -p 5000:5000 -v $PWD:/config --restart always frigate

Comments