Zoneminder on Raspberry Pi

13 posts
by Rehevkor » Fri Sep 02, 2011 1:19 pm
I've been looking for a small, cheap, low power device to use as a server for my Foscam wireless IP security cameras. The Raspberry Pi looks perfect for the job, but I want to make sure it's up to the task.

Does anyone know if Zoneminder ( can be made to run on an ARM cpu, and whether or not the Pi is powerful enough to handle motion detection video recording from two cameras?

I know this is a pretty specific question for something that isn't even available yet, but maybe someone can either tell me "no way this device can handle something like that" or "maybe". For $25 I can afford to be wrong on a "maybe"; I'm sure I could find something else to do with it.

Posts: 2
Joined: Fri Sep 02, 2011 12:09 pm
by jamesh » Fri Sep 02, 2011 1:50 pm
It is in the Debain ARM repository, so yes it does compile. Whether it works I don't know.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17086
Joined: Sat Jul 30, 2011 7:41 pm
by Svartalf » Fri Sep 02, 2011 3:48 pm
I'm sure it "works", for smallish values thereof. Zoneminder needs a bunch of CPU oomph to work well. I don't think, without some GPU assist code in there, that this would cope with more than one cam's worth of data processing. An A8 might manage 2-3. An A9 dual/quad core might manage at a level like the screenshots show.
Posts: 596
Joined: Fri Jul 29, 2011 6:50 pm
by Rehevkor » Fri Sep 02, 2011 4:35 pm
Ok, thanks guys.
Posts: 2
Joined: Fri Sep 02, 2011 12:09 pm
by jeicrash » Sat Sep 03, 2011 5:22 pm
At the cost running one camera per device might not be a bad thing, Even at the cost of SD card, and power adapter they R-PI-B is still lower then most Network based cameras. Great idea. Can't wait till they ship.
Posts: 14
Joined: Fri Aug 19, 2011 5:09 pm
by mjnavapo » Mon Dec 26, 2011 3:26 pm
Perhaps what most CPU usage required is the detection of movement.

But for continuous video recording, 24 hours, several cameras,possibly if serious enough. Are saying?

Any other software better than ZoneMinder?
Posts: 6
Joined: Mon Dec 26, 2011 2:02 pm
by gearhead » Tue Sep 11, 2012 4:38 pm
Zoneminder is in the repo. I was able to install it and get it working on my Raspberry. I went down the rabbit hole is mjpgstreamer as I started reading about using UVC cameras for Zoneminder and it appeared that this may be needed. The current version of the raspbian has UVC support and my camera worked beautifully without any fuss once I knew how to set it up:
the camera reports as:
Code: Select all
ID 04f2:a133 Chicony Electronics Co., Ltd Gateway Webcam

The camera is set up as /dev/video0 as a "monitor"

The setup specifics are:
Source Type: Local
Path: /dev/video0
Capture Method: Video For Linux version 2
Device Channel: 0
Device Format: SECAM L
Color Palette: YUYV
Capture Width: 320
Capture Height: 240

With this, it started to capture video.

There were a couple other tweaks:
This showed up in the log:
Code: Select all
 [Shared data size conflict in shared_data for monitor Monitor-1, expected 328, got 316]

To fix it I needed to edit /usr/share/perl5/ZoneMinder/
to fix it find the line which is:
Code: Select all
our $arch = int(3.2*length(~0));

and replace it with:
Code: Select all
our $arch = 32;

It seems this needs to be done every time zoneminder upgrades through apt-get. Woudl be nice it it was fixed in the repo as the raspberry is a 32 bit device anyway...

If you are getting shared memory errors, due to resolution of the images requiring more shared memory than is available, you may need to adjust the shared memory available
I found this suggestion on the web:
Code: Select all
sudo echo kernel.shmmax = 536870912 >/etc/sysctl.d/60-kernel-shm.conf

then I restarted the zoneminder service
Code: Select all
sudo service zoneminder restart

I also got zimezone errors in the logs which also caused the time reported to be GMT instead of local time. This is a common perl script issue and it fixed by editing the /etc/php5/apache2/php.ini to have the appropriate timezone setting. For me it is CST, so I changed the setting here to be:
Code: Select all
date.zimezone = America/Chicago

then I restarted the zoneminder service
Code: Select all
sudo service zoneminder restart

At this point, I had to set up gmail as the SMTP server so that I could get email notifications based on alarms. This is documented elsewhere on the web, but I had to install and configure postfix
Code: Select all
sudo apt-get install postfix

At this point it all works. My next step is to use wiringPi to open and close the garage door. Once thsi works, only trigger the device to use motion when the garage door is open.

Hope this helps someone.
Posts: 26
Joined: Tue Sep 11, 2012 1:45 pm
by alexeames » Wed Sep 12, 2012 7:19 am
Great post gearhead. Thanks for sharing. :D
Alex Eames RasPi.TV, RasP.iO
User avatar
Forum Moderator
Forum Moderator
Posts: 2807
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by memphis » Wed Jan 09, 2013 9:27 pm
Hi All,
is it possible to capture video from x264 stream? I use IP camera with RTSP protocol with x264 stream. When i configured rtsp stream with h264 using ffmpeg, the CPU is overloaded and GPU hardware acceleration doesn't be used. I need to run ffmpeg with support quad-core GPU. Does anyone more experiences how can i use zoneminder with ffmpeg hardware support on raspberry?
Thank you
Posts: 2
Joined: Wed Jan 09, 2013 9:18 pm
by phbcanada » Wed Jan 16, 2013 10:52 pm
Thanks gearhead. Can you tell us what type of camera you're using? Do you have more than one hooked into zoneminder? I read somewhere that zoneminder is a bit overkill for single camera setup. Is it running well?
User avatar
Posts: 13
Joined: Tue Dec 11, 2012 1:16 pm
by gearhead » Wed Jul 24, 2013 1:11 pm
I am using a cheap camera (10.00USD ?) It is a single camera, for now. Overkill is relative. For me it works.
Posts: 26
Joined: Tue Sep 11, 2012 1:45 pm
by ds18s20 » Sun Dec 01, 2013 12:07 am
Very good summary gearhead on the typical ZM remedies; those can take up some time figuring out; however please do clarify:

Does the Raspi camera board show up as /dev/video0 or does it not in context of ZM configuration?

If it does show up as /dev/video0 then the stock mjpgstreamer would just work; no need for the experimental version?

User avatar
Posts: 80
Joined: Fri Dec 23, 2011 5:44 am
Location: San Francisco
by gearhead » Sun Dec 01, 2013 1:03 pm
I don't know about the raspi camera as I don't yet have one.

Posts: 26
Joined: Tue Sep 11, 2012 1:45 pm