Posted by -
Bill Peck
So you want to setup a webcam so that your friends can stare at your ugly face for hours on end. Or you have a really cute girlfriend with broadband who doesn't notice that you took the red led out of her camera.
Well if your like me you set one of these up and was dissapointed with the quality of the picture. First the cameras used for webcams are usually subpar. They have a fixed focal point which is always out of focus, the frame rate is miserable, and the white balance always gets out of wack..
Not to fear! You can use that $800 cam corder you have sitting around since when you bought it thinking you were going to be the next Steven Speilberg. And yes you too can create incoherent run on sentences.
My setup consists of the following:
- Analog Sony Camera
- Canopus ADVC-100 analog<->DV converter
- RedHat Linux 8.0 system
- el Cheap firewire card
This may not match your system and if the only thing your going to do is run a web cam with this stuff then you really do have more money than sense. You can get away with a nice firewire webcam from these guys. www.firewire-1394.com/pyro-webcam.htm . I have not tested this though.
Hooking up the hardware is fairly straightforward. Install the firewire PCI card, plug the camera into the canopus converter and the canopus into the firewire card.
Configure Linux to automatically load the drivers for the firewire card:
/etc/modules.conf
alias ieee1394-controller ohci1394
post-install ohci1394 /sbin/modprobe raw1394 video1394
Install the following software:
I have the following "streams" defined in my /etc/ffserver.conf file:
##################################################################
# Another stream : Multipart JPEG
<Stream test.mjpg>
#
Feed feed1.ffm
Format mpjpeg
#
VideoSize 160x112
VideoFrameRate 1
VideoIntraOnly
NoAudio
#
</Stream>
##################################################################
# Another stream : ASF compatible
<Stream test.asf>
Feed feed1.ffm
Format asf
#
VideoFrameRate 15
VideoSize 352x240
VideoBitRate 256
VideoGopSize 30
#AudioBitRate 64
NoAudio
StartSendOnKey
</Stream>
start ffserver!
Once you have all this done you can start running your feed. But first you need to create whats called a fifo. This is needed because the ffmpeg encoder doesn't recognize standard input. If it did you could just pipe some commands together and everything would just work.
Creating the fifo is simple:
mkfifo /tmp/fifo.rawdv
Now you need to pull the video from the firewire.
dvconnect -- >/tmp/fifo.rawdv
You will need to open another window because this command will block.
ffmpeg -f dv -i /tmp/fifo.rawdv http ://localhost:8090/feed1.ffm
At this point you should see the ffmpeg encoder connect to the ffserver and it will start encoding streams for however many you have defined in ffserver.conf to use this feed.
I use the following HTML on my web site:
<A HREF="http://webcam.home.pecknet.com:8090/test.asf" TITLE="Click for a video feed"><IMG WIDTH="160" HEIGHT="112" SRC="http://webcam.home.pecknet.com:8090/test.mjpg"></a>
Have fun...