webcam & microphone command line fun ....

A few unrelated events motivated me to start playing with my laptop’s webcam today … and have some fun :slight_smile:

First, because the maid was cleaning my computer room, and my wife was having a party with her Thai girl-friends, I was evicted for a short time from my computer room. … Also, I did not go outside, as I am fighting off a mild feaver, so I decided to stay inside, and play with the family laptop (Dell Studio 15) , accessing the web via our home wireless.

I also was trying to support user Larry1019 who wanted to get his internal mic working. I had long since stopped trying to get the internal mic working on my laptop, and when user Larry1019 asked for support, I was rather negative. This was my FAULT.

So I was composing a reply to him, when I recalled I had read (and saved) an Ubuntu user’s solution for the internal integrated laptop mic, but I was busy and I had discarded it because it got a bad Ubuntu reception from various Ubuntu newbies … So I decided to try the solution on my laptop, and well … , one thing lead to another, and my internal mic was working because of that Ubuntu thread.

So I then thought, since my laptop’s integrated mic is working, lets see how far I can go with this, from the command line. :stuck_out_tongue:

Here are some interesting (for me) command line commands one can use to record audio and video from their webcam and mic. Note one needs the Packman packaged libffmpeg0, ffmpeg, and mplayer to use the commans below:

To just play video (no recording):

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

To record both video only in the file “webcam.avi”:

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

To record both video and audio in the file “webcam.avi”:

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

or with ffmpeg, to record both video and audio in the file “out.mpg”:

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

Note with ffmpeg, on my laptop, the audio was about 400 msec ahead of the video. This was easily fixed in avidemux. The mencoder command did not have the audio/video sync problem.

My Dell Studio 15’s webcam is an ID: 05ca:18a1 Ricoh Co., Ltd and it works with the uvc driver.

I found the above commands on a Ubuntu thread, and I modified the commands very slightly to work on openSUSE. https://help.ubuntu.com/community/Webcam

Maybe we can have some more fun on this thread. … Does anyone else know of any neat COMMAND LINE commands to use to play with one’s mic and webcam?

Interesting. When I tried that on my very (very) old sandbox PC, with a Phillips webcam (uses the kernel module pwc) it did not work. I obtained the error:

oldcpu@stonehenge01:~> mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -ovc lavc -o webcam.avi
MPlayer dev-SVN-r29116-4.3-openSUSE Linux 11.1 (i686)-Packman (C) 2000-2009 MPlayer Teamsuccess: format: 9  data: 0x0 - 0x0
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
Selected device: Philips 740 webcam
 Capabilites:  video capture  read/write  streaming
 supported norms: 0 = webcam;
 inputs: 0 = usb;
 Current input: 0
 Current format: YUV420
v4l2: ioctl set format failed: Invalid argument
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
Selected input hasn't got a tuner!
v4l2: Cannot get fps
Audio block size too low, setting to 16384!
Floating point exception

So instead I tried this line:

mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -ofps 60 -nosound -ovc lavc -lavcopts vcodec=mjpeg -o test.avi

and that works !! I’m wondering, is it the video codec? ie. my desktop sandbox PC likes “mjpeg” but not “-ovc lavc” …

Groovy oldcpu, it works perfectly on my HPdv6645 laptop :smiley:

It has a - ID 064e:a101 Suyin Corp. Acer CrystalEye Webcam built in.

I’ve often tried to record from the webcam, but never had success.

I’ll keep a copy of those commands handy.

Well done lol!.

Thank you!
These command do allmost all, what I want.
By the way, you can change ‘mplayer’ to other GUI,
for example ‘smplayer’ (I find it a little bit better).

The only thing I look for is some program
or command to take photos, not only screenshots from the video.

The reason for doing it is quite simple: photos have grater resolution.
(Specifications say: “Integrated 2 MP camera (1600 x 1200 max resolution)”.)
Yes, I know, that quality won’t be perfect, but sometimes quality doesn’t really matter
and it’s easier to quickly take photos straight from the webcam to hard disk.

I have tried about a dozen of different special web camera
applications and none of them did everything, that the command you gave do.
I found only one, which actually worked for me (luvcview),
but it doesn’t record any video, let alone recording video with sound,
and saves pictures in some weird format, not png or jpg.
(Maybe I can’t get other programs to work
because I have installed 64 bit system.
Yes, it was to reckless for me to choose 64 bit…)

My desktop webcam (an old Phillips) is limited in its resolution. I don’t know the top resolution of my Dell Studio 15’s integated web cam (05ca:18a1 Rocoh) , but it may not be any better than 640x480.

I can take a snapshot by streaming the video to the display:

mplayer -vf screenshot -fps 15 tv:// -tv  driver=v4l2:device=/dev/video0

and then press “s” to take a snapshot, and press “q” to quit.
That gave me 640x480 (presumeably a default resolution).

I also played with:

mplayer tv:// driver=v4l2:width=800:height=600:device=/dev/video0 -fps 15 -vf snapshot

and that gave me 800x600 video, and after I pressed ‘s’ i obtained 800x600 in the snapshot.

I did the same for 1024x768, 1280x1024, and 1600x1200 and obtained a 1024x768, 1280x1024, and 1600x1200 video and snapshot respectively.

Note the webcam in my Dell Studio 15 laptop is not the most expensive integrated webcam on the block, so the resolutions larger than “640x480” may not be a “true” 800x600 or 1024x768, or 1280x1024 or 1600x1200 resolutions (ie I believe the images are dynamically sized up).

But maybe with a more capable web cam, the image will be better.

I can not test this without the hardware.

Haha great stuff,
Render yourself in ASCII.
mplayer -vo caca tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0
(libcaca required)

http://www.imagebam.com/image/dcc11336802809
(guess my t-shirt!)

Anyone else with some neat webcam command lines ?

Neat ! Thx.

Helpful post! Thank you very much.

You need xwinwrap for this to work.

Puts your webcam on your desktop as the background, yes icons and such still work

xwinwrap -ni -o 0.60 -fs -s -sp -st -b -nf -- mplayer -wid WID -quiet -fps 20 tv://

i gotta play with this one a bit… kinda curious if it can be modified to use an incoming stream;)

Neat! I can see the benefits of this if the incoming stream is a security camera… or a cam in a the ladies locker room :stuck_out_tongue: rotfl!

I agree. brucecadieux - thats pretty neat !!

mplayer -vf mirror -fps 15 tv:// -tv  driver=v4l2:device=/dev/video0

(I won’t tell, what it does, don’t want to spoil the surprise, although one might get an idea when having a close look.)

Is the webcam on your Dell Studio 15" working on Linux without problems?
I’ve got Studio and am planning to install openSuSe11…

You probably start a new thread for Dell Studio 15 questions. I was hoping we could keep this thread focussed on “webcam and command line fun” and not “does x webcam work with linux”. But reference your questions, the webcam on my Dell Studio 15 was working, but the last kernel update to 2.6.27.25 broke the webcam drivers (kernel module) functionality. I have not tried recently to get it working.

Maybe looking into restoring the webcams functionality (with this recent kernel update) is a project for me for this weekend (or next).

Correction to that. The webcam on my Dell Studio 15 works great! I just tested it a few minutes ago.

I installed some updates since the last kernel update. I probably need to do a list of what I installed, to see what fixed the breakage.

So to answer your question, yes the web cam on the Dell Studio 1537 does work … It is a 05ca:18a1 Ricoh Co. Ltd webcam.

I do not use cheese and I can not help you with cheese.

cheese is not a command line program. This thread is about webcam and microphone command line fun. Its not about running cheese.

Did you try any of the commands proposed in this thread?

If not, you are on the wrong thread. You would be better served to start your own thread with the proper title - that way you will get the attention you deserve.

I dont need exectly cheese
for me important is that webcam must can work with messengers
but when I test cam with skype it shows exectly this picture what shows cheese

sorry for my english

and thnks for help

You already have a thread going. There is no need to post here.

Simply put the information you put here in that thread.