Difference between revisions of "Raspberry Pi 4 - Raspbian"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 5: Line 5:
(https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177)
(https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177)
I will wait until boot from usb is fixed, instead of dealing with above. But I would recommend an external SSD or HDD for all the video and picture storage.
I will wait until boot from usb is fixed, instead of dealing with above. But I would recommend an external SSD or HDD for all the video and picture storage.
A guide to putting the rootfs on an external usb drive, is here: web.archive.org/web/https://gist.github.com/lucabelluccini/9a11c48dcf1d627bbcbd8213f6de3eae


Raspbian might have better performance than Ubuntu or Debian RPI images due to fixes tailored for the RPI. Some things are certainly more streamlined, such as the SD Card auto resizing upon dd'ing the Raspbian image. In Debian and Ubuntu resizing the SD card filesystem is a manual step.
Raspbian might have better performance than Ubuntu or Debian RPI images due to fixes tailored for the RPI. Some things are certainly more streamlined, such as the SD Card auto resizing upon dd'ing the Raspbian image. In Debian and Ubuntu resizing the SD card filesystem is a manual step.
Line 125: Line 126:
The RPI4 is currently the most powerful RPI available. There are 1GB, 2GB, and 4GB versions available. For ZM, I would recommend either the 2GB or the 4GB. The additional RAM does not make ZM much more powerful than the previous RPI3, but it helps. In the end, the CPU is the limiting factor, and as with all ARM boards, you find that it can't compete with X86-64. But for small setups, the RPI4 is useful, or as an adjunct to a large setup.
The RPI4 is currently the most powerful RPI available. There are 1GB, 2GB, and 4GB versions available. For ZM, I would recommend either the 2GB or the 4GB. The additional RAM does not make ZM much more powerful than the previous RPI3, but it helps. In the end, the CPU is the limiting factor, and as with all ARM boards, you find that it can't compete with X86-64. But for small setups, the RPI4 is useful, or as an adjunct to a large setup.


There has been some hype about this pi being the fastest ever, and how it's going to overtake desktops. Yes, this is a faster pi than the RPI3, but it's not significantly faster. It's a step ahead - that's it. Ignore the hyperbole about exaggerated performance gains. It's what you would expect from the successor to the RPI3. The additional RAM helps, but cameras will still drop out. The RAM doesn't stop that.
There has been some hype about this pi being the fastest ever, and how it's going to be usable as a desktop. Yes, this is a faster pi than the RPI3, but it's not significantly faster. It's a step ahead - that's it. Ignore the hyperbole about exaggerated performance gains. It's what you would expect from the successor to the RPI3. The additional RAM helps, but cameras will still drop out. The RAM doesn't stop that. The pi was always usable as a desktop computer, but only for low CPU tasks.


===Benchmarks===
===Benchmarks===

Revision as of 20:17, 9 September 2019

The Raspberry Pi 4 has been tested with ZM 1.32.3 and Buster. the RPI4 requires Buster, so Stretch isn't an option. This guide will also likely work on other RPIs that use Buster.

RPI4 can't boot from USB natively, yet. You can do a workaround, but its a bunch of steps. (https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177) I will wait until boot from usb is fixed, instead of dealing with above. But I would recommend an external SSD or HDD for all the video and picture storage. A guide to putting the rootfs on an external usb drive, is here: web.archive.org/web/https://gist.github.com/lucabelluccini/9a11c48dcf1d627bbcbd8213f6de3eae

Raspbian might have better performance than Ubuntu or Debian RPI images due to fixes tailored for the RPI. Some things are certainly more streamlined, such as the SD Card auto resizing upon dd'ing the Raspbian image. In Debian and Ubuntu resizing the SD card filesystem is a manual step.

If you need H264 Encoding, use zmrepo. Raspbian has support for H264 passthrough and JPEG recording.

When booting RPI4, i tried an hdmi cable to hdmi to hdmi micro adapter, but it didn't work - the monitor kept shutting off. However, i had a hdmi to hdmi micro cable and that worked.

See also:

Preparation

login pi/raspberry

change password

sudo su to root

change root pass

edit ssh settings

enable / start ssh

ZM Install

This guide will follow https://wiki.zoneminder.com/Debian_10_Buster_with_Zoneminder_1.32.3_the_Easy_Way?title=Debian_10_Buster_with_Zoneminder_1.32.3_the_Easy_Way&oldid=15622 but instead of deb multimedia use raspbians 1.32.3 image.

get rid of non-free in /apt/sources.list

sudo apt update

Install LAMP

sudo apt-get install apache2 mariadb-server
sudo mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql

Install and Configure Zoneminder

sudo apt install zoneminder vlc-plugin-base
sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

edit the following user / pass as necessary

sudo mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
sudo mysqladmin -uroot -p reload 
sudo chmod 740 /etc/zm/zm.conf 
sudo chown root:www-data /etc/zm/zm.conf
sudo chown -R www-data:www-data /usr/share/zoneminder/
sudo chown -R www-data:www-data /var/cache/zoneminder/
sudo systemctl enable zoneminder.service
sudo adduser www-data video

Note that if zm fails to start, and you have changed the mysql user/password, be sure to edit /etc/zm/zm.conf with the new user/password

sudo systemctl start zoneminder.service
sudo systemctl status zoneminder.service
sudo a2enmod cgi
sudo a2enmod rewrite
sudo a2enconf zoneminder
sudo nano /etc/php/7.3/apache2/php.ini


Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone 
date.timezone = America/New_York

Optional Tweaks

apt-get remove avahi-daemon #security risk, not needed for basic setups
apt-get remove bluez alsa-utils (not needed)
dpkg-reconfigure locales
  1. check locale
locale

Configure Wifi

if you need wifi do something like the following:

in /etc/network/interfaces put

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto eth0
iface eth0 inet static
       address 192.168.1.100
       netmask 255.255.255.0


in /etc/wpa_supplicant/wpa_supplicant.conf put:

ctrl_interface=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
       ssid="SSIDgoeshere"
       psk="passwordgoeshere"
}

That's all that is needed for a basic wifi setup (with ifupdown package). If you have an unusual wifi setup then you may need additional parameters. e.g. if you have a hidden SSID, you have to add scan_ssid=1 to the network section.

Note that this doesn't work on ubuntu because netplan is the new networking package... Instead, you have to uninstall netplan.io and install the ifupdown package. Note that this is subject to change due to devs endlessly reinventing the wheel. How else will programmers have a job if they don't break things that work? https://www.raspberrypi.org/forums/viewtopic.php?p=1499060


Default ZM RPI4 Install, sits at 190M RAM, Load averages 0.01, 0.21, 0.41 100M of swap


It's recommended you use an external HDD for the RPI to record videos from ZM. Otherwise you will exhaust the amount of writes available to the flash on the sd card. When boot from USB is possible, that will be recommended.

Conclusion

The RPI4 is currently the most powerful RPI available. There are 1GB, 2GB, and 4GB versions available. For ZM, I would recommend either the 2GB or the 4GB. The additional RAM does not make ZM much more powerful than the previous RPI3, but it helps. In the end, the CPU is the limiting factor, and as with all ARM boards, you find that it can't compete with X86-64. But for small setups, the RPI4 is useful, or as an adjunct to a large setup.

There has been some hype about this pi being the fastest ever, and how it's going to be usable as a desktop. Yes, this is a faster pi than the RPI3, but it's not significantly faster. It's a step ahead - that's it. Ignore the hyperbole about exaggerated performance gains. It's what you would expect from the successor to the RPI3. The additional RAM helps, but cameras will still drop out. The RAM doesn't stop that. The pi was always usable as a desktop computer, but only for low CPU tasks.

Benchmarks

1280x720 4FPS Record - 2.1 Load - stable (moderate motion)
1280x720 6FPS Record - 3.5 Load - unstable (moderate motion)

When testing the RPI4, if you are having trouble getting a stream to be stable, do one or more of the following:

  • Lower FPS
  • Lower Resolution
  • Lower Zone size or Disable Analysis completely (ergo use Record instead of Modect or Mocord)

Many cameras, such as Hikvision offer 2 (or even 3) streams that can be adjusted to give you a range of options. H264 Passthrough is recommended for the best performance, and long term storage ability. However, short term storage of MJPEG will also be efficient (at the cost of losing compression on saved video/images), if the stream is MJPEG. Different cameras will perform differently on the Pi.