prettyprint

2024年5月14日 星期二

Build your own video surveillance system with ZoneMinder. Raspberry Pi 3B+ attached USB webcam, ESP32-CAM & ONVIF Compliant IP CAM.

 本文章紀錄在MSI Mini PC上建立一套surveillance system,軟體使用ZoneMinder,監視攝影機分別使用

  1. USB webcam 附加在Rapberrry Pi 3B+上,
  2. ESP-32-CAM
  3. D-Link DCS-8300LHV2 符合ONVIF規範。
架構如下圖所示:


一、Raspberry Pi 上USB webcam串流影片(MJPEG)設定:

  • 安裝v4l-utils, video for linux 工具。
    $ sudo apt install v4l-utils

  • 使用v4l2-ctl指令:
    $ v4l2-ctl --list-devices

    列出video device:

    $ v4l2-ctl -d /dev/video0 --list-formats-ext

     列出usb webcam支援的格式。


  • 安裝ustreamer工具。
    $ sudo apt install ustreamer

  • 串流webcam影音:
    ustreamer -d /dev/video0 --format MJPEG -s raspi-usbcam.local -p 8080 --encoder HW -r 1920x1080 --us
    er admin --passwd usbcampass

二、安裝ESP32-CAM:

  • 選用AI-Thinker ESP32-CAM:



  • 使用CameraWebServer範例程式:


  • 設定解析度,翻轉與鏡射與固定IP等:


// set fixed camera resolution, flip and mirror
  s->set_framesize(s, FRAMESIZE_VGA);
  s->set_vflip(s,1);
  s->set_hmirror(s,1);
//set static IP 
// Set your Static IP address
  IPAddress local_IP(192, 168, 1, 79);
  // Set your Gateway IP address
  IPAddress gateway(192, 168, 1, 1);
  IPAddress subnet(255, 255, 255, 0);
  IPAddress primaryDNS(192, 168, 1, 1); //optional
  IPAddress secondaryDNS(8, 8, 8, 8); //optional
  if(!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
    Serial.println("STA Failed to configure");
  }
  

三、安裝ZoneMinder:
安裝步驟在ZoneMinder中有詳細說明:




其他詳細步驟請參閱成果影片。

成果影片