IP Cameras

From LinuxMCE
Revision as of 08:21, 23 October 2012 by Mcefan (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

See Monitor surveillance cameras


Introduction

An IP camera, also called network camera, is a digital camera that has a built-in web server capable of serving streams of images that appear as live video.
Once connected to a network, the images from the camera can be accessed by any computer on the same network using a common web browser, without the need for additional equipment. The live video is streamed from the camera to the web browser.

LinuxMCE can tap into an IP video stream and make the videos available throughout the system.

IP cameras can be easily incorporated in a LinuxMCE system. In this article, you will get all the instructions necessary for you to do add, configure, and troubleshoot IP cameras.



IP Cameras and Motion Wrapper

IP cameras can be used under the Motion Wrapper to enable it to detect motion and send alerts.


To add Motion Wrapper and IP Cameras

Add the Motion Wrapper interface to the system

LinuxMCE includes the device Motion Wrapper, which is a wrapper for the open source project Motion. The Motion Wrapper serves as the interface between LinuxMCE and Motion.


To add the Motion Wrapper as a device:

  1. Open your webadmin control panel
  2. Under Wizard: Devices > Interfaces
  3. At the bottom of the page, click on Add device
    - Device Category: Surveillance Video Interfaces (NOT Surveillance Cameras, that is in the pripherals category)
    - Click the pull down box under Device Template and find and select the template labeled Motion Wrapper.
  4. Click on Pick device template. This creates the Interface device and displays it on the configuration page.
  5. Under "Action" on the right side, click on Advanced.

This installs the device Motion Wrapper in LinuxMCE. Once installed, the procedure does not need to be repeated and child devices can be added at will.

Note
You can also replace steps 1&2 with
on the left pane at the bottom click on Show Device Tree
	My Devices > CORE > Create Child Device > Pick device template
There is no step 5 when using this method. You can start creating the child device.



Add the IP camera

Add the IP camera as a Generic Analog Camera to the Motion Wrapper
  1. Now on the right pane, click Create Child Device again.
  2. Enter your IP Cameras IP address and MAC address here,
  3. click Pick Device Template
  4. Click the pull down box under Device Template and use Generic Analog Camera,
  5. click Pick Device Template
  6. Now on the right window pane, scroll down to the bottom and find the field named Configuration. This is where you put your cameras URL normally used by your web browser, to view your cameras video feed. My examples are based on Axis based IP Cameras.
    netcam_url http://<you.cameras.ip.addreess>/mjpg/video.mjpg
    netcam_userpass username:password
  7. Now click save at the bottom
  8. RESTART your router

Now on your LMCE interface, go to "Security" -> "Generic Analog Camera" and see if it's working.



Adding IP Cameras as a Generic Motion IP camera under Motion Wrapper
  1. From LinuxMCE Admin Website-->Advanced-->Configuration-->Devices Open CORE and then Click on Motion_Wrapper
  2. From the top right frame press Create Child Device
    1. Enter a description (or leave blank for default one), fill in the IP Address with your IP Camera's IP, and the MAC field with your IP Camera's MAC address.
    2. Press Pick Device Template.
    3. In the "Device Template ***" section, select the template Generic Motion IP camera
    4. Click Pick device template. This opens the camera's configuration page
      1. In "Device Info", select the "Room" where your IP Cam is located
      2. Scroll down to the Device data section.
        1. Path : set the path to your IP Camera current snapshot, it has to be a jpg or mjpg file
        2. "Protocol" : set the protocol to http or ftp, default is http
        3. "TCP Port" : set the port on which your IP CAM it's feeding the images
        4. "Username" : set the username required to access your IP Cam
        5. "Password" : set the password required to access your IP Cam
        6. "Noise" : noise level for motion detection, default to 32
      3. Click Save
    5. Scroll up to the top menu and, on the left, select Wizard > Restart
      1. Click on Quick Reload Router
      2. Wait for the router to reload
    6. Now scroll up to the top menu and, on the right, select Security > View cameras
      1. Select the check box for the camera
      2. Click Preview checked cameras
  3. For the corresponding button to show, regenerate your orbiters.



Adding Axis IP cameras to Motion

To get all the features offered by Motion (motion detection,recording,etc...), you need to run your IP Camera under motion. Your camera can be auto detected, and device generated for it, but it might NOT be under Motion as parent. This is the case for the Axis camera.

Here is a quick and not so clean workaround for adding an IP camera device under Motion:

  1. Add Generic Analog Camera #66 Device
  2. Change Configuraton field to add data for IP camera

Example for Axis camera :

netcam_url  http://192.168.0.90/axis-cgi/jpg/image.cgi?resolution=640x480
netcam_userpass username:password    

Omit the last one if you don't have a access password specified.



Tips on finding your camera's URL

  1. Try to use ftp to connect to your camera. The username and pass is usually whatever you set up on the web interface of the camera.
  2. Traverse the folders to find your html documents folder.
    Typically, you're looking for a .jpg or .mjpg file to point the Motion Wrapper to.

For example, these are the possible links on an Axis 2100 IP Camera.

/jpg/image.jpg (Works fine using the wrapper)
/mjpg/video.mjpg (Works fine using the wrapper)
/cgi-bin/jpg/image.cgi (I could not get this one working under the wrapper)
/cgi-bin/mjpg/video.cgi (Again, could not get it to work)



Installing an "external" network camera

This section describes how to install an IP camera as a Motion device.

Note: These instructions are for when the camera is plugged into a router on the external network, as opposed to a switch on the internal network. Not ideal, but it is sometimes necessary due to this aforementioned problem.

  1. Install motion wrapper (if it is not installed already).
    In web admin (type "192.168.80.1" in a browser of your choice), click Show devices tree (very bottom of left-hand pane)
    click on CORE and then Create Child Device.
    Then press the Pick device template button, which will open a new window.
    Under "Device Template", select Motion Wrapper and press the Pick device template button.
  2. Plug your camera into the external router. In your router admin page (accessed via 192.168.1.1 in my case) find out what IP was assigned. Type this IP into your browser and have a look through the options. Set the username and password. I also set a static IP just in case it tries to change itself. I also specified the camera's IP on my router so that no other device could take it (belt and braces).
  3. In LMCE web admin ("192.168.80.1" into a browser), go to Wizard -> Devices -> Surveillance Cameras.
    Click the Add Device button at the bottom of the page. This will open a new window.
  4. In the window that just opened, pick Generic Motion IP Camera from the drop-down menu in the Device Template section.
    Press the Pick device template button.
  5. Find the new camera in Wizard -> Devices -> Surveillance Cameras. Change the description to something more obvious if you so wish and select a room.
  6. Change the Path field to match your camera's URL as indicated in the previous section. In my case, I used "http://192.168.1.XXX/videostream.cgi?user=XXXXX&pwd=XXXXXX".
    Do not forget to replace the Xs with the IP, username and password.
    Add "80" to the TCP Port field. Press Save.
  7. Press the Advanced button. Check the IP and MAC address in the "Device Info" section. If it's not the same as the MAC and IP you saw in the camera's utility, change it. Click Save.
  8. Do a Reload & Regen, and that should be it.

This camera can now be used as a motion sensor and/or for recording movement (recordings are stored in "/home/cameras/XX" where XX is the device number of the camera, and last for 5 days I believe). A scenario will hopefully be automatically generated.

Repeat the above procedure for any additional cameras.

Note
The old issue of Motion dying after reloading/restarting the Core has been fixed. It is no longer necessary to restarted it manually by doing a "sudo /etc/init.d/motion restart". This issue has been reported http://svn.linuxmce.org/trac.cgi/ticket/904 & http://svn.linuxmce.org/trac.cgi/ticket/715 You can read about the resolution there if you'd like to.

Very occasionally I have found that the scenarios sometimes require a little bit of tinkering. If there is no image displayed when you click on the scenario, look in Wizard -> Scenarios -> Security scenarios, select the scenario in question, select "Advanced Wizard" in the "Edit scenario using wizard" section, and just check that the number in the "#2 PK_Device (int)" field corresponds with the camera's Device #; if it does not, change it. Reload & Regen.




LinuxMCE compatible IP Cameras

For a list of IP security cameras that have been tested with LinuxMCE, see: