Is there a terminal command that lists all the webcams connected to my computer, including the native one? Maybe using ffmpeg package?

  • <<<<< lsusb >>>> – Qasim Sep 22 '13 at 20:33

To list all video devices picked up by the kernel

ls -ltrh /dev/video*

To list all devices attached to USB use lsusb ; to list all devices attached to PCI use lspci

  • 1
    $ ls -ltrh /dev/video* ls: cannot access '/dev/video*': No such file or directory – Mona Jalal Jun 21 '18 at 21:11
  • @MonaJalal That means it couldn’t find any devices. – JMY1000 Jan 25 at 22:23
  • this does not work on my surface pro 3. I can use cheese and it detects my camera just fine but lspci and the command above both do not show information about the webcam hardware. This is especially important because I want to use Kamera which asks to select from a long list. – Joshua Robison Mar 12 at 0:13

v4l2-ctl --list-devices

sudo apt-get install v4l-utils
v4l2-ctl --list-devices

Sample output with a single camera:

Integrated Camera (usb-0000:00:1a.0-1.6):

Tested on Ubuntu 16.04.

More details can be found here: https://stackoverflow.com/questions/4290834/how-to-get-a-list-of-video-capture-devices-web-cameras-on-linux-ubuntu-c

  • 4
    On 16.04.1 error: Failed to open /dev/video0: No such file or directory – Xaqron Jan 3 '17 at 16:41
  • @Xaqron also try installing libv4l-dev if not already installed. Also give computer model if you can. Cheers. – Ciro Santilli 新疆改造中心法轮功六四事件 Jan 3 '17 at 18:00
  • 1
    Just because I keep coming back to this answer, it's now: v4l2-ctl --list-devices. That's lower in the answer but the top in bold text doesn't have the 2. – ksclarke Oct 11 '17 at 16:40
  • 1
    $ v4l2-ctl --list-devices Failed to open /dev/video0: No such file or directory – Mona Jalal Jun 21 '18 at 21:11
  • 1
    this is the correct actual answer. Thank you. – Joshua Robison Mar 12 at 0:15

For Windows you can use the pygrabber library: https://github.com/bunkahle/pygrabber

To check the user friendly names of the connected webcams:

from __future__ import print_function
from pygrabber.dshow_graph import FilterGraph

graph = FilterGraph()

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.