Difference between revisions of "IP Cameras"

From LinuxMCE
Jump to: navigation, search
m
m (Reverted edit of Zaerc, changed back to last version by Lozzo)
Line 1: Line 1:
[[Category: Hardware| ]]
 
[[Category: Cameras]]
 
[[Category: Tutorials]]
 
 
 
==Introduction==
 
==Introduction==
 
IP cameras, a.k.a. "network cameras", are digital cameras that have a built-in web server.  This allows the camera to be accessed by any computer on the same network using a web browser.  Video is streamed to the web browser from the camera without additional equipment.  In a LinuxMCE system, IP cameras are easy to setup, but require some extra manipulation to get them to record.
 
IP cameras, a.k.a. "network cameras", are digital cameras that have a built-in web server.  This allows the camera to be accessed by any computer on the same network using a web browser.  Video is streamed to the web browser from the camera without additional equipment.  In a LinuxMCE system, IP cameras are easy to setup, but require some extra manipulation to get them to record.
Line 144: Line 140:
 
| [[D-Link]]
 
| [[D-Link]]
 
|}
 
|}
 +
 +
[[Category: Tutorials]]
 +
[[Category: Cameras]]

Revision as of 07:27, 7 October 2007

Introduction

IP cameras, a.k.a. "network cameras", are digital cameras that have a built-in web server. This allows the camera to be accessed by any computer on the same network using a web browser. Video is streamed to the web browser from the camera without additional equipment. In a LinuxMCE system, IP cameras are easy to setup, but require some extra manipulation to get them to record.

Quick Setup

IP cameras can be brought online quickly with LinuxMCE by having their network settings set to DHCP. LinuxMCE will assign the camera an IP address.

  • Go into the "Surveillance Cameras" section of the LinuxMCE-admin pages and click on "Add Device". This should bring up the page as seen below:

File:Adding Axis Cameras.png

  • Choose the camera by clicking in the "Models" window. In the example above, "Axis IP Camera" is selected. Click "Add Device". This will also close this window. The original window should now display an entry for a new camera as so:

File:Adding Axis Cameras2.png

  • Insert the IP camera's MAC address in the field below the IP address. You do not need to insert an IP address. LinuxMCE will do this for you when it first detects the camera on the network. If you wish, you can assign a static IP address by inserting it in the IP Address field. Make sure the IP address is reachable by the LinuxMCE core.
  • Input the correct path to an image file of the camera. Note: Most IP cameras don't display videos. Instead, they display many jpeg images at a high rate. These jpeg images can be accessed by inputing the path to the image in a web browser, e.g. http://<ip address of camera>/axis-cgi/jpg/image.cgi for the Axis network camera. LinuxMCE also uses these jpeg images to display "video" from the camera on orbiters by refreshing the jpeg frequently. (See section below for configuration information.)
  • If you have configured an user-name and password to access the images from the camera, then enter it in the AuthUser and AuthPassword parameters.
  • In the LinuxMCE-admin page, go to the Floorplan Wizard, choose "Security Zone" from the drop-down menu, and move over each green square representing a camera to the floorplan roughly where either you have the camera or where the camera is viewing.
  • Finally, do a Quick Reload Router from the Restart page. You will also need to click "Reload & Regen All Orbiters" from the Advanced Options menu (click on the LinuxMCE icon on the lower left hand corner) of any orbiter.

Using Motion to Record

Unfortunately, the default IP camera setup under LinuxMCE will not record the camera footage. To do that, you need to use Motion. Instead of using the IP camera when you configure (delete the camera if you've already configured it as an IP camera), use a generic analog camera.

As before, insert the IP camera's MAC address in the field below the IP address. You do not need to insert an IP address. LinuxMCE will do this for you when it first detects the camera on the network. If you wish, you can assign a static IP address by inserting it in the IP Address field. Make sure the IP address is reachable by the LinuxMCE core.

Under "Path" type the path to the camera's image file. (See section below for configuration information.)

Controlled by should be set to "Motion Wrapper".

File:Surveillance Cameras.png

Now, you will need to access the LinuxMCE core by using SSH. Log in and type (without the '$' mark):

$ ls /etc/motion/

You should see at least the following files:

motion.conf
thread0.conf

For each camera you have configured, there should be a "threadx.conf" file where x is replaced by the number of the camera starting with "0".

At the prompt, type:

$ nano /etc/motion/thread0.conf

This is the configuration file for the first camera. You will be greeted with a page that starts with:

videodevice /dev/video0
input 0
noise_level 32

followed by a bunch of other lines. Don't worry about those for now.

Comment out the first two lines with a hash in front and below it type:

netcam_url http://<ip_address_of_this_camera>/axis-cgi/jpg/image.cgi

So now it should look something like this but with your camera's IP address and the correct path to your camera's image file:

#videodevice /dev/video0
#input 0
netcam_url http://192.168.80.100/axis-cgi/jpg/image.cgi
input 0
noise_level 32

Hit CTL-x to save and quit. (Say yes when prompted by using the letter "y" and enter.) Unfortunately, when we reboot the orbiter or do a quick restart, this file will be overwritten. (Anyone that knows how to get this to work without better, please feel free to rewrite this section.) Therefore, we will make a backup copy by typing:

$ cp /etc/motion/thread0.conf /etc/motion/thread0.conf.backup

Do the same for any other cameras taking care that the IPs are different and the thread# is different.

Finally, you need to start motion as a daemon to have it run in the background. Type:

$ motion -D

You can also use this simple Perl program to copy over the backup files and to start motion as a daemon:

#! /usr/bin/perl
# Will copy over backup camera motion thread configurations and start motion.
# Assumes threadx.conf.backup exists.

use strict;

my $Nthread = 0;

while ( $Nthread > -1 ) {
        my $files = "/etc/motion/thread$Nthread.conf";
        if ( -e $files ) {
                print "$files exists...\n";
                `cp $files.backup $files`;
                $Nthread++;
                print "$Nthread \n";
        }
        else {
                print "$files missing or reached the end...\n";
                exit 0;
        }

}

`motion -D`;
exit 0;

If anyone knows how to set this script to run automatically on the core after a "Quick Reload Router" or reboot, please provide it here...

Available IP Cameras

Include here a list of IP security cameras that have been tested with LinuxMCE.

IP Security Cameras
Axis Network Cameras
D-Link