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 <olschewski@zpr.uni-koeln.de>
 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.

  • On my laptops and desktop I can see my webcam with lsusb. Please paste the output. – schaiba Sep 17 '13 at 19:24
  • @schaiba : I have edited the question. PLz check. – user2788859 Sep 17 '13 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? – Ignacio Vazquez-Abrams Sep 17 '13 at 19:39
  • I'm sorry. That's all i can say now. Do you know how to solve this problem. – user2788859 Sep 17 '13 at 19:50
  • Yeah. Configure your VM to connect the webcam. – Ignacio Vazquez-Abrams Sep 17 '13 at 19:51

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 mplayer is a bit low-level for the simple snapshot the OP wants. – msw Sep 18 '13 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.