software:zoneminder:picamera
Differences
This shows you the differences between two versions of the page.
| — | software:zoneminder:picamera [2025/04/15 15:53] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Raspberry Pi Camera on ZoneMinder ====== | ||
| + | |||
| + | I spent a lot of time trying to find some good software to run on a Raspberry Pi to turn it into a camera. Even tried to write my own using Perl, but all the libraries are in Python, so it took too much for a simple project. | ||
| + | |||
| + | I found the v4l2rtspserver (https:// | ||
| + | |||
| + | Anyway, no GUI needed, so I did the Raspberry Pi OS Lite (https:// | ||
| + | |||
| + | ===== Get raspbian image onto SD ===== | ||
| + | |||
| + | - Download the Lite version of Raspbian from [[https:// | ||
| + | - write the downloaded image to the micro-sd (do not uncompress) | ||
| + | - mount /boot from SD onto /mnt | ||
| + | <code bash> | ||
| + | touch / | ||
| + | # only do the following if you need wifi. Change country code, ssid and psk for your system | ||
| + | # see [[https:// | ||
| + | cat <<EOF >/ | ||
| + | ctrl_interface=DIR=/ | ||
| + | update_config=1 | ||
| + | country=< | ||
| + | |||
| + | network={ | ||
| + | | ||
| + | | ||
| + | } | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | Insert SD into your Pi and boot up. | ||
| + | ===== Configure Raspberry Pi ===== | ||
| + | |||
| + | Enable wlan by adding the following to / | ||
| + | < | ||
| + | country=US | ||
| + | network={ | ||
| + | | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Now, do the install | ||
| + | <code bash> | ||
| + | # Set up Camera | ||
| + | raspi-config # go to Interface, and enable camera | ||
| + | reboot | ||
| + | ls -lh /dev/video* | ||
| + | raspistill -v -o test.jpg # Verify camera works | ||
| + | # Remove Swap File | ||
| + | sudo systemctl stop dphys-swapfile.service | ||
| + | sudo systemctl disable dphys-swapfile.service | ||
| + | sudo systemctl mask dphys-swapfile.service | ||
| + | sudo rm /var/swap | ||
| + | # add zram for swap | ||
| + | sudo apt-get install zram-tools | ||
| + | sed -i ' | ||
| + | sudo systemctl enable zramswap | ||
| + | sudo systemctl restart zramswap | ||
| + | # Set up ntp | ||
| + | sudo apt-get install ntp | ||
| + | sudo timedatectl set-timezone America/ | ||
| + | # add base packages needed | ||
| + | sudo apt install \ | ||
| + | liblivemedia-dev liblog4cpp5-dev libasound2-dev git gdebi-core cmake build-essential v4l-utils | ||
| + | # get and build v4l2... | ||
| + | git clone https:// | ||
| + | cd v4l2rtspserver | ||
| + | cmake . | ||
| + | make | ||
| + | sudo make install | ||
| + | # do the install | ||
| + | sudo gdebi v4l2rtspserver-0.2.0-6-g3542b6f-Linux-armv6l.deb | ||
| + | # create systemd module | ||
| + | cat <<EOF >/ | ||
| + | # systemd configuration for v4l2rtspserver | ||
| + | # / | ||
| + | |||
| + | [Unit] | ||
| + | Description=v4l2rtspserver rtsp streaming server | ||
| + | After=network.target | ||
| + | |||
| + | [Service] | ||
| + | # | ||
| + | ExecStartPre=/ | ||
| + | ExecStart=/ | ||
| + | # | ||
| + | Type=simple | ||
| + | User=root | ||
| + | Group=video | ||
| + | Restart=always | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | EOF | ||
| + | |||
| + | # enable the service | ||
| + | sudo systemctl enable --now v4l2rtspserver.service | ||
| + | </ | ||
| + | |||
| + | At this point, you should be able to get an rtsp by pointing vlc to [[rtsp:// | ||
| + | |||
| + | ===== Zoneminder Configuration ===== | ||
| + | |||
| + | Create a new monitor in ZoneMinder with the following parameters | ||
| + | |||
| + | * Source Type: Remote | ||
| + | * Remote Protocol: RTSP | ||
| + | * Remote Method: RTP/Unicast | ||
| + | * Remote Host Name: Hostname or IP | ||
| + | * Remote Host Port: 8554 | ||
| + | * Remote Host Path: /unicast | ||
| + | * Capture Width: 640 | ||
| + | * Capture Height: 480 | ||
| + | |||
| + | |||
| + | You should soon see the output in zoneminder. | ||
| + | |||
| + | ===== Production ===== | ||
| + | |||
| + | For production, change the resolution of //both// the camera and the ZoneMinder configuration | ||
| + | |||
| + | - Edit / | ||
| + | - Change -W and -H (width and height) to your desired parameters | ||
| + | - 1920 x 1080 (1080p) Gives you a lot of details, but also transfers a lot of traffic and is fuzzy | ||
| + | - 1280 x 720 (720p) Is a lot lower bandwidth and " | ||
| + | - <code bash> | ||
| + | # reload the systemctl daemon | ||
| + | systemctl daemon-reload | ||
| + | # reload the config for v4l2rtspserver | ||
| + | systemctl restart v4l2rtspserver | ||
| + | # Set v4l2rtspserver to autostart | ||
| + | systemctl enable v4l2rtspserver | ||
| + | </ | ||
| + | - Edit Monitor on ZoneMinder | ||
| + | - Set Capture Resolution to same values as camera | ||
| + | |||
| + | ===== Links ===== | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
software/zoneminder/picamera.1622667786.txt.gz · Last modified: (external edit)
