Tuesday, 22 December 2009

Solving the issue of browser not opening php file (Ubuntu)

Just try the following.....

sudo /etc/init.d/apache2 stop
sudo apt-get remove --purge apache2 php5
sudo apt-get remove --purge libapache2-mod-php5
sudo apt-get install php5 apache2 libapache2-mod-php5
sudo /etc/init.d/apache2 start




Friday, 4 December 2009

Setting up of ACTi ACM 8511P camera in Zoneminder


ACTi Camera Setup 
************************
(You can setup the camera remotely through IP - Just connect as suggested in ACTi manual)
Streaming Method : RTP Over UDP
RTSP Authen Enable: (BLANK)
RTP B2 Frame Enable: (BLANK)
Resolution : 640x480 (Used by my test setup - You can change it)
Frame Rate Mode : Constant
Frame Rate : 12 (Used by my test setup - You can change it)
Encoder Type : MPEG4
Video Bitrate Mode : Constant Bit Rate
Video Maximum Bitrate : Unlimited
Bitrate : 1.2M (Used by my test setup - You can change it)
RTSP Port : 7070
Video Control Port : 6001

Once you are done with the ACTi camera setup now you can open the zoneminder
for streaming the live video to your system.

Just install the zoneminder as detailed below on an Ubuntu PC:
Part - 1
*********
> ACTi work only on Zoneminder 1.24 So we need to use the source files provided
> in the zoneminder website rather then Ubuntu installation

Part - 2
*********
> Download DEB file from
> ftp://ftp.northern-ridge.com.au/zoneminder/1.24/debian/sid/zoneminder_1.24.2-1_i386.deb
> Install it on a Ubuntu PC

Part - 3
*********

ZoneMinder is now in the Debian repositories. There are downloadable .deb
files for Ubuntu for Edgy and Feisty. At this point it is in the
repository for Gutsy. After you install, you will need to do some
additional work, which is documented in the readme file included in the
package.
After installation do the following:

Link Apache
> sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
Restart Apache
> sudo /etc/init.d/apache2 restart

suid zmfix
> sudo chmod 4755 /usr/bin/zmfix

Run zmfix
> zmfix -a

Fix export problem
> sudo chown www-data.www-data /usr/share/zoneminder/temp

edit /etc/sysctl.conf and add the following lines (for 128meg shared mem)(**Maybe of use later**)
> kernel.shmall = 134217728
> kernel.shmmax = 134217728

Download cambozola.jar and put it in /usr/share/zoneminder (**Maybe of use later**)

> You should now be able to access the Zone Minder console through the web
> browser http://localhost/zm

For cambozola i think ***
> Enable in options->Images.
> Set path to ffmpeg in options -> Images /usr/bin/ffmpeg
> test with xawtv (-nodga may be needed)

Once the installation setup is done, open zoneminder in your browser and click on
"Add new monitor" and update the settings as shown below:


Zoneminder Setup
**********************
> General
Source Type: Remote
Function: Monitor
Maximim FPS: 12 (Used by my test setup - You can change it)
Alarm Maximum FPS: 30(Used by my test setup - You can change it)
Reference Image Blend : 7 (Used by my test setup - You can change it)

> Source
Remote Protocol: RTSP
Remote Method: RTP Unicast
Remote Hostname: 192.168.0.101 (Used by my test setup - You can change it)
Remote host port: 7070
Host path: live.sdp
Capture Width: 640 (Used by my test setup - You can change it)
Capture height: 480 (Used by my test setup - You can change it)
Orientation: Normal

Once you are done with the settings just save it and open your new monitor which you have added..... Thatz it.. You shall get the stream video on your remote PC.


For performing the PTZ setup on ACTi, i feel till now there is no direct method provided by the company.... but you can try the following method as a work around for the time being.

Goto "/usr/share/perl/5.10.0/ZoneMinder/Control" on your Ubuntu PC and do a back up of "AxisV2.pm" file.

Once its done just open the file using "sudo gedit AxisV2.pm" and replace the content with the following...

# ==========================================================================
#
# ZoneMinder Axis version 2 API Control Protocol Module, $Date: 2008-07-25 10:48:16 +0100 (Fri, 25 Jul 2008) $, $Revision: 2612 $
# Copyright (C) 2001-2008 Philip Coombes
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ==========================================================================
#
# This module contains the implementation of the Axis V2 API camera control
# protocol
#
package ZoneMinder::Control::AxisV2;

use 5.006;
use strict;
use warnings;

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

our $VERSION = $ZoneMinder::Base::VERSION;

# ==========================================================================
#
# ACTi Control Protocol
#
# ==========================================================================

use ZoneMinder::Debug qw(:all);
use ZoneMinder::Config qw(:all);

use Time::HiRes qw( usleep );

sub new
{
my $class = shift;
my $id = shift;
my $self = ZoneMinder::Control->new( $id );
bless( $self, $class );
srand( time() );
return $self;
}

our $AUTOLOAD;

sub AUTOLOAD
{
my $self = shift;
my $class = ref($self) || croak( "$self not object" );
my $name = $AUTOLOAD;
$name =~ s/.*://;
if ( exists($self->{$name}) )
{
return( $self->{$name} );
}
Fatal( "Can't access $name member of object of class $class" );
}

sub open
{
my $self = shift;

$self->loadMonitor();

use LWP::UserAgent;
$self->{ua} = LWP::UserAgent->new;
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );

$self->{state} = 'open';
}

sub close
{
my $self = shift;
$self->{state} = 'closed';
}

sub printMsg
{
my $self = shift;
my $msg = shift;
my $msg_len = length($msg);

Debug( $msg."[".$msg_len."]" );
}

sub sendCmd
{
my $self = shift;
my $cmd = shift;

my $result = undef;

printMsg( $cmd, "Tx" );

#print( "http://$address/$cmd\n" );
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."$cmd" );
my $res = $self->{ua}->request($req);

if ( $res->is_success )
{
$result = !undef;
}
else
{
Error( "Error check failed: '".$res->status_line()."'" );
}

return( $result );
}

sub cameraReset
{
my $self = shift;
Debug( "Camera Reset" );
my $cmd = "/axis-cgi/admin/restart.cgi";
$self->sendCmd( $cmd );
}

sub moveConUp
{
my $self = shift;
Debug( "Move Up" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UP,3";
$self->sendCmd( $cmd );
}

sub moveConDown
{
my $self = shift;
Debug( "Move Down" );
my $cmd = "cgi-bin/encoder?USER=admin&PWD=123456&MOVE=DOWN,3";
$self->sendCmd( $cmd );
}

sub moveConLeft
{
my $self = shift;
Debug( "Move Left" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=LEFT,3";
$self->sendCmd( $cmd );
}

sub moveConRight
{
my $self = shift;
Debug( "Move Right" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=RIGHT,3";
$self->sendCmd( $cmd );
}

sub moveConUpRight
{
my $self = shift;
Debug( "Move Up/Right" );
my $cmd = "cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UPRIGHT,3, 3";
$self->sendCmd( $cmd );
}

sub moveConUpLeft
{
my $self = shift;
Debug( "Move Up/Left" );
my $cmd = "cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UPLEFT,3,3";
$self->sendCmd( $cmd );
}

sub moveConDownRight
{
my $self = shift;
Debug( "Move Down/Right" );
my $cmd = "cgi-bin/encoder?USER=admin&PWD=123456&MOVE=DOWNRIGHT,3,3";
$self->sendCmd( $cmd );
}

sub moveConDownLeft
{
my $self = shift;
Debug( "Move Down/Left" );
my $cmd = "cgi-bin/encoder?USER=admin&PWD=123456&MOVE=DOWNLEFT,3";
$self->sendCmd( $cmd );
}

sub moveMap
{
my $self = shift;
my $params = shift;
my $xcoord = $self->getParam( $params, 'xcoord' );
my $ycoord = $self->getParam( $params, 'ycoord' );
Debug( "Move Map to $xcoord,$ycoord" );
my $cmd = "/axis-cgi/com/ptz.cgi?center=$xcoord,$ycoord&imagewidth=".$self->{Monitor}->{Width}."&imageheight=".$self->{Monitor}->{Height};
$self->sendCmd( $cmd );
}

sub moveRelUp
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'tiltstep' );
Debug( "Step Up $step" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UP,$step";
$self->sendCmd( $cmd );
}

sub moveRelDown
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'tiltstep' );
Debug( "Step Down $step" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=DOWN,$step";
$self->sendCmd( $cmd );
}

sub moveRelLeft
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'panstep' );
Debug( "Step Left $step" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=left,$step";
$self->sendCmd( $cmd );
}

sub moveRelRight
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'panstep' );
Debug( "Step Right $step" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=RIGHT,$step";
$self->sendCmd( $cmd );
}

sub moveRelUpRight
{
my $self = shift;
my $params = shift;
my $panstep = $self->getParam( $params, 'panstep' );
my $tiltstep = $self->getParam( $params, 'tiltstep' );
Debug( "Step Up/Right $tiltstep/$panstep" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UPRIGHT,$panstep, $tiltstep";
$self->sendCmd( $cmd );
}

sub moveRelUpLeft
{
my $self = shift;
my $params = shift;
my $panstep = $self->getParam( $params, 'panstep' );
my $tiltstep = $self->getParam( $params, 'tiltstep' );
Debug( "Step Up/Left $tiltstep/$panstep" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UPLEFT,$panstep,$tiltstep";
$self->sendCmd( $cmd );
}

sub moveRelDownRight
{
my $self = shift;
my $params = shift;
my $panstep = $self->getParam( $params, 'panstep' );
my $tiltstep = $self->getParam( $params, 'tiltstep' );
Debug( "Step Down/Right $tiltstep/$panstep" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=downright,$panstep,$tiltstep";
$self->sendCmd( $cmd );
}

sub moveRelDownLeft
{
my $self = shift;
my $params = shift;
my $panstep = $self->getParam( $params, 'panstep' );
my $tiltstep = $self->getParam( $params, 'tiltstep' );
Debug( "Step Down/Left $tiltstep/$panstep" );
my $cmd = "/cgi-bin/encoder?USER=admin&PWD=123456&MOVE=UP,$panstep,$tiltstep";
$self->sendCmd( $cmd );
}

sub zoomRelTele
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Zoom Tele" );
my $cmd = "/axis-cgi/com/ptz.cgi?rzoom=$step";
$self->sendCmd( $cmd );
}

sub zoomRelWide
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Zoom Wide" );
my $cmd = "/axis-cgi/com/ptz.cgi?rzoom=-$step";
$self->sendCmd( $cmd );
}

sub focusRelNear
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Focus Near" );
my $cmd = "/axis-cgi/com/ptz.cgi?rfocus=-$step";
$self->sendCmd( $cmd );
}

sub focusRelFar
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Focus Far" );
my $cmd = "/axis-cgi/com/ptz.cgi?rfocus=$step";
$self->sendCmd( $cmd );
}

sub focusAuto
{
my $self = shift;
Debug( "Focus Auto" );
my $cmd = "/axis-cgi/com/ptz.cgi?autofocus=on";
$self->sendCmd( $cmd );
}

sub focusMan
{
my $self = shift;
Debug( "Focus Manual" );
my $cmd = "/axis-cgi/com/ptz.cgi?autofocus=off";
$self->sendCmd( $cmd );
}

sub irisRelOpen
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Iris Open" );
my $cmd = "/axis-cgi/com/ptz.cgi?riris=$step";
$self->sendCmd( $cmd );
}

sub irisRelClose
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Iris Close" );
my $cmd = "/axis-cgi/com/ptz.cgi?riris=-$step";
$self->sendCmd( $cmd );
}

sub irisAuto
{
my $self = shift;
Debug( "Iris Auto" );
my $cmd = "/axis-cgi/com/ptz.cgi?autoiris=on";
$self->sendCmd( $cmd );
}

sub irisMan
{
my $self = shift;
Debug( "Iris Manual" );
my $cmd = "/axis-cgi/com/ptz.cgi?autoiris=off";
$self->sendCmd( $cmd );
}

sub presetClear
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Clear Preset $preset" );
my $cmd = "/axis-cgi/com/ptz.cgi?removeserverpresetno=$preset";
$self->sendCmd( $cmd );
}

sub presetSet
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Set Preset $preset" );
my $cmd = "/axis-cgi/com/ptz.cgi?setserverpresetno=$preset";
$self->sendCmd( $cmd );
}

sub presetGoto
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Goto Preset $preset" );
my $cmd = "/axis-cgi/com/ptz.cgi?gotoserverpresetno=$preset";
$self->sendCmd( $cmd );
}

sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "/axis-cgi/com/ptz.cgi?move=home";
$self->sendCmd( $cmd );
}

1;
__END__
# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

ZoneMinder::Database - Perl extension for blah blah blah

=head1 SYNOPSIS

use ZoneMinder::Database;
blah blah blah

=head1 DESCRIPTION

Stub documentation for ZoneMinder, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.

=head2 EXPORT

None by default.



=head1 SEE ALSO

Mention other useful documentation such as the documentation of
related modules or operating system documentation (such as man pages
in UNIX), or any relevant external documentation such as RFCs or
standards.

If you have a mailing list set up for your module, mention it here.

If you have a web site set up for your module, mention it here.

=head1 AUTHOR

Philip Coombes, Ephilip.coombes@zoneminder.comE

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2001-2008 Philip Coombes

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.3 or,
at your option, any later version of Perl 5 you may have available.


=cut


Once copied save it and open your Options in Zoneminder - Mark and Save the

> OPT_CONTROL Support controllable (e.g. PTZ) cameras


The open your monitor settings again and there you will find a new "Control option" added up.

Just modify the settings as follows:
Controllable > *Mark this field*
Control Type: AXIS API V2
Control Device : * Just keep this blank*
Control Address: 192.168.0.101 (IP of your cam)
Auto Stop Timeout: 10
Track Motion: (feel this doesnt have any significance now)
Track Delay: (5) (feel this doesnt have any significance now)
Return Location: None (feel this doesnt have any significance now)
Return delay: 3 (feel this doesnt have any significance now)

Also just go to the AXIS page by clicking the 'edit' near control type and
> on the pan page just modify the "Max Pan Step" to 5.
> on the tilt page just modify the "Max Tilt Step" to 5.

Thatz it.... Just save and go to your monitor page. On top you'll find a Control option. Click there... You shall find some conrol arrow below with which you can move your PTZ camera !!!!!

********************************************************************************
Just note that this is a quick work around and due to that it doesnt contain any support other than the pan and tilt functionality. Meanwhile i'll try to come up with a script soon so that the camera shall work with its full functionality in a Linux (Zoneminder) environment.
*********************************************************************************