I have a web camera on my T500 Thinkpad. I would like to know its supported resolutions. Is there a way to find it out by means of software (and without having to consult the documentation)?
5 Answers
If you have video4linux installed try this:
v4l2-ctl -d /dev/video0 --list-formats-ext
Specify your camera device with -d argument, however it can be ommited if you are convinced that there's only one video device connected.
You should get something like:
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'JPEG' (JFIF JPEG, compressed)
Size: Discrete 320x240
Size: Discrete 640x480
Source : How can I list the available video modes for a USB webcam in Linux?
- 3
- 2
- 886
- 7
- 2
Two possible approaches:
Use any software which can interact with the webcam (eg, cheese), save an image and look at the resolution.
Examine the output of lsusb in a terminal, to find a line describing a webcam:
$ lsusb
Bus 001 Device 002: ID 5986:0241 Acer, Inc BisonCam, NB Pro
...
Then use the Bus and Device numbers to get more information on that device:
$ lsusb -s 001:002 -v | egrep "Width|Height"
wWidth 640
wHeight 480
wWidth 1280
wHeight 1024
...
Which should print the height, width pairs the camera is capable of - in this case, 1280x1024 plus some smaller ones.
- 12,647
This is also possible with ffmpeg, which also gives information on the video encoding (e.g. raw vs mjpeg).
ffmpeg -f video4linux2 -list_formats all -i /dev/video0
Example output:
...
[video4linux2,v4l2 @ 0x7fa3a8000b40] Raw : yuyv422 : YUYV 4:2:2 : 640x480 320x240 800x600 1024x600 1024x768 1280x800 1280x1024
[video4linux2,v4l2 @ 0x7fa3a8000b40] Compressed: mjpeg : Motion-JPEG : 640x480 320x240 800x600 1024x600 1024x768 1280x800 1280x1024
...
- 485
If you have gstreamer installed with plugin gstreamer1.0-plugins-base-apps you can use gst-device-monitor-1.0 binary.
$ gst-device-monitor-1.0
example output:
Device found:
name : FHD Camera
class : Video/Source
caps : video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 5/1, 3/1 };
video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)5/1;
video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)20/1;
video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 25/1, 20/1, 15/1, 10/1, 5/1, 1/1 };
image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
properties:
udev-probed = true
device.bus_path = platform-70090000.xusb-usb-0:2.1:1.0
sysfs.path = /sys/devices/70090000.xusb/usb1/1-2/1-2.1/1-2.1:1.0/video4linux/video0
device.bus = usb
device.subsystem = video4linux
device.vendor.id = 1bcf
device.vendor.name = "Sunplus\\x20IT\\x20Co\\x20"
device.product.id = 2286
device.product.name = "FHD\ Camera"
device.serial = Sunplus_IT_Co_FHD_Camera
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video0
v4l2.device.driver = uvcvideo
v4l2.device.card = "FHD\ Camera"
v4l2.device.bus_info = usb-70090000.xusb-2.1
v4l2.device.version = 264588 (0x0004098c)
v4l2.device.capabilities = 2216689665 (0x84200001)
v4l2.device.device_caps = 69206017 (0x04200001)
gst-launch-1.0 v4l2src ! ...
this is especially interesting because it shows possible resolutions and FPS and video-format (e.g. MJPEG/YUY2) required FPS can be reached with.
- 271
This worked for me:
First get the Bus and Device ID:
lsusb
Which will print something like the following:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 011: ID 0ac8:3420 Z-Star Microelectronics Corp. Venus USB2.0 Camera
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
In my case I have the Venus USB2.0 Camera attached. So now I run this command:
lsusb -s 001:011 -v | grep -E "Width|Height"
Which produces the following list:
wWidth 640
wHeight 480
wWidth 352
wHeight 288
wWidth 320
wHeight 240
wWidth 176
wHeight 144
wWidth 160
wHeight 120
wWidth 800
wHeight 600
wWidth 1280
wHeight 960
wWidth 1280
wHeight 1024
wWidth 1600
wHeight 1200
wWidth( 0) 1600
wHeight( 0) 1200
wWidth( 1) 352
wHeight( 1) 288
wWidth( 2) 320
wHeight( 2) 240
wWidth( 3) 176
wHeight( 3) 144
wWidth( 4) 160
wHeight( 4) 120
wWidth( 5) 800
wHeight( 5) 600
wWidth( 6) 1280
wHeight( 6) 960
wWidth( 7) 1280
wHeight( 7) 1024
wWidth( 8) 640
wHeight( 8) 480
Source: raymii.org