Ubuntu really shocked me today when it recognized my integrated webcam automatically, which I discovered via Ekiga application.. Ok so drivers set, what I need now is record videos and take snapshots.. Mplayer as the title indicates does this all, the versatile player which can load video devices too. Lets begin with our task :
Viewing :Fireup this command to bring up your video streamer:
$ mplayer -fps 15 tv:// -tv driver=v4l2:device=/dev/video0
You can replace your video fps(frames per second), device and driver value as per your convenience.
Specify the video dimensions :
$ mplayer -fps 15 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0
Horizontally inverse the stream i.e. mirror effect :
$ mplayer -vf mirror -fps 15 tv:// -tv driver=v4l2:device=/dev/video0
View Fullscreen :
$ mplayer -aspect 16:10 -fps 15 tv:// -tv driver=v4l2:device=/dev/video0
$ mplayer -aspect 16:10 -vf mirror -fps 15 tv:// -tv driver=v4l2:device=/dev/video0
Then press 'f' key to enter Fullscreen. NOTE: Enter aspect value as per your screen resolution ratio eg. 4:3, 16:9, 1:1
Snapshots:Take snapshots while streaming by pressing 's' :
$ mplayer -vf screenshot -fps 15 tv:// -tv driver=v4l2:device=/dev/video0
Mirrored :
$ mplayer -vf mirror,screenshot -fps 15 tv:// -tv driver=v4l2:device=/dev/video0
The files will be saved in your current directory with name "shot####.png", where #### is for index number.
Video Capturing:For video capturing you will need a companion of mplayer named "mencoder", install it if you don't have one. So here is the way you start your recording:
Without sound:
$ mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -nosound -ovc lavc -o filename.avi
With sound:
$ mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o filename.avi
You can combine other subtags like vf, aspect, fps to enhance your video.
This is all, you can try a different short program too for video/photo capturing :
VideoView.
This post took from me a lot of manual reading and googling but am happy to present it before you. Here are the major sources :
Gentoo Wiki,
Mencoder -vf and mplayer manuals.