View Single Post
  #1  
Old 24th November 2010, 07: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:

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

Code:
su
Update box:

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

Code:
reboot
2/-Install zoneminder:

Open Terminal, logon with root:

Code:
su
Make Pada scrip:

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

Quote:
#!/bin/sh
# 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
fi

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)
mb=1048576
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"
else
echo "-- Recommended: kernel.shmmax = $shmmax B = $shmmax_mb MB"
echo "-- Recommended: kernel.shmmall = $shmall pages"
file=/etc/sysctl.conf
if [ "`grep "^kernel\.shmmax" $file -c`" != "0" ]; then
echo "-- Replacing: kernel.shmmax in $file"
sed "s/^kernel\.shmmax.*$/kernel.shmmax=$shmmax/g" -i $file
else
echo "-- Adding: kernel.shmmax to $file"
echo kernel.shmmax=$shmmax >> $file
fi
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
else
echo "-- Adding: kernel.shmall to $file"
echo kernel.shmall=$shmall >> $file
fi
echo "-- Using: new sysctl values"
sysctl -p
fi

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

Code:
chmod 744 pada.sh
Install Zoneminder:

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

Add www-data user:

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

Code:
reboot
Open terminal. Make sure webcam works:

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

Quote:
/dev/video0
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:

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

Quote:
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:

http://picasaweb.google.com/letshare...50949802852738

http://picasaweb.google.com/letshare...50958268048658

http://picasaweb.google.com/letshare...50972129210642

http://picasaweb.google.com/letshare...50988533725458

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

http://picasaweb.google.com/letshare...51003879517010

http://picasaweb.google.com/letshare...51015986206882

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

http://picasaweb.google.com/letshare...51036850803074

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

http://picasaweb.google.com/letshare...86829313433090

http://picasaweb.google.com/letshare...86842357947010

http://picasaweb.google.com/letshare...86853025263010

http://picasaweb.google.com/letshare...86861396817938

http://picasaweb.google.com/letshare...86870392879858

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

Thanks:

http://www.zoneminder.com
http://www.ubuntu.com
Chris "Pada" Kistner
http://blog.mysqltuner.com
http://www.howtoforge.com

Note:

- 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, 654 views)
Reply With Quote
Sponsored Links