Hack a camera - web interface enhancements (Foscam) en

By Johnny on Sunday 27 November 2011 23:00 - Comments (17)
Categories: software, usability, video, Views: 25.774

Foscam FI8918W
I recently purchased a IP-camera, a webcam in truest sense in that it is a camera that is directly connected to the web. Inside of it runs a web server which allow a stream video and audio to be directly accessed all over the world from any web browser!

But that's not all; the camera can also be configured and controlled over the web. Inside are two motors that enable you to pan and tilt the camera, so that it can look around.

The control interface uses ActiveX, a propriety technology that only works on Internet Explorer on Windows (not on mobile devices) and because it is a big security risk is often disabled.

Alternatively the webcam also provides a more "standard" based interface that works in almost any browser. However, the quality of this interface is somewhat disappointing, and could greatly be improved.

After doing some research I am convinced that it is possible to make an improved version of the web interface, and install it on the webcam as a firmware upgrade.

My camera is a Foscam FI8918W for which the firmware can be updated. There is already some code on SourgeForge that can decompile the firmware and repackage it. However, nobody seems to have released firmware with an improved web interface.

But even without modifying the firmware the web interface can be modified. Any application or web page that can decode a MJEG stream can display the video, and commands are sent to the camera as simple HTTP GET requests.
Some problems with the current web interface
1. No direct visual feedback
When clicking on a control there is no confirmation. You have to wait for the command to be sent, received by the camera, the motors to move, a new image to be captured and sent back to you. This might take a few seconds, especially when uploading the video stream over a home connection. For a video stream the lag is usually not a problem however when there is 2 way communication it is.

My solution: highlight control buttons when activated.

2. Click, reposition, click
The only way to control the camera is to click on the buttons. This requires you to move the mouse cursor between every click. This is cumbersome with a mouse, but outright annoying with a trackpad.

My solution: allow the mouse to move over the controls while being pressed. And also allow the keyboard to be used.

3. Continuous streaming
When accessing the web controls a video stream is shown next to it, taking up bandwidth and even slowing down the browser/computer. This may be undesirable when the stream is viewed through an external application (like VLC).

My solution: added option to disable and enable video stream.
Video
Here is a video which shows some of the changes I have made to the web interface for controlling the movements of the camera. Both by moving the mouse while holding the button down and using the keyboard to move the camera.

Next steps
While controlling the camera is much more fun now I want to see if I can make some some more enhancements. Here is some of the ideas I am thinking about:
  • Create a widget for Mac OS X Dashboard that can control the camera and view the video stream and cuts off the stream when the dashboard is not displayed.
  • Make it possible to save snapshots in the web interface using LocalStorage in the browser.
  • Allow the camera to send images directly to other web services.
  • Package these changes and release it as a Firmware update.
The number of features possible is limited by the camera's control capabilities and that of the web browser, but if anybody has some ideas for other features please let me know!
Online resources