Saturday, June 13, 2009

How to access Axis IP Camera using Java

What is an IP Camera?

An IP Camera is a stand-alone device which allows you to view live, full motion video from anywhere in the world. IP Cameras can be used for surveillance of both homes and businesses. With the ability to record live video to a remote location, IP Cameras allow you to make sure your recorded video is safe by storing it at a location that only you can access.



This was indeed a challenge for me at the first time. But with mere investigation i could find that before accessing the IP camera we need to obtain authentication as it is working as a video server. I would list out what i did to capture a video stream from IP camera

Step1 : obtaining the IP address of the camera (it will get assigned an available ip address from the network as it is configured upon DHCP by default) . You can use the utility software provided by the camera provider in case of finding the ip.

Step2 : You may need to configure the axis camera giving a password for the default "root" user. If you want you may add many users as you wish using their utility software.

Step3 : Then you can go to the URL of the camera and make sure the JPG or MJPG streams are there.

Step4 : Next challenge was to obain authentication from the video server of the camera using Java code snippet. In that case i used java.net.Authenticator. Authenticator would consist of the URL , username and password which we are providing for the server.Then setDefault(Authenticator a) Sets the authenticator that will be used by the networking code when a proxy or an HTTP server asks for authentication.

Step5 : Now you are successfully connected to the Camera. :)

Step6 : Then you can use the video stream from the IP camera for whatever application you use.