amuck-landowner

Linux CCTV / camera / security cobblers here?

drmike

100% Tier-1 Gogent
Do we have any resident cobblers / DIY types who are using Linux for CCTV / security related? I mean legit Linux DIY not premade embedded systems.


I am fussing with some China dump wifi cameras (read cheap).  Quite interesting little units for the price (bound to be more like them). ~ $15 a camera delivered.


RTSP streaming from these and seems to be a really common software stack they are loading into lots of these China cams from many many brands.  


Do we have people using the Open Source Zoneminder DVR / CCTV software?  Considering trying to get Zoneminder running on one of my unused ARM boards (yes it exists for ARM also).
 

InertiaNetworks-John

Inertia Networks, LLC
Verified Provider
I'm currently using ZoneMinder, but I have found it takes up way more CPU than commercial software.


I have 5 cameras running at 25 FPS, with a 1920x1080 resolution, and on a 4 core i5 ZoneMinder can barely keep up. Reducing the FPS to 12 seems to help.


Overall, ZoneMinder is very good for open source, but I wouldn't expect to work all too well on any machine without very good processing power.
 

drmike

100% Tier-1 Gogent
Decent machine there and high res... More resources than I'd expect :(


Overhead is just ZoneMinder out of the box, nothing additional complexity / addons / etc.?


Definitely going to give the ARM variant a spin and see what we can make it do.
 

TheLinuxBug

New Member
For more than 1 camera you will at least need an Odroid C2, Zoneminder running 2 cameras one rtsp and the other mjpeg causes 50% load on the c2 and uses about 1GB of ram.  I attempted this on the RPi3 and it couldn't even handle it, ran with a load of 5 and was in constant IO wait because it didn't have enough CPU to process IO.  

top - 06:14:03 up 2 days,  6:40,  1 user,  load average: 2.65, 2.58, 2.50
Tasks: 134 total,   4 running, 130 sleeping,   0 stopped,   0 zombie
%Cpu(s): 47.2 us,  1.2 sy,  0.0 ni, 49.9 id,  1.4 wa,  0.0 hi,  0.3 si,  0.0 st
KiB Mem :  1760384 total,    84492 free,   411552 used,  1264340 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   871020 avail Mem


  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
29331 www-data  20   0  512240 342652 330324 R  58.8 19.5  25:37.54 /usr/lib/zoneminder/cgi-bin/nph-zms
30074 www-data  20   0  510860 345672 330188 S  47.1 19.6   9:57.63 /usr/bin/zma -m 2
29330 www-data  20   0  271192 104972  96332 R  41.2  6.0  20:20.48 /usr/lib/zoneminder/cgi-bin/nph-zms
29767 www-data  20   0  268144 103220  96420 S  23.5  5.9   6:42.80 /usr/bin/zma -m 1
 6297 www-data  20   0  133720  11020   4428 S  17.6  0.6   1:13.43 /usr/sbin/apache2 -k start
 8703 www-data  20   0  267468 100512  96468 S  17.6  5.7  99:27.87 /usr/bin/zmc -m 1
 6414 www-data  20   0  877772 364748 331688 S  11.8 20.7 184:11.13 /usr/bin/zmc -m 2

The above is normal operation with 1 person viewing both camera feeds.  If you don't intend to watch the feeds through zoneminder, it will reduce the load by about 25% but still was too much for the RPi3 to handle.


Tip: if you install zoneminder and intend to use it, make sure you setup MySQL tmpdir to be /dev/shm or loading of events in the viewer will be ridiculously slow if you are waiting on IO of a memory card (I do not have an eMMC chip in my c2 yet, so using a SP 16GB Elite card, 85M/sec read, 10-12M/sec write).  May not need to do this if you have the eMMc as its much faster than the sdcard.


Per my experience you need about 2Ghz (1 core) per camera you intend to use for processing, I am just using default 'modect' with Fast, high sensitivity settings.


There is also the open source 'motion' which runs a little bit leaner, however, you can not define zones for detection and its not 100% stable all the time.  In other words, if you just need to stream your video and detect if there is 'any' motion changes, motion works.  The convenience and likely additional resources user of zoneminder is the fact you can actually specify 'zones' for it to detect instead of detecting across the whole feed like motion does.  Motion will use a little less resources and may function better in a case where you want to use a slower ARM board.  When I was testing it I just made my own web gateway using nginx with a proxy pass through to the feeds.  Wasn't very difficult, but again, zoneminder provides this interface out of the box (using Apache by default).


One more note: As much as I am liking the zoneminder setup, I found that running 'ispy' in Windows, while uses a fair amount of resources is able to accomplish better rendering, better encoding and an overall better experience, especially if you want alerts (has many options).  However, my goal for a while now has been to offload the extra processing somewhere else than my main machine so I have more CPU for during work hours.  If you want something that just works and you have the hardware/license for Windows you will get a better experience out of ispy than from anything on Linux that I have used yet. (Hell if you have a nice enough machine you may be able to run ispy with wine?).


my 2 cents.


Cheers!
 
Last edited by a moderator:
Top
amuck-landowner