qcwebcam - QuickCam-based webcam program for fhttpd

Version 0.3.2, beta release by Alex Belits, abelits@phobos.illtel.denver.co.us.


Author is not affiliated with Connectix Corporation, Connectix Corporation does not support or approve this software.
All copyright notices and disclaimers in sources and documentations are valid and assumed to be known by the user.

Hardware supported:
Operating systems supported:
Software required:
Copyright and license:


qcwebcam is a webcam program written as a server process for fhttpd HTTP server. It utilizes user processes interface which differs from CGI, FastCGI or module interfaces used in other servers. qcwebcam does not work as an additional HTTP server by itself, all data is sent through main HTTP server which can be located on the same or different host. All camera hardware handling, image preparation and user interface is done by qcwebcam while buffering, HTTP protocol and security is handled by HTTP server. Flow control (actually dropping frames for slow connections) is done by qcwebcam using fhttpd flow control messages that are part of protocol.

qcwebcam supports multiple clients at a time without creating additional processes for every user by itself or HTTP server, although since HTTP protocol is used, data is sent to every client individually.

Currently only Linux and FreeBSD versions exists, although the program should work on other unices where fhttpd and cqc/qcread library will be ported. No ports to non-unixlike systems are planned.

qcwebcam is used on constantly-running wbcam page at http://phobos.illtel.denver.co.us/qcam-frame?update=serverpush. It's 486dx2-80 box with 32M of RAM, connected through 28.8kbs modem line.

Changes in version 0.3.2

Memory leak in self-updating frame support
Every time parameters of the camera were changed without changing image geometry (including changes made by auto-brightness) while some client was connected with server-push image frame update enabled, response descriptor structure was created and not deleted.
Server-push parameters updates
If some client was connected with server-push image frame or control page update, and its connection was too slow to receive all updates, it will not be notified about last change that happened while its buffer still was full even after it will clear the buffer by receiving all preceding updates sent to it. Now after the buffer is cleaned, and some updates are still not sent to the client, last update is sent to synchronize that client's status.

User interface changes

Changes in version 0.3.1

Auto-brightness was able to set unusable value 255

Changes in version 0.3

Addidional keyword in /usr/local/etc/qcwebcam.<programname>:

autobrightness <value>
enables auto-brightness mode - brightness value is constantly adjusted to keep brightness of the image around the <value>. Default value is 128.

"-frame" URL
Base URL with "-frame" appended to it is mapped to the HTML with <IMG> tag for the image. "update=serverpush" parameter enables both server-push update of the HTML and server-push for image in it.

Color balance and priority controls added

Idle load decreased
When no clients are connected, frames are not taken or, if auto-brightness is enabled, one frame is taken per minute.

Auto-reset after camera hardware failures

Controls for parameters, not supported by the camera type detected, are not shown

User interface improvements
Control page changed to include Netscape-specific and Javascript controls while remaining compatible with standard HTML.

Changes in version 0.2

URLs changes
URLs now can be configured, and "img=jpeg" parameter is removed. Configuration form has the same URL as the image with "-config" appended to the name (not parameters). "update=serverpush" parameter remained the same. To accomodate two different URLs for camera configuration and image fhttpd configuration file SHOULD contain "*" appended to the base URL in application definition. This change allows to set different access restrictions for configuration and image URLs.

Bugfixes in "never should happen" errors handling

/usr/local/etc/qcwebcam.<programname> configuration files support.
File /usr/local/etc/qcwebcam.<programname> (default is /usr/local/etc/qcwebcam.qcwebcam) may contain the following keywords:

url <custom-url>
<custom-url> is the base URL for the camera. (SHOULD be the same as defined in HTTP server configuration)

camera <cameraname>
<cameraname> is the camera name in /usr/local/etc/qcam.conf file.

framerate <fps>
<fps> is the frame rate (should be between 0.001 and 100 to be accepted, but values >1 are impractical).

User interface fixes

Installing qcwebcam

Compiling qcwebcam

To install qcwebcam on the host, already running fhttpd, with installed fhttpd and qcread sources, unpack qcwebcam-0.3.2.tar.gz file and compile source with make. You may need to edit Makefile if locations of libraries and include files differ from ones defined there - default ones are set for qcread, fhttpd and qcwebcam unpacked into directories under the same base directory.

Configuring qcwebcam as an application for fhttpd

Locally running process

Add line specifying qcwebcam as an application into /etc/fhttpd.conf file:
Application qcam - root 1 64 /home/ftp/qcam* /usr/local/camera/bin/qcwebcam
where /usr/local/camera/bin/qcwebcam is the location of qcwebcam binary, /home/ftp/qcam is the path resulted from URL-to-filename translation on the server ("*" is added to match "/home/ftp/qcam-config" pathname for configuration form and "/home/ftp/qcam-frame" pathname for image "frame"), qcam is the application name. 64 is the limit of requests number in a queue, and 1 is the number of processes allowed - it SHOULD be 1 because only one process can access camera at a time. root is the user, whose userid will be used to run qcwebcam - it SHOULD be root because accessing parallel ports in this manner and setting proirity for process requires that. "Application" line should be placed before the default "Application" line that contains "*" as the pathmask - otherwise the default application will override it.

Remotely running process

Add line specifying qcwebcam as an application into /etc/fhttpd.conf file:
Application qcam - qcamuser 1 64 /home/ftp/qcam*
where qcamuser is the local username used by remotely running qcwebcam to login into fhttpd, all other parameters are the same as for local process.

On the remote host where qcwebcam will be running add into /usr/local/etc/httpprocrc file (or make one, it should be owned by root and has permissions 600):

application qcam
user qcamuser
host hostname
password (wr$ql8^
port 8000
where qcam is the application name, qcamuser is the user on the host hostname, where fhttpd is running, and (wr$ql8^ is the password of that user on that host (use something as non-human-readable as this but DON'T use this password). 8000 is the port where fhttpd is accepting user processes logins.

Configuring qcwebcam

Write configuration in /usr/local/etc/qcam.conf (see cqc/qcread documentation). File /usr/local/etc/qwebcam.<programname> (where <programname> is the basename of qcwebcam executable, so by default it is "/usr/local/etc/qwebcam.qcwebcam") can have additional options for the camera (see "Changes in version 0.2" and "Changes in version 0.3" sections).

Restart fhttpd by kill -HUP its proces.

If qcwebcam should run locally, fhttpd will start it, and if it should be running on remote host, start it as root using the command line

qcwebcam qcam
where qcam is the application name.

Using qcwebcam

Resulting URLs for qcwebcam will be:
configuration form.
HTML with <IMG> tag for the image.
JPEG image.
configuration form with self-update through server push (Netscape).
HTML with <IMG> tag for the JPEG image stream with self-update through server push (Netscape).
JPEG image stream through server push (Netscape).

where http://hostname/qcam is the base URL that maps into path defined in the configuration.

Since Netscape requires that server-push image streams should be referenced through <IMG> tags with height and width predefined, you will need to use "-frame" URL or a file with somethung like:

<IMG SRC="/qcam?update=serverpush" WIDTH=320 HEIGHT=240>
for server-push streams.

Distribution site

phobos.illtel.denver.co.us: /pub/qcwebcam