For IP video servers Aviosys IP9100A (B, Plus) Copyright (C) 2006 - Maxim Abakumov
The name of the program: ip9100d2
The Version: 2 beta 1
Four-channel system of video observation
For IP video servers Aviosys IP9100A (B, Plus)
Copyright (C) 2006 - Maxim Abakumov
Program is intended for indemnification of hardware restrictions four-channel IP video servers Aviosys
and realizes following functions:
1. Formation jpeg-files with the image separately for each cam in real time
2. The motion detector separately for each cam
3. A filtration of casual operations on the basis of the factor of time
4. A filtration of casual operations on the basis of samples of photos
5. Association of several events in one on the basis of time factors
6. The notification about movement by e-mail
7. The notification about movement through SMS
8. Conducting a database of events of the detector with classification
9. The control and clearing a hard disk over excess of admissible size of archive
10. Automatic blocking at overflow of disk space
11. Formation of the reduced images for viewing from mobile phones
That new in the given version (2 beta 1):
1. Mistakes in the analyzer of a stream (frequency of 25 staff in a second in an operating mode
with one cam is supported) are corrected.
2. Work of the detector of movement is optimized at great volume of archive of images
(division into folders on days)
3. The filtration of casual operations is entered.
4. Conducting a database of the detector of movement (on the basis of MySQL) is introduced.
5. Association of events is introduced at a small pause
6. The notification about disturbing events through E-Mail and SMS is entered.
7. The mechanism of service of disk space - blocking of a demon is introduced at overflow of a disk,
removal of old events from archive at excess of a limit (leave both files and records in a database)
8. Within the limits of planned creation WEB-interface the demon of formation of the reduced images
for viewing from a mobile phone is entered.
9. The file of a configuration (9100d.ini) is entered. Now all adjustments of the program are carried
out by means of it.
10. The file of a configuration 9100d.ini is dynamically supervised, and, in case of presence of changes
in a file, values of parameters are dynamically updated, not demanding restart of a daemon
(it is valid only for a daemon "9100d2_pub", the others demand restart)
1. A computer (server) Pentium 1 130Mhz, 64Mb or above
2. POSIX UNIX-like operational system (FreeBSD, Linux, etc.) - It was tested on FreeBSD
3. IP video server Aviosys IP9100A (B, Plus)
4. PHP Version 5.1.2 or above (http://www.php.net/)
5. Mysql 4.0 and above (it is recommended 5.0.20 and above) - http://www.mysql.com
6. netpbm-10.26.27 or above (http://netpbm.sourceforge.net/)
7. The library jpeg (http://www.ijg.org/files) On FreeBSD is installed automatically
at installation netpbm from ports
Before the beginning of installation be convinced, that following programs are installed:
1. PHP Version 5.1.2 (support Socket Functions is required. It is necessary to compile with
an option - enable-sockets)
2. Mysql 4.0 and above (it is recommended 5.0.20 and above) - http://www.mysql.com
3. netpbm (http://netpbm.sourceforge.net/) (On Linux and other systems not FreeBSD it is necessary
to be convinced that the library jpeg - http://www.ijg.org/files is installed)
4. For fast work of the application it is required to create a RAM-disk in volume approximately 1,2 Mb
For FreeBSD: Create a folder for assembling a disk (for example "/usr/ram").
Enter: "/sbin/mount_mfs -s 2548 /dev/ad0s1b /usr/ram", where "/dev/ad0s1b" - SWAP-undressed
(look in "/etc/fstab"), "/usr/ram" - a point of assembling of a disk.
For Linux - is probably. Address to documentation for Linux
5. The system of video observation consists of 4 programs:
9100d2_pub - the main daemon
9100_clear_pub - a daemon of clearing of a disk
9100_mail_pub - the program of sending E-Mail and SMS (it is caused from 9100d2_pub)
9100_mob_pub - a daemon of creation of the reduced images
The first line of these files should represent a way to the interpreter php in your system.
For definition of a correct way enter "whereis php" (for example " *!/usr/local/bin/php").
6. Create a folder for executed files and libraries of the program (for example "/usr/local/motion")
Copy the specified files, and also the starting script "motion.sh" in a folder and give
it the rights to execution (chmod 755 9100d2_pub 9100_clear_pub 9100_mail_pub 9100_mob_pub motion.sh).
Copy in a folder of the program following libraries:
7. 9100d.ini is a basic file of a configuration of the program. Copy a file 9100d.ini_ru or 9100d.ini_en,
depending on the preferred language version, in a folder/etc your system, having renamed thus
Bring in a file "/etc/9100d.ini" following changes:
a) to Parameter "server" appropriate the ip-address of yours IP video of a server (IP9100A/B/Plus)
b) to Parameter "path_img" appropriate a way to a RAM-disk ("/usr/ram")
c) to Parameter "path_work" appropriate a way to executed files of the program
d) Create a folder where it is necessary to put sequences of pictures in case of detection of motion.
Create in it 4 folders corresponding 4-th cam. Names of folders should come to an end with number of
the cam (for example detect1, detect2, etc.)
To Parameter "motionpath1" appropriate a way to a folder (for example "/www/motion/ ")
To Parameter "motionpath2" appropriate a prefix (a name of one of four folders without last figure -
for example, if at you four folders: "/www/motion/detect1 ","/www/motion/detect2 ", etc.
appropriate to parameter value "detect"
e) to Parameter "pnmpsnr" appropriate a way to the utility pnmpsnr (enters into a package netpbm,
f) to Parameter "djpeg" appropriate a way to the utility djpeg (enters into a package netpbm)
g) to Parameter "cjpeg" appropriate a way to the utility cjpeg (enters into a package netpbm)
h) If on your server (IP9100A/B/Plus) authorization by name and to the password it is necessary
to establish values of parameters "cfgUser" and "cfgPasswd" is established.
Initialization of database MySQL:
Create a database for the detector of movement (for example "house"):
mysqladmin create house
Create the table "ohrana" by means of the script "sql.txt":
mysql -u root house < sql.txt
Specify parameters of a database in a file of a configuration (9100d.ini, section [DB])
Adjust parameters of the notification on e-mail and SMS:
To Parameter "email" appropriate the address on which disturbing notifications will be sent.
To parameter "email_mobile" appropriate e-mail address corresponding your mobile phone
(specify in the company giving to you mobile communication)
For correct work of the module of creation of reduced images for a mobile phone specify parameter "scale"
in section [Mob]. It should specify a way to the utility "pnmscalefixed", entering in the
complete set "netpbm";
8. Adjust your video server (IP9100A/B/Plus): establish mode RoundRobin, choose used channels
(preferably all 4), choose the resolution of a picture (preferably 704x576).
9. Daemons 9100d2_pub 9100_clear_pub and 9100_mob_pub should work in a background mode. Thus the main
daemon (9100d2_pub) is recommended to establish the raised priority, and additional
(9100_clear_pub, 9100_mob_pub) - lowered. It is realized in the script of start of a demon motion.sh.
Make following changes to a file motion.sh:
Instead of/usr/local/motion/... Specify a way to the program
Specify an arrangement of interpreter PHP (by default "/usr/local/bin/php")
Specify an arrangement of the program for the task of a priority "nice" (by default "/usr/bin/nice")
With the given adjustments the program will work in a mode of the superuser (root).
In case of use of the program in a mode of the limited user it is necessary to establish the rights to
reading and record in used folders for the given user
For start of system start a script motion.sh (/usr/local/motion/motion.sh)
The Expanded management
Access to system through WEB (HTTP).
At the moment in the official version of system access through HTTP is realized only partially.
The high-grade WEB-interface is planned to add in the following version of the program.
For access through WEB you should establish server Apache (http: // apache.org).
Means of a WEB-server you can establish access to following folders:
1) To Folder specified in parameter "path_img"
2) To Folder, specified in parameter "motionpath1"
The Section [WWW] a file of a configuration is responsible for a correctness of the instruction
of addresses of access to figures, from dispatch E-Mail and SMS.
For viewing the image of cam from WEB it is possible to use files "cam[N].jpg" in a folder
"path_img", where N - number of the cam.
For access to images of cam from a mobile phone supporting HTTP, you can use files
"cams[N].jpg" in a folder "path_img", where N - number of the cam.
Adjustment of the module of clearing of a disk
Set in parameter "perc_need" a file of a configuration quantity of percent of free space
of section of a disk on which there is a folder set in parameter "motionpath1".
By default the system is adjusted for work at a maximum of disk space of 3%.
If for work of other programs required a lot of free space in this section it is necessary to
specify other value.
Protection against casual operations and association of events
For protection against casual operations and associations of several events in one,
it is possible to use parameters "motiontime" and "motionpause".
The parameter "motiontime" defines minimal time of event. If time of event (time between the first and
last staff of event) smaller, than is specified in parameter event at addition in a database is
marked as casual (in a database to a field "categ" appropriated value 2) and the notification
on e-mail and SMS is not made, though images are kept. The greater value is established for this parameter,
the greater should be duration of event for detection by its detector and sendings of the notification.
The parameter "motionpause" defines maximal time of a pause between the staff at which the following
found out movement is classified as continuation previous. The more value of this parameter,
the will be records in a database and the more so notifications on e-mail and SMS will be selective less
The structure of a database of system
The Database of the project contains one table in which data on the fixed movement are located.
Thus, names of the files concerning event, are united in one line (a field "body").
As a divider the " ". For reception of the list of files it is possible to use such design on PHP:
$l=explode (" ", $l);
To Event the category (a field "categ") is appropriated. The category "1" means the basic event,
a category "2" - casual event. At clearing a disk by the module of clearing casual events leave first
To a field "source" number of the cam (1 - 4) is appropriated.
In a floor "size" the total volume of all files of the images concerning this event is underlined.
In a floor "filldate" the date started of event is underlined.
In a floor "filldateend" the date closed of event is underlined.
Support of databases
Is at the moment supported only system MySQL. At desire you can enter support of other systems by
replacement of library "db.inc" on the version, with preservation of names and parameters of functions.
System of clearing of a disk
At clearing a disk by the module of clearing leave as also records in a database.
Algorithm of clearing such. The oldest casual events first leave. If the disk space was not released,
and casual events are completely settled, the system starts to delete the oldest basic events.
Removal of events stops when the free space becomes on 2% more, than is specified in parameter
"perc_need" a file of a configuration. That is, if the parameter is equal 3 clearing will begin
at achievement in volume of free space of value of 3% from total amount of a disk (and less),
and will proceed until the free space will not be released up to 5%. The given mechanism is
necessary that the server was not engaged in clearing of a disk continuously, that can negatively
affect the general productivity.
Time of carrying out of clearing and loading for a server, and also
accuracy of work of the mechanism of clearing are adjusted by parameters "cleartimer", "deltimer1" and
"deltimer2." "cleartimer" defines a pause in minutes between attempts of system of clearing to define
volume of free space in section. "deltimer1" defines a pause between inquiries about removal of
casual events. Between inquiries the volume of free space also is supervised. "deltimer2" defines a
pause between inquiries at removal of the basic events. Considering that data on volume of disk
space is frequent are located in a cache operational system, it is not necessary to appropriate
to this parameter too small values. It can lead to removal of excessively plenty of records.
The filter of casual events on the basis of samples of noise
For work of the filter of casual events it is necessary in a folder specified in parameter "motionpath1",
to create the enclosed folder "noise". In this folder it is necessary to put the pictures received
from any 4 cams, containing casual events at which the detector to work should not.
The system before to generate the notification, will check up event on concurrence to samples of noise.
If event coincides with any sample of noise disturbing e-mail and SMS the message will not be generated.
However data in any case are brought in a database, and images in any case are kept by system.
All programs of a package give out messages in standard streams of a conclusion.
By default a log-files are created in a folder "/var/log" as it is specified in a script "motion.sh"
/var/log/9100_d.log - the basic log
/var/log/9100_clear.log - a log of clearing
/var/log/9100_mob.log - a log of system of mobile images
[path_work]/mail.log - a log of sending of notifications
Since version 2 all the basic comments in an initial code of the program are made in Russian.
All the messages which are given out in standard streams, are made in English. The documentation
contains in two variants:
1) in Russian
2) translation into English
language Comments in configuration files too in two languages
Planned completions in following versions:
1. The WEB-interface for supervision over events with an opportunity of viewing of separate images
and videoclips and also classification of events on cams, dates and categories (the prototype
is already created and it is maintained by the author)
2. Management of system (inclusion and deenergizing of the notification) by means of SMS
(the prototype is already maintained by the author)
3. The notification about disturbing events by means of a mobile phone connected to a server
(the help is required)
The Given project has been created in the personal purposes of the author, and I did not aspire
to make process of installation and adjustment of system by a lung.
However, if other developers will wish to simplify this process, the author will be grateful to them.
The author will be grateful to users for the found mistakes, and also to other developers for
Yours faithfully, Maxim Abakumov
P. S. The initial idea of the program is borrowed from Scan Daemon (Mike Johnson, Copyright (C) 2005,
www.mycal.net). At the moment the author keeps only separate fragments of a code of the basic algorithm
of this project.