Playing with my webcam on linux

So I always use my webcam on software like Skype, I also have tried to use it on native Linux environments and I have had mixed results. For the most part I can get it to run but things are always not present when I need to just use it.

Here are some great command lines to use with software that I regularly use:

mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0

This will show you the webcam stream but won’t really record it. I like this because is commands that I use all the time to re-encode or play most of my media. I use mplayer more than VLC for example to listen and watch videos on my Laptop. So mplayer and mencoder are always there in my devices. Mencoder shows:

mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -ovc lavc -o webcam.avi

Another tool that I use a lot is ffmpeg.

ffmpeg -f oss -i /dev/dsp -f video4linux2 -s 320×240 -i /dev/video0 out.mpg

this will indeed record but the parameter ‘-s’ create a smaller display at 320×240 and record it to the file out.mpg.

All these commands record video input from the webcam but doesn’t add effects or any retouching. However is pretty good for something fast to record and use something like cinelerra.

The other big thing is audio and here I have a question:

How can we switch the input of the recording?

So far it only records to dsp which I guess is the audio card which in turn be the microphone, but I haven’t played with capture inputs and switch from mic to another channel like the computer noises. Input source just shows the microphone both, internal and environmental one. I might need to play around with sox to get this working.

mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:adevice=/dev/dsp1 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi

Aqui vemos algunas cosas como ‘forceaudio:adevice=/dev/dsp‘ y ‘-oac mp3lame‘ asi como cosas como el bitrate en cbr:br=64:mode=3.

I will need to get some playing with audio and video as well arguments options. If you know something that I should know feel free to comment.

Advertisements