0

I want to capture a image through webcam in Linux. So I searched on the Internet and found out it's can be done using mplayer or vlc.

Following is the command for capturing image by mplayer and its corresponding error.

[root@localhost ~]# mplayer -vo png -frames 1 tv://

MPlayer SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <[email protected]>
 comment: first try, more to come ;-)
v4l2: unable to open '/dev/video0': No such file or directory
v4l2: ioctl set mute failed: Bad file descriptor
v4l2: 0 frames successfully processed, 0 frames dropped.


Exiting... (End of file)
[root@localhost ~]# 

Please help me in solving this error. I searched on the net and found out about v4l2, but still can't solve the problem.

[root@localhost ~]# lsusb
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[root@localhost ~]# 

I am using Fedora in VMWare Workstation 9. I wonder if that is the problem.

6
  • On my laptops and desktop I can see my webcam with lsusb. Please paste the output.
    – schaiba
    Commented Sep 17, 2013 at 19:24
  • @schaiba : I have edited the question. PLz check. Commented Sep 17, 2013 at 19:35
  • 3
    sigh Why wouldn't you think it important to say "Oh yeah, I'm running this through a virtual machine, and I haven't set it up to connect to the web cam yet" IN THE FIRST PLACE? Commented Sep 17, 2013 at 19:39
  • I'm sorry. That's all i can say now. Do you know how to solve this problem. Commented Sep 17, 2013 at 19:50
  • Yeah. Configure your VM to connect the webcam. Commented Sep 17, 2013 at 19:51

2 Answers 2

2

For capturing images from webcam, I would suggest Cheese.

If Cheese doesn't solve your problem, it will at least help you debug it easily. Cheese does that: capture image from a webcam. You don't have other thousand functions to interfere with this task.

1
  • 1
    +1 mplayer is a bit low-level for the simple snapshot the OP wants.
    – msw
    Commented Sep 18, 2013 at 2:47
0
sudo apt-get install fswebcam
fswebcam 000.jpg

then check out

fswebcam --help

It is useful enough that you can write a batch script and just have it run repeatedly to do some security camera things with it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .