Sometimes we want to record video and audio from a webcam, in my case I can use my PV-GS39 as a webcam, so when I connect it, my GNU/Linux box create automagically 2 new devices:
We can test that this devices work correctly, to do this, we need mplayer and cat. First we test the audio, to do this just take everything that came from cam mic and send to our soundcard:
cat /dev/dsp1 > /dev/dsp
We can stop the above code by pressing Control + C. Now test the video stuff:
mplayer tv:// -tv device=/dev/video2
And you can see what your cam views. Remember that /dev/video2 and /dev/dsp1 can be change depending on the machine and the cam, check it before complain about this little doc.
Now, the interesting stuff it's to record everything that came from the cam. To do that we can use mencoder.
The next line must work to record video and audio from your webcam:
mencoder -tv fps=30:driver=v4l2:buffersize=16:norm=NTSC:input=0:volume=40:amode=1:quality=100:width=320:height=240:device=/dev/video2:adevice=/dev/dsp1:audiorate=44100:immediatemode=0:forceaudio tv:// -o test.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=490:keyint=18 -ofps 13.8 -fps 30 -vf lavcdeint -oac mp3lame -lameopts cbr:br=96:mode=0 -noskip
Yes, a long long long line. But it's easy to understand if you look closer.
…the explanation of the parameters passed to mencoder will be right here soon…