Aviosys IP Kamera 9060
Aviosys IP Kamera 9060
i bought a few of these kits as i was so impressed with the camera and general function and the price having come right down to about 40 pounds for the kit form..!!. I have made a slighty modification to the original script .. (I'm a perl novice)..! I've just added a rename so that the file generated isn't picked up too early ..!
#!/usr/bin/perl
use IO::Socket;
my $iphost="192.168.11.29:80";
my $frame_count=25;
my $image_filename="ip_Kamera_9060_1";
my $no_print_data;
my $target_path='/cgi-bin/Stream?Video';
my $debug=0;
sub main {
my ($heraddr);
RECONNECT:
$t=0;
print STDERR "connecting to $iphost\n";
do {
$F = IO::Socket::INET->new(
PeerAddr => $iphost,
Proto => "tcp",
Type => SOCK_STREAM,
Timeout => 10) ;
$t++;
die ("Socket fail : $!") if $t > 10;
} while( $F == undef );
print STDERR "Connnected\n";
$qu = "GET $target_path HTTP/1.0\r\n" .
"Accept: */*\r\n" .
"Keep-Alive: 300\r\n" .
"Connection: keep-alive\r\n" .
"Cookie: webcamPWD=RootCookie00000\r\n" .
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" .
"\r\n";
print $F $qu;
#print $D $qu;
while ($j = read($F, $data, 20) ) {
#print " j = $j\n";
@a = unpack('v10', $data);
if ($debug) {
for $i ( 0 .. $#a ) {
#print $D "$i = $a[$i]\n";
print "$i = $a[$i]\n";
}
}
# make sure er got pre-image header.
unless ($a[0] == 10794 && $a[3] && $a[4] && $a[5]) {
close($F);
print STDERR "bad header image $image_filenam\n";
goto RECONNECT ;
}
$j = read($F, $data, $a[1]) or die ("bad read: $!");
open(J, ">$image_filename.JPG");
print J $data;
close(J);
# $image_filename++;
rename("ip_Kamera_9060_1.JPG", "front_camera_1.jpg");
#last unless --$frame_count;
}
}
&main;
exit;
#!/usr/bin/perl
use IO::Socket;
my $iphost="192.168.11.29:80";
my $frame_count=25;
my $image_filename="ip_Kamera_9060_1";
my $no_print_data;
my $target_path='/cgi-bin/Stream?Video';
my $debug=0;
sub main {
my ($heraddr);
RECONNECT:
$t=0;
print STDERR "connecting to $iphost\n";
do {
$F = IO::Socket::INET->new(
PeerAddr => $iphost,
Proto => "tcp",
Type => SOCK_STREAM,
Timeout => 10) ;
$t++;
die ("Socket fail : $!") if $t > 10;
} while( $F == undef );
print STDERR "Connnected\n";
$qu = "GET $target_path HTTP/1.0\r\n" .
"Accept: */*\r\n" .
"Keep-Alive: 300\r\n" .
"Connection: keep-alive\r\n" .
"Cookie: webcamPWD=RootCookie00000\r\n" .
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" .
"\r\n";
print $F $qu;
#print $D $qu;
while ($j = read($F, $data, 20) ) {
#print " j = $j\n";
@a = unpack('v10', $data);
if ($debug) {
for $i ( 0 .. $#a ) {
#print $D "$i = $a[$i]\n";
print "$i = $a[$i]\n";
}
}
# make sure er got pre-image header.
unless ($a[0] == 10794 && $a[3] && $a[4] && $a[5]) {
close($F);
print STDERR "bad header image $image_filenam\n";
goto RECONNECT ;
}
$j = read($F, $data, $a[1]) or die ("bad read: $!");
open(J, ">$image_filename.JPG");
print J $data;
close(J);
# $image_filename++;
rename("ip_Kamera_9060_1.JPG", "front_camera_1.jpg");
#last unless --$frame_count;
}
}
&main;
exit;
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Yes that's right the kit is basically a pcb with an ethernet and power connector, a ribbon cable and a camera on a seperate pcb connected via the ribbon cable.
here are details of where I bought it
http://www.digidave.co.uk/product_info. ... cts_id=231
regards
Surj
here are details of where I bought it
http://www.digidave.co.uk/product_info. ... cts_id=231
regards
Surj
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
-
- Posts: 74
- Joined: Wed Feb 25, 2004 5:06 pm
Re: Aviosys IP Kamera 9060
To be fair for the price they're not bad, but no way can they be considered low-light cameras (as it says on the various sellers' sites). I have a street light directly in front of my house and that doesn't give sufficient light for one of the cameras when it's in my bedroom window. My 'real' cameras (a 'mini' camera' and a bullet camera) can both see without a problem.bainssu wrote:i bought a few of these kits as i was so impressed with the camera and general function and the price having come right down to about 40 pounds for the kit form..!!.
Similarly the picture's very low quality with numerous odd shades of red and green - a symptom of it being a CMOS lens rather than a CCD.
None the less, the fact that the camera can be tucked away discreetly somewhere makes them interesting
Re: Aviosys IP Kamera 9060
Instead of getting single frames from Aviosys camera, is it possible to get directly the video streaming ... ?bainssu wrote:I have made a slighty modification to the original script .. (I'm a perl novice)..! I've just added a rename so that the file generated isn't picked up too early ..!
Is this less CPU intensive for the ZM Server?
9060 streaming video
I think you can get a stream of jpegs in the mjpeg format.
Here is a script I found on the net for doing just that..
usage perl ip_video.pl >out.mjpeg. I haven't got zoneminder to pick this up yet... however videolan works fine...
#!/usr/bin/perl
use IO::Socket;
my $iphost="192.168.11.29:80";
my $no_print_data;
my $target_path='/cgi-bin/Stream?Video webcamPWD=RootCookie00000';
my $debug=0;
sub main {
my ($heraddr);
open(STDERR, ">/tmp/debug_stderr"); #unless -t;
# $no_print_data++ if -t;
select((select(STDOUT), $| = 1)[0]);
select((select(STDERR), $| = 1)[0]);
#open($D, ">dat_dump");
#select((select($D), $| = 1)[0]);
#$hersockaddr = getpeername(S);
#(undef, undef, $heraddr) = unpack($sockaddr, $hersockaddr);
#$t=<STDIN>;
$t="GET / HTTP/1.0"; # temp hack
if ( $t =~ /^GET/ ) {
$qu = "HTTP/1.0 200 OK\r\n".
"Server: Perl Hack\r\n".
"Content-Type: multipart/x-mixed-replace;boundary=IPCamBoundary\r\n".
"Pragma: no-cache\r\n".
"Cache-Control: no-cache\r\n".
"Expires: 01 Jan 1970 00:00:00 GMT\r\n".
"\r\n";
print $qu;
} else {
print "HTTP/1.0 404 File Not Found\r\n\r\n";
exit;
}
RECONNECT:
$t=0;
do {
$F = IO::Socket::INET->new(
PeerAddr => $iphost,
Proto => "tcp",
Type => SOCK_STREAM,
Timeout => 10) ;
$t++;
die ("Socket fail : $!") if $t > 10;
} while( $F == undef );
$qu = "GET $target_path HTTP/1.0\r\n" .
"Accept: */*\r\n" .
"Keep-Alive: 300\r\n" .
"Connection: keep-alive\r\n" .
"Cookie: webcamPWD=RootCookie00000\r\n" .
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" .
"\r\n";
print $F $qu;
#print $D $qu;
$t=0;
while ($j = read($F, $data, 20) ) {
#print " j = $j\n";
@a = unpack('v10', $data);
if ($debug) {
for $i ( 0 .. $#a ) {
#print $D "$i = $a[$i]\n";
print "$i = $a[$i]\n";
}
}
unless ($a[0] == 10794 && $a[3] && $a[4] && $a[5]) {
close($F);
print STDERR "bad header image $t\n";
goto RECONNECT ;
}
print STDERR "Size=$a[1]\tWidth=$a[3]\tHeight=$a[4],Compress=$a[5]\n";
$j = read($F, $data, $a[1]) or die ("bad read: $!");
print STDERR "read $j\n";
print "--IPCamBoundary\r\n",
"ETag: image_$t\r\n",
"Content-Type: image/jpeg\r\n",
"Content-Length: $a[$i]\r\n",
"\r\n";
$t++;
print $data or print STDERR " print error: $!\n";
print "--IPCamBoundary\r\n",
"ETag: image_$t\r\n",
"Content-Type: image/jpeg\r\n",
"Content-Length: $a[$i]\r\n",
"\r\n";
print $data or print STDERR " print error: $!\n";
$#a=-1;
last if $t > 100;
}
if ($t < 1 ) {
warn("Huh j= $j: $!\n");
sleep 1;
goto RECONNECT ;
}
print STDERR "t: $t\t", $t / (time - $^T) , "\n";
}
&main;
exit;
Here is a script I found on the net for doing just that..
usage perl ip_video.pl >out.mjpeg. I haven't got zoneminder to pick this up yet... however videolan works fine...
#!/usr/bin/perl
use IO::Socket;
my $iphost="192.168.11.29:80";
my $no_print_data;
my $target_path='/cgi-bin/Stream?Video webcamPWD=RootCookie00000';
my $debug=0;
sub main {
my ($heraddr);
open(STDERR, ">/tmp/debug_stderr"); #unless -t;
# $no_print_data++ if -t;
select((select(STDOUT), $| = 1)[0]);
select((select(STDERR), $| = 1)[0]);
#open($D, ">dat_dump");
#select((select($D), $| = 1)[0]);
#$hersockaddr = getpeername(S);
#(undef, undef, $heraddr) = unpack($sockaddr, $hersockaddr);
#$t=<STDIN>;
$t="GET / HTTP/1.0"; # temp hack
if ( $t =~ /^GET/ ) {
$qu = "HTTP/1.0 200 OK\r\n".
"Server: Perl Hack\r\n".
"Content-Type: multipart/x-mixed-replace;boundary=IPCamBoundary\r\n".
"Pragma: no-cache\r\n".
"Cache-Control: no-cache\r\n".
"Expires: 01 Jan 1970 00:00:00 GMT\r\n".
"\r\n";
print $qu;
} else {
print "HTTP/1.0 404 File Not Found\r\n\r\n";
exit;
}
RECONNECT:
$t=0;
do {
$F = IO::Socket::INET->new(
PeerAddr => $iphost,
Proto => "tcp",
Type => SOCK_STREAM,
Timeout => 10) ;
$t++;
die ("Socket fail : $!") if $t > 10;
} while( $F == undef );
$qu = "GET $target_path HTTP/1.0\r\n" .
"Accept: */*\r\n" .
"Keep-Alive: 300\r\n" .
"Connection: keep-alive\r\n" .
"Cookie: webcamPWD=RootCookie00000\r\n" .
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" .
"\r\n";
print $F $qu;
#print $D $qu;
$t=0;
while ($j = read($F, $data, 20) ) {
#print " j = $j\n";
@a = unpack('v10', $data);
if ($debug) {
for $i ( 0 .. $#a ) {
#print $D "$i = $a[$i]\n";
print "$i = $a[$i]\n";
}
}
unless ($a[0] == 10794 && $a[3] && $a[4] && $a[5]) {
close($F);
print STDERR "bad header image $t\n";
goto RECONNECT ;
}
print STDERR "Size=$a[1]\tWidth=$a[3]\tHeight=$a[4],Compress=$a[5]\n";
$j = read($F, $data, $a[1]) or die ("bad read: $!");
print STDERR "read $j\n";
print "--IPCamBoundary\r\n",
"ETag: image_$t\r\n",
"Content-Type: image/jpeg\r\n",
"Content-Length: $a[$i]\r\n",
"\r\n";
$t++;
print $data or print STDERR " print error: $!\n";
print "--IPCamBoundary\r\n",
"ETag: image_$t\r\n",
"Content-Type: image/jpeg\r\n",
"Content-Length: $a[$i]\r\n",
"\r\n";
print $data or print STDERR " print error: $!\n";
$#a=-1;
last if $t > 100;
}
if ($t < 1 ) {
warn("Huh j= $j: $!\n");
sleep 1;
goto RECONNECT ;
}
print STDERR "t: $t\t", $t / (time - $^T) , "\n";
}
&main;
exit;
Re: 9060 streaming video
Thank You!
this get the stream ... but how to use it with ZoneMinder?
have you tried also to get the audio channel and put all togheter in an MJPEG Stream?
this get the stream ... but how to use it with ZoneMinder?
have you tried also to get the audio channel and put all togheter in an MJPEG Stream?
bainssu wrote:I think you can get a stream of jpegs in the mjpeg format.
Here is a script I found on the net for doing just that..
Code: Select all
usage perl ip_video.pl >out.mjpeg. I haven't got zoneminder to pick this up yet... however videolan works fine...
Code: Select all
#!/usr/bin/perl use IO::Socket; my $iphost="192.168.11.29:80"; my $no_print_data; my $target_path='/cgi-bin/Stream?Video webcamPWD=RootCookie00000'; my $debug=0; sub main { my ($heraddr); open(STDERR, ">/tmp/debug_stderr"); #unless -t; # $no_print_data++ if -t; select((select(STDOUT), $| = 1)[0]); select((select(STDERR), $| = 1)[0]); #open($D, ">dat_dump"); #select((select($D), $| = 1)[0]); #$hersockaddr = getpeername(S); #(undef, undef, $heraddr) = unpack($sockaddr, $hersockaddr); #$t=<STDIN>; $t="GET / HTTP/1.0"; # temp hack if ( $t =~ /^GET/ ) { $qu = "HTTP/1.0 200 OK\r\n". "Server: Perl Hack\r\n". "Content-Type: multipart/x-mixed-replace;boundary=IPCamBoundary\r\n". "Pragma: no-cache\r\n". "Cache-Control: no-cache\r\n". "Expires: 01 Jan 1970 00:00:00 GMT\r\n". "\r\n"; print $qu; } else { print "HTTP/1.0 404 File Not Found\r\n\r\n"; exit; } RECONNECT: $t=0; do { $F = IO::Socket::INET->new( PeerAddr => $iphost, Proto => "tcp", Type => SOCK_STREAM, Timeout => 10) ; $t++; die ("Socket fail : $!") if $t > 10; } while( $F == undef ); $qu = "GET $target_path HTTP/1.0\r\n" . "Accept: */*\r\n" . "Keep-Alive: 300\r\n" . "Connection: keep-alive\r\n" . "Cookie: webcamPWD=RootCookie00000\r\n" . "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" . "\r\n"; print $F $qu; #print $D $qu; $t=0; while ($j = read($F, $data, 20) ) { #print " j = $j\n"; @a = unpack('v10', $data); if ($debug) { for $i ( 0 .. $#a ) { #print $D "$i = $a[$i]\n"; print "$i = $a[$i]\n"; } } unless ($a[0] == 10794 && $a[3] && $a[4] && $a[5]) { close($F); print STDERR "bad header image $t\n"; goto RECONNECT ; } print STDERR "Size=$a[1]\tWidth=$a[3]\tHeight=$a[4],Compress=$a[5]\n"; $j = read($F, $data, $a[1]) or die ("bad read: $!"); print STDERR "read $j\n"; print "--IPCamBoundary\r\n", "ETag: image_$t\r\n", "Content-Type: image/jpeg\r\n", "Content-Length: $a[$i]\r\n", "\r\n"; $t++; print $data or print STDERR " print error: $!\n"; print "--IPCamBoundary\r\n", "ETag: image_$t\r\n", "Content-Type: image/jpeg\r\n", "Content-Length: $a[$i]\r\n", "\r\n"; print $data or print STDERR " print error: $!\n"; $#a=-1; last if $t > 100; } if ($t < 1 ) { warn("Huh j= $j: $!\n"); sleep 1; goto RECONNECT ; } print STDERR "t: $t\t", $t / (time - $^T) , "\n"; } &main; exit;
9060 streaming video
I'm not sure how to actually use it with zm. They only way I've been able to use the 9060 cameras is by creating an image file on the webserver(previous perl script) and then specificying it as a local file src in the zm config. This works ok for a while but every now and then fails and stops working which isn't great.. how do you currently run it..?
regards
Surj
regards
Surj
IP_9060 additional tweaks.. and fixes
I've added a script to restart the perl scripts that I was using to feed zm and some modifications to the perl script it self to allow it to work...
stick this file in /etc/cron/hourly
and modify the line near the bottom which points to the perl script (in my case it is in /srv/www/htdocs/)
and this one in your document root (in my case it is in /srv/www/htdocs/)
again modifying to point to the right locations and ip
stick this file in /etc/cron/hourly
and modify the line near the bottom which points to the perl script (in my case it is in /srv/www/htdocs/)
Code: Select all
#!/bin/bash
##############################################################################
# restart_ip_Kamera.sh
#
# This is a script to restart ip_Kamera.
# This can be called from another script which could be monitoring logs or
# detecting bad frames etc............
function kill_Kamera {
for pid in `ps -ef | grep Kamera_hack.pl | grep -v grep | awk '{print $2}'`
do
kill $1 $pid
done
}
printf "Performing hard kill on Kamera processes\n"
timestamp=`date`
echo "$timestamp Restarted ip_Kamera" >> /tmp/KameraRestarter.log
kill_Kamera -9
sleep 5
nohup perl /srv/www/htdocs/ip_Kamera_hack.pl &
ps -ef | egrep perl
exit 0
and this one in your document root (in my case it is in /srv/www/htdocs/)
again modifying to point to the right locations and ip
Code: Select all
#!/usr/bin/perl
use IO::Socket;
my $iphost="192.168.11.29:80";
my $frame_count=25;
my $image_filename="/srv/www/htdocs/ip_Kamera_9060_1";
my $no_print_data;
my $target_path='/cgi-bin/Stream?Video';
my $debug=0;
sub main {
my ($heraddr);
RECONNECT:
$t=0;
print STDERR "connecting to $iphost\n";
do {
$F = IO::Socket::INET->new(
PeerAddr => $iphost,
Proto => "tcp",
Type => SOCK_STREAM,
Timeout => 10) ;
$t++;
die ("Socket fail : $!") if $t > 10;
} while( $F == undef );
print STDERR "Connnected\n";
$qu = "GET $target_path HTTP/1.0\r\n" .
"Accept: */*\r\n" .
"Keep-Alive: 300\r\n" .
"Connection: keep-alive\r\n" .
"Cookie: webcamPWD=RootCookie00000\r\n" .
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" .
"\r\n";
print $F $qu;
#print $D $qu;
while ($j = read($F, $data, 20) ) {
#print " j = $j\n";
@a = unpack('v10', $data);
if ($debug) {
for $i ( 0 .. $#a ) {
#print $D "$i = $a[$i]\n";
print "$i = $a[$i]\n";
}
}
# make sure er got pre-image header.
unless ($a[0] == 10794 && $a[3] && $a[4] && $a[5]) {
close($F);
print STDERR "bad header image $image_filenam\n";
sleep (10);
system("nohup ./restart_ip_kamera.sh &");
}
$j = read($F, $data, $a[1]) or die ("bad read: $!");
open(J, ">$image_filename.JPG");
print J $data;
close(J);
sleep(0.25);
rename("/srv/www/htdocs/ip_Kamera_9060_1.JPG", "/srv/www/htdocs/front_camera_1.jpg");
}
}
&main;
exit;