Mountains home
Previous: Sage Factory Tour

Hacking my Webcam

I recently bought a D-Link DCS-5300W webcam.


I decided that I wanted to be able to capture images from this cam and post them to a website for future viewing - sort of a home-brew security system. One of the (many) features I really like about this camera is its ability to pan back and forth, up and down. After sniffing the network, watching what the included applications were doing, I've figure out the following http based commands:

/cgi-bin/sysinfo.cgi
This url returns basic information about the current webcam configuration. For example, on my cam right now it returns the following:


Model=PT31x3-DLNK-0104c HostName=JonesHome Location=JonesHome Preset1=FrontDoor Preset2=LivingRoom Preset3=Deck Preset4=Skylight Preset5=Kitchen PTZEnabled=15

The most interesting thing in there are the Preset parameters - this is a list of camera positions that you've previously set up with the D-Link software in the camera. It's useful to be able to loop through these from your scripts.

/cgi-bin/video.jpg
This is the URL to the image currently being captured by the camera. It takes an optional paramter ?size=n where n can be 1 (176x120 pixels), 2 (352x240) or 3 (704x480) (default is 1). The different parameters specify the size of the image.

/cgi-bin/recall.cgi?recall=preset-name
This command moves the camera to one of the positions you've previously configured with the D-Link software. It can be one of the "Presets" returned by the sysinfo.cgi call.

/cgi-bin/camctrl.cgi?move=[home, up, down, left, right]
This command lets you return the camera to its home position, or move it in a given direction. This is what the D-Link web application uses to point the camera.

One thing to keep in mind when executing these commands is that the HTTP server built into the webcam seems to only allow a single activity to be going on at a time. If the camera is being contacted by one user, subsequent users are likely to time-out on their connections. Also, you need to wait for the camera to stop moving after giving a recall.cgi or camctrl command. Even when including time-outs, you occasionally will not be able to connect to the camera. I don't know if it's performing internal housekeeping operations or what, but if you just wait for a few seconds and try again you can usually successfully perform what ever command you were attempting again.

Posted by Bruce on February 23, 2006 1:04 PM

Comments

using the dcs 5300w did you use this on a mac???
did it work
richard

Posted by: richard rosenthal on October 29, 2006 6:37 PM


Post a comment

(If you've never left a comment here before, Bruce may need to approve your entry before it appears here. Thanks for waiting.)