Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 24th November 2010, 08:36
letsharehowto letsharehowto is offline
Junior Member
Join Date: Dec 2009
Location: Sai gon - Viet Nam
Posts: 12
Thanks: 0
Thanked 12 Times in 8 Posts
Default High quality video security with Ubuntu desktop 10.10, Zoneminder 1.24.x and webcam.

Today I will tell you how to build video security system with Ubuntu desktop 10.10, Zoneminder 1.24.x, webcam, high quality video output.

My box:
-Laptop Dell Latitude 131L
-Memory: 512MB
-Webcam: http://www.logitech.com/en-us/435/269?WT.z_sp=Image

We have 3 step:

-Install Ubuntu desktop 10.10.
-Install Zoneminder.
-Config Zoneminder.

1/-Install Ubuntu desktop:

Set up new box Ubuntu desktop 10.10: http://www.howtoforge.com/the-perfec...verick-meerkat
Finish install, reboot box.

Click Applications -> Accessories -> Terminal. Enable root account:

sudo passwd root
Logon with root and latter do everything with root too:

Update box:

apt-get update && apt-get upgrade -y
Reboot box:

2/-Install zoneminder:

Open Terminal, logon with root:

Make Pada scrip:

nano pada.sh
Cut and paste this quote into file then save and exit:

# ZoneMinder 1.24.2 installation script
# Copyright (C) 2010 Chris "Pada" Kistner
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.

echo "--- Checking for root privileges..."
if [ "`whoami`" != "root" ]; then
echo Error: This script requires root access
exit 1

echo "--- Installing extra codecs, which includes x264 support..."
apt-get -y install libavcodec-extra-52 libavformat-extra-52 libswscale-extra-0 libavfilter-extra-1

echo "--- Installing ZoneMinder..."
apt-get -y install zoneminder

echo "--- Adding ZoneMinder to Apache2..."
ln -s /etc/zm/apache.conf /etc/apache2/sites-enabled/zoneminder.conf
service apache2 restart

echo "--- Adding alias for zoneminder service and fixing ZoneMinder startup..."
ln -s /etc/init.d/zoneminder /etc/init.d/zm
update-rc.d -f zoneminder remove
update-rc.d -f zm remove
update-rc.d zm defaults 92
service zm restart

echo "--- Correcting SHM to 90% of memory..."
apt-get -y install coreutils bc
page_size=$(getconf PAGE_SIZE)
mem_bytes=$(awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo)
mem_bytes_mb=$(expr $mem_bytes / $mb)
shmmax=$(echo "$mem_bytes * 0.90" | bc | cut -f 1 -d '.')
shmmax_mb=$(expr $shmmax / $mb)
shmall=$(expr $mem_bytes / $page_size)
shmmax_cur=$(sysctl -n kernel.shmmax)
shmmax_cur_mb=$(expr $shmmax_cur / $mb)
shmall_cur=$(sysctl -n kernel.shmall)
echo "-- Total memory = $mem_bytes B = $mem_bytes_mb MB"
echo "-- Page size = $page_size B"
echo "-- Current kernel.shmmax = $shmmax_cur B = $shmmax_cur_mb MB"
echo "-- Current kernel.shmall = $shmall_cur pages"
if [ "$shmmax" -eq "$shmmax_cur" ] && [ "$shmall" -eq "$shmall_cur" ]; then
echo "-- Recommended shm values already set"
echo "-- Recommended: kernel.shmmax = $shmmax B = $shmmax_mb MB"
echo "-- Recommended: kernel.shmmall = $shmall pages"
if [ "`grep "^kernel\.shmmax" $file -c`" != "0" ]; then
echo "-- Replacing: kernel.shmmax in $file"
sed "s/^kernel\.shmmax.*$/kernel.shmmax=$shmmax/g" -i $file
echo "-- Adding: kernel.shmmax to $file"
echo kernel.shmmax=$shmmax >> $file
if [ "`grep "^kernel\.shmall" /etc/sysctl.conf -c`" != "0" ]; then
echo "-- Replacing: kernel.shmall in $file"
sed "s/^kernel\.shmall.*$/kernel.shmall=$shmall/g" -i $file
echo "-- Adding: kernel.shmall to $file"
echo kernel.shmall=$shmall >> $file
echo "-- Using: new sysctl values"
sysctl -p

# Done
echo "--- Done."
Make pada.sh can execute:

chmod 744 pada.sh
Install Zoneminder:

( http://picasaweb.google.com/letshare...allZoneminder# )

Add www-data user:

adduser www-data video
Plug in webcam into box then reboot box:

Open terminal. Make sure webcam works:

ls /dev/video*
If it works, the quote like this:

4/-Config Zoneminder:

Open Mozzilla web browser. At address type:

If Zoneminder works, the picture like this. (Make sure in the first line, at middle line like this: "ZoneMinder Console - Running - v1.24.2").

( http://picasaweb.google.com/letshare...50885065119250 )

Click Options.

Then click Paths tab.

Check USE_DEEP_STORAGE like this. Click Save button. You will see popup windows, don't worry, click OK button.

( http://picasaweb.google.com/letshare...50928329398930 )

Then click Images tab. Default JPEG_FILE_QUALITY is 70 , change to 100.

Delete everything at FFMPEG_OUTPUT_OPTIONS and replace with:

-f mp4 -vcodec libx264 -vpre default -an -threads 0
Delete everything at FFMPEG_FORMATS and replace with:

mp4 mpg mpeg wmv asf avi* mov swf 3gp**
When you done, click Save button. Then click Cancel.

( http://picasaweb.google.com/letshare...50918405360930 )

Restart Zoneminder: click Running -> choose Restart -> click Apply.

( http://picasaweb.google.com/letshare...60395076405586 )

If you don't want Zonemonder fill up your hardrive you have to config Fillter. Follow my picture. Look mouse point, number and check:





Add new monitor: click Add New Monitor button then follow these pictures, when finish click save button.





Download "HQ" movies: follow these pictures - look at mouse point.






You can download mysqltuner.pl from http://blog.mysqltuner.com/download to make mysql work smooth.


Chris "Pada" Kistner


- This is not a toy. You have to know what are you doing.
Attached Files
File Type: txt Everything on Ubuntu Desktop 10.10.txt (69.3 KB, 683 views)
Reply With Quote
The Following User Says Thank You to letsharehowto For This Useful Post:
falko (25th November 2010)
Sponsored Links
Old 30th November 2010, 06:29
my6x9s my6x9s is offline
Junior Member
Join Date: Nov 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cut and paste this quote into file then save and exit:

ok having a lil difficulty on the save and exit part of this step what am i missing ??? i am a windoz XP user converting slowly to ubuntu so noob is a understatement. but im am here to learn thank you
Reply With Quote
Old 1st December 2010, 13:43
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts

If you use vi instead of nano, then take a look here: http://www.howtoforge.com/faq/12_15_en.html
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Old 1st December 2010, 14:02
djohns djohns is offline
Junior Member
Join Date: Dec 2010
Location: South Georgia
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dell Studio 1550 Laptop

I really want to get this working. I have a dell studio 1550 laptop with a built in webcam and when I finish the above the source /dev/video0 (0) is red and I can't probe camera. I'm guessing the config file needs adjusting to make this work since this is not a usb camera. However when I use code "ls /dev/video*" to see if webcam is working I get the correct output, /dev/video0
Reply With Quote
Old 2nd December 2010, 07:49
letsharehowto letsharehowto is offline
Junior Member
Join Date: Dec 2009
Location: Sai gon - Viet Nam
Posts: 12
Thanks: 0
Thanked 12 Times in 8 Posts

If your webcam works with another software, you go to step third.
If none, follow this:

Step one:

- You have to read this: https://help.ubuntu.com/community/Webcam

Step two:

- If your webcam be supported by Ubuntu, you install cheese:

sudo apt-get install cheese
Then test your webcam with cheese. If it works go to step third.

Step third:

- You change Capture Method, Device Format, Capture Palete and choose the best one for your webcam.

( http://picasaweb.google.com/letshare...51030284279026 )

If it works, /dev/video0 is green.


- Make sure Zoneminder is Running. ( http://picasaweb.google.com/letshare...50885065119250 )
- Added www-data user.
- /dev/video0 it mean /dev/video number zero not letter o.
Good luck.
Reply With Quote
The Following User Says Thank You to letsharehowto For This Useful Post:
falko (2nd December 2010)
Old 29th January 2011, 18:40
grndamgt4 grndamgt4 is offline
Junior Member
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

hello, this is a pretty awesome install script. If it is not a sticky in the zoneminder wiki already, it should be.

Reply With Quote
Old 1st February 2011, 22:57
u4david u4david is offline
Join Date: Nov 2009
Posts: 99
Thanks: 1
Thanked 0 Times in 0 Posts
Default Zoneminder Ispconfig3

Could anyone help me to install Zone minder on Ispconfig3 Server/system.
(Ubuntu 10.04 LTS)

I would like to make sure zone minder install and configuration wont affect system wide settings and affect Ispconfig3 system in negative way.

Also the web root and database should use parameters that are set up through Ispconfig3.

All mainly for stability and security of already complex system.

In the and i will like to post the images from usb web cam connected to this system on another website also configured on this system.

Probably straight forward for someone with deeper knowledge of permissions and relations in this subject.

Thank you.
Reply With Quote
Old 18th December 2011, 14:01
vinayakbhat82 vinayakbhat82 is offline
Junior Member
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help to access Zoneminder camera


I plan to view the streaming of my laptop webcam on my Android Device. I used Zoneminder to setup my laptop webcam as a Zoneminder Monitor and was able to view it well. I use an app on my Android device that needs a hostname/ip address of camera and port number. I'm unable to get the hostname info from zoneminder. Can I get any help on this?
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 16:44.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.