A few months earlier I had picked up a BTTV-based (Bt848) frame grabber card from the leftovers bin, and although I was able to make it work I can't say that it was very impressive. The software that came with it just locked up my machine under Windows, and the software available under Linux wasn't too hot either. The image quality can at best be described as questionable.
The module was written the night before I was leaving for my holiday, and being the first time I had used the video4linux API, I had to pick apart a few programs written by other people in order to figure out how to make things work. The documentation I was able to find on the net didn't really answer all my questions and at times it was just confusing.
I hadn't written anything that encodes JPG or PNG images before either, so I had to figure out how libpng and libjpeg work as well. Hopefully I didn't screw up too badly.
Hopefully some of you might be able to help develop this module furter so it can be useful to more people. Please see the section on contributing for more information.
In order to compile and link the module you need to install the following libraries in a place where the C-preprocessor and linker can find them:
tar xvfz apache_1.3.11.tar.gz cd cd apache_1.3.11Now there are two ways you can build Apache with the video module.
The first way we describe is the one you might want to use the first time you try out the module.
./configure --add-module=/path/to/mod_video.c make make installThis will copy your module to the
src/modules/extradirectory, build the Apache webserver with the video module and install it. (Be sure to specify a proper
configureso your server will be installed where you want it).
The second way you can build mod_video
assumes that you have already copied
will do) , and is well suited if you want to run configure again
later to change some of the other parameters.
./configure --activate-module=src/modules/extra/mod_video.c make make install
Actually, I usually skip the
make install command and
httpd binary directly to its target dir to avoid
messing up what else is there. (Be sure to stop Apache before
attempting to overwrite the old binary).
mod_videoas a DSO by using
apxs. This is the easiest method to get the module installed. Note that this requires you to install Apache first so that
apxs -i -a -c -l png -l jpeg -l z mod_video.c
Many thanks to David E. Weekly for this tip
Configuring the module
The video module is a handler, so the way to set it up is to configure
it to use a
Location section in the Apache configuration
file. Here's an example:
LoadModule video_module modules/mod_video.so <Location /camera> SetHandler mod_video video_device /dev/video video_format jpeg video_input 0 video_width 640 video_height 480 video_jpeg_quality 90 video_unavailable_image /var/www/html/images/videoSourceUnavail.jpg video_palette 4 </Location>
The configuration commands available are:
This is where you come into the picture. If you can contribute anything to this module, please do. The more configurations it can be made to work with the more useful it will be for all of us. If you make improvements to this module please share them with me so I can put them back into the module.
Some of the things that I am interested in are:
Right now it works with the hardware I had available: an old BT848 frame grabber that I found in the leftovers bin. There are probably more interesting frame-grabbers available for Linux, as well as for other hardware platforms.
I didn't try to play with the tuner since I have no antenna or cable connected to my computer, so the options for selecting the input is rather limited at this time. It would be great if the module could be made to support this, as well as having the option of grabbing from several sources with one frame-grabber.
My knowledge of the JPEG and PNG libraries is somewhat limited. I am sure the use of this libraries can be optimized a lot. For instance there should be a way around temporary files for JPEG (...other than the ugly hack I tried by having the library write directly to the client connection).
Also, it would be interesting to explore the possiblily of streaming video by sending the client a row of frames much like the fish-tank demo Netscape had a few years ago. Then again, for streaming video you probably want to use a different system architecture.
Other sites where this project is entered