How to capture webcam with audio using Mencoder

I have a webcam and my laptop is Ubuntu 7.04 Feisty Fawn. I would like to capture a movie with both video and audio using those equipments. So the tool I used should be available in Ubuntu and the one I used is Mencoder.

My trick is tv:// and -tv driver=v4l as follows.

mencoder \
    tv:// \
    -tv driver=v4l:device=/dev/video0:width=640:height=480:forceaudio \
    -ovc lavc \
    -oac lavc \
    -lavcopts vcodec=mpeg4:acodec=mp3 \
    -ffourcc divx
    -o test.avi

If you want to capture audio, don't forget forceaudio. If you would like to play this video in DIVX player, you may have to force fourcc by -ffourcc divx. Some webcams may have v4l2 driver instead.

Tags: , , ,

Reply