Guilherme Longo
Guilherme Longo

Reputation: 2308

How to detect which pixel format my webcam supports?

I am writing a C application that capture video from my webcam. I am not able to determine which pixel format my webcam is able to process.

lsusb:

Bus 002 Device 003: ID 1e4e:0100 Cubeternet WebCam

dmesg

[ 1064.735472] usb 2-1.4: new high speed USB device using ehci_hcd and address 4
[ 1064.837577] usb 2-1.4: New USB device found, idVendor=1e4e, idProduct=0100
[ 1064.837583] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1064.837587] usb 2-1.4: Product: USB2.0 Camera
[ 1064.837589] usb 2-1.4: Manufacturer: Etron Technologies
[ 1064.837715] usb 2-1.4: configuration #1 chosen from 1 choice
[ 1064.838484] uvcvideo: Found UVC 1.00 device USB2.0 Camera (1e4e:0100)
[ 1064.843070] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ 1064.844229] input: USB2.0 Camera as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0/input/input7

I was able to determine the image size '640x480' but not the pixel format: I have tried

YUV420 RGB565 RGB32

with no success. Any help Please. I am using Debian latest version

Upvotes: 2

Views: 8404

Answers (2)

J.M.
J.M.

Reputation: 622

You can use:

v4l2-ctl --list-formats 

That should give you the supported pixel formats

In addition, you can also use:

v4l2-ctl --list-formats-ext

which should give you the supported pixel formats a resolutions.

Upvotes: 1

Fanglin
Fanglin

Reputation: 2192

Since it is a UVC video, by looking up the wiki here:

http://www.wikiwand.com/en/USB_video_device_class

You will see that UVC supports

Uncompressed YUV formats YUY2, NV12.

Actually YUY2 is also called YUYV which is YUV 4:2:2.

You can find a conversion to RGB here:

https://bitbucket.org/neuralassembly/simplewebcam/src/a940256eda0d/jni/ImageProc.h

Upvotes: 1

Related Questions