Axis, IP Kamera Teknik Not Unix

 



 

   

 

 

Teknik Not: UNIX

 

Yüksek sayıda erişim olan kameradan canlı video


Burada verilen bilgiler aşağıdaki ürünle ve sürümler için geçerlidir:

  • Axis AXIS 2100/2120/2400/2401/2420 donanım yazılımları (F/W) sürüm 2.12 ve üstü, AXIS 2400+/2401+ donanım yazılımları (F/W) sürüm 3.01 ve üstü.

Özet
Bu sayfada Axis network video ürününden gelen canlı görüntülerin ara bir FTP sunucu kullanarak  UNIX tabanlı Web sunucuya nasıl aktarılacağına ilişkin bilgiler verilmektedir.

Açıklamalar
Akvaryum balığı örneği ele alınmaktadır. Eğer çok sayıda erişim var ise kameraya doğrudan erişimi sınırlamanız gerekir. Aksi taktirde fazla sayıdaki kullanıcının oluşturacağı trafik kameranın performansını etkileyecektir. Bu amaçla kamera görüntüleri yüksek performanslı bir web sunucu tarafından erişime açılır. Axis network video ürünlerinde tampon sunucuya görüntüleri otomatik olarak yükleme özelliği vardır.
Yüksek hızlı bir Internet bağlantısı olduğunda 10'dan fazla eş zamanlı kullanıcı için tampon bir web sunucu kurmak doğru olacaktır..

Genel sistem tanımı
Axis network video ürününü görüntüleri sıralı olarak FTP sunucuya gönderecek şekilde tanımlayınız.Web sunucu (genellikle FTP sunucu ile aynı bilgisayardır) bu görüntüleri kullanarak kullanıcıların web sayfalarından erişebileceği canlı görüntüleri oluşturacaktır.

Ara bir Unix Web sunucusu kurmak 

  1. Uygulamanın kaydedileceği bir katalog yaratınız
  2. Axis viewing ActiveX yazılım bileşenini bu kataloğa kopyalayıp, dosya adını AxisCamControl.ocx  oalrak değiştiriniz.
  3. Gelen görüntülerden görüntü dizinleri yaratacak "CGI image push script" 'i yaratınız.
    Aşağıdaki parametreleri girmeniz gerekir:
    $DIR - AXIS 2100'ün görüntüleri aktardığı katalog adı.
    $fileName - Görüntülerin kaydedildiği dosya adı.
  4. Aşağıdaki  HTML kodunu içeren bir web sayfası yaratınız.  BaseUrl ve OcxFile değişikliklerini yapınız.

Örnek
Perl script:

#!/usr/bin/perl
#
#
require 'stat.pl';
#########################################################
# Path to where the image file is stored
$DIR = "/cam/root/";
#Filename the image is stored as
$fileName = "fish.jpg";
#Maximum of images/s sent
$freq = 3;
#Max number of images to send on a connection
$maxImages = 900;
#Max number of seconds until update is considered stopped
#(ie the camera is no longer updating the image)
$maxNoUpdate = 30;
#########################################################
$con_type = "jpeg";
# Unbuffer the output so it streams through faster and better.
$| = 1;
# No input record separator when reading from file via <>.
undef $/;
# Print HTTP headers...
# NOTE: If your web server returns "Error, faulty header"
# The Line below must be commented away since your web server includes the
# HTTP/1.0 200 OK on its own.
print "HTTP/1.0 200 OK\n";
print "Content-type: multipart/x-mixed-replace; boundary=--myboundary\n\n";
print "--myboundary\n";
$rounds=0;
#max 400 images
while ($rounds < $maxImages)
{
$rounds = $rounds +1;
$basefile = $DIR . $fileName;
@fstat = stat($basefile);
# If the same image time stamp is on the image file for more then
# X seconds then I presume that the image is no longer updated and will
# End the connection
if ($fstat[$ST_MTIME] ne $oldimagetime)
{
$sameCount = 0;
$oldimagetime = $fstat[$ST_MTIME];
}
#We may send the same image multiple times but there is a strict limit
if ($sameCount > ($maxNoUpdate * $freq))
{
die;
}
$sameCount = $sameCount +1;
$rounds=$rounds +1;
print "Content-type: image/$con_type\n\n";
# This is where we act
open(PIC,"$basefile");
print STDOUT <PIC>;
close(PIC);
print "\n\n--myboundary\n";
# Pause for 1/$freq seconds, if this time is more then a second
# we recomend you replace with sleep(NbrOfSeconds)
select(undef,undef,undef,(1/$freq));
}

HTML dosya:

<html>
<head>
<title>MJPG Live Demo</title>
</head>
<body>
<center>
<h2>Motion JPEG image on a UNIX web server via an intermediate FTP server</h2>
<!-- Cut from here to the end of image display comment -->
<!-- Note: If you do not see a JavaScript below in the view source window you must -->
<!-- first save the html file from your browser, then open the saved -->
<!-- file in a text editor, for instance Notepad.-->
<SCRIPT LANGUAGE="JavaScript">
// Set the BaseURL to the url of your Web server
// Example: var BaseURL = "http://www.axis.com/";
var BaseURL = "http://[WebServer]/";

// DisplayWidth & DisplayHeight specifies the displayed width & height of the image.
// The values depend on what Network Camera and resolution are used.
// Select the Network Camera and resolution by removing the "//" at  the beginning 
// of the applicable line.
// Note that only one can be enabled.

// AXIS 2100
// var DisplayWidth = "320";var DisplayHeight = "240";// Resolution 320x240:
// var DisplayWidth = "640";var DisplayHeight = "480";// Resolution 640x480:

// AXIS 2120/2400/2400+/2401/2401+/2420 PAL
// var DisplayWidth = "352";var DisplayHeight = "288";// Resolution 352x288:
// var DisplayWidth = "704";var DisplayHeight = "576";// Resolution 704x576:

// AXIS 2120/2400/2400+/2401/2401+/2420 NTSC
// var DisplayWidth = "352";var DisplayHeight = "240";// Resolution 352x240:
// var DisplayWidth = "704";var DisplayHeight = "480";// Resolution 704x480:

// This is the filepath to the Perl script
// Example: var File = "nph-update.cgi";
var File = "nph-update.cgi";
// This is the filepath to the ActiveX ocx needed by Internet Explorer
// note the version number that is needed.
// Example: var OcxFile = "AxisCamControl.ocx#Version=1,0,1,42";
var OcxFile = "AxisCamControl.ocx#Version=1,0,1,42";

// No changes required below this point
var output = "";
if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC")&&(navigator.platform != "Mac68k"))
{
// If Internet Explorer for Windows then use ActiveX
output = "<OBJECT ID=\"CamImage\" WIDTH="
output += DisplayWidth;
output += " HEIGHT=";
output += DisplayHeight;
output += " CLASSID=CLSID:917623D1-D8E5-11D2-BE8B-00104B06BDE3 ";
output += "CODEBASE=\"";
output += BaseURL;
output += OcxFile;
output += "\">";
output += "<PARAM NAME=\"URL\" VALUE=\"";
output += BaseURL;
output += File;
output += "\"> <BR><B>Axis ActiveX Camera Control</B><BR>";
output += "The AXIS ActiveX Camera Control, which enables you ";
output += "to view live image streams in Microsoft Internet";
output += " Explorer, could not be registered on your computer.";
output += "<BR></OBJECT>";
}
else
{
// If not IE for Windows use the browser itself to display
output = "<IMG SRC=\"";
output += BaseURL;
output += File;
output += "?dummy=garb\" HEIGHT=\"";
// The above dummy cgi-parameter helps some versions of NS
output += DisplayHeight;
output += "\" WIDTH=\"";
output += DisplayWidth;
output += "\" ALT=\"Moving Image Stream\">";
}
document.write(output);
</script>
<!-- End of image display part -->
</body>
</html>

Bu tanımların sisteminizde oluşturabileceği değişikliklerden dolayı Axis ve BağLAN hiç bir sorumluluk kabul etmez. Detaylı uygulama için sistem yöneticinize danışınız.

 

 

 


 


BağLAN Bilgisayar ve İletişim Sistemleri Ltd. Şti.
Çamlık Yolu Sok. Uğurlu Apt. No:4 / 7, Çamlık Etiler, İstanbul
 Tel: 0 212 358 5909 Faks: 0 212 358 5906

Copyright © 1999-2005  BağLAN Bilgisayar ve İletişim sistemleri
Grafik ve Web tasarımı BağLAN Bilgisayar Bünyesinde hazırlanmıştır.
İsim ve Markalar ilgili firmaların tescilli ürünleridir