Zoneminder

From Hack Sphere Labs Wiki
Revision as of 19:45, 11 November 2013 by Webdawg (talk | contribs)

Jump to: navigation, search

functions.php


Clear Events

cd /var/cache/zoneminder/events/
rm -rf *

Debian Squeeze

  • Enable Backports
nano /etc/apt/sources.list

add:

deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free

Install other stuff:

apt-get install libfaac-dev
apt-get install libmp3lame-dev
apt-get install libogg-dev
apt-get install libjpeg-dev
apt-get install libtheora-dev
apt-get install libvorbis-dev
apt-get install libx264-dev
apt-get -t squeeze-backports install libxvidcore-dev

Install Zoneminder:

apt-get install zoneminder
ln -s /etc/zm/apache.conf    /etc/apache2/conf.d/zoneminder.conf
/etc/init.d/apache2 restart


  • zmwatch[22830]: ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]

Make shared memory key work:

Test it:

echo 167772160 >/proc/sys/kernel/shmall
echo 167772160 >/proc/sys/kernel/shmmax

Restart Zoneminder

/etc/init.d/zoneminder stop

Make it perm

nano /etc/sysctl.conf
# Increase the maximum shared memory
kernel.shmall = 167772160
kernel.shmmax = 167772160


/etc/init.d/zoneminder start

libjpeg turbo

You can use libjpeg-turbo to speed things up. This is worth it. I had a system at like 6.0 load and now it is at .10 Plus they just released a new version of libjpeg turbo.

root@hslmonitor:~# locate libjpeg
/usr/lib/libjpeg.a
/usr/lib/libjpeg.la
/usr/lib/libjpeg.so
/usr/lib/libjpeg.so.62
/usr/lib/libjpeg.so.62.0.0
/usr/share/doc/libjpeg62
/usr/share/doc/libjpeg62-dev
/usr/share/doc/libjpeg62-dev/changelog.Debian.gz
/usr/share/doc/libjpeg62-dev/changelog.gz
/usr/share/doc/libjpeg62-dev/coderules.doc.gz
/usr/share/doc/libjpeg62-dev/copyright
/usr/share/doc/libjpeg62-dev/examples
/usr/share/doc/libjpeg62-dev/examples/example.c.gz
/usr/share/doc/libjpeg62-dev/libjpeg.doc.gz
/usr/share/doc/libjpeg62-dev/README.Debian
/usr/share/doc/libjpeg62-dev/structure.doc.gz
/usr/share/doc/libjpeg62/changelog.Debian.gz
/usr/share/doc/libjpeg62/changelog.gz
/usr/share/doc/libjpeg62/copyright
/usr/share/doc/libjpeg62/README.gz
/var/cache/apt/archives/libjpeg62-dev_6b1-1_amd64.deb
/var/cache/apt/archives/libjpeg62_6b1-1_amd64.deb


replace libjpeg with libjpeg-turbo (64bit)

dpkg --remove --force-depends libjpeg62
dpkg --remove --force-depends libjpeg62-dev
wget libjpeg-turbo 64bit deb file
mv (downloaded name) to libjpeg-turbo-official_1.3.0_amd64.deb or whatever
dpkg -i libjpeg-turbo-official_1.3.0_amd64.deb
ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a && \
ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h && \
ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h && \
ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h && \
ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h

  • I used (64bit):
ln -s /opt/libjpeg-turbo/lib64/libjpeg.a /usr/lib/libjpeg.a && \
ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h && \
ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h && \
ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h && \
ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h
  • Taken from same link:
echo "/opt/libjpeg-turbo/lib" > /etc/ld.so.conf.d/libjpeg-turbo.conf && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/ffmpeg.conf && \
echo "LD_LIBRARY_PATH=/usr/local/lib:/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH" >> /etc/bash.bashrc && \
echo "export LD_LIBRARY_PATH" >> /etc/bash.bashrc
  • I used (just for turbo)
echo "/opt/libjpeg-turbo/lib64" > /etc/ld.so.conf.d/libjpeg-turbo.conf && \
echo "LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64:$LD_LIBRARY_PATH" >> /etc/bash.bashrc && \
echo "export LD_LIBRARY_PATH" >> /etc/bash.bashrc
ldconfig

Disable Corrupt JPEG Data

zmc_m3[12280]: WAR [Corrupt JPEG data: 1 extraneous bytes before marker 0xd9] 

Another way is just disable writing these messages to log files. If you are using rsyslog (default in debian):

#cat /etc/rsyslog.d/00-zm-foscam.conf
:msg, contains, "WAR [Corrupt JPEG data: 1 extraneous bytes before marker 0xd9]" ~
:msg, contains, "WAR [Corrupt JPEG data: 2 extraneous bytes before marker 0xd9]" ~
#service rsyslog restart

If you are use syslog-ng:

destination df_null { };
filter f_libjpeg { message(“WAR \\[Corrupt JPEG data: .+ extraneous bytes before marker”); };
log {
source(s_src);
filter(f_libjpeg);
destination(df_null);
flags(final);
};

Controlling CPU Usage

The lib turbo jpeg is reccomended but if you are using modetect it is best to lower the framrate. From the Zoneminder FAQ's:

  • Capture frame rates. Unless there's a compelling reason in your case there is often little benefit in running cameras at 25fps when 5-10fps would often get you results just as good. Try changing your monitor settings to limit your cameras to lower frame rates. You can still configure ZM to ignore these limits and capture as fast as possible when motion is detected.

I had a VM cpu at 100 percent with 3 cams. I lowered to 5fps and cpu is at 30 percent.

Notes