From: Douglas Mayne on
I am wondering if anyone has advice or howtos about video capture and
realtime video monitoring via a webcam. A quick google search advised
using the mencoder program, part of the mplayer suite. I see that is now
part of the default Slackware 13.0 install. So far, I have come up with
this simplistic script to start a webcam and monitor:

<begin webcam script>
#/bin/bash
sudo mencoder tv:// -o /dev/loop0 &
j=$!
if [ $? -eq 0 ];then
sleep 2
# Start the monitor after allowing 2 seconds of video to accum.
sudo mplayer /dev/loop0
fi
sudo kill -1 $j
<end webcam script>

The first idea I had was to use a pre-allocated file with a loopback
pointing to it. That way, I have a predetermined amount of disc space
allocated to video, etc; that is, whenever the webcam script is called it
starts by overwriting the predefined buffer (file). BTW, writing to /dev/
loop0 is what is requiring sudo.

Does anyone have ideas for improvement of the above script? Obviously, I
would prefer not having a two second delay between capture and monitor,
but that may be somewhat unavoidable due to CPU cycles required for
encoding/decoding.

TIA

--
Douglas Mayne