Check USB camera supported output format on Linux

Pete Houston
1 min readDec 23, 2015

--

On Linux, v4l-utils is one excellent tool for camera debugging, and it can help to check USB camera information.

First, plugin the USB camera and make sure it is recognized on system,

$ ls /dev/video*

if it outputs the list of /dev/video* device, it means good.

To query the supported output format of the camera, we use v4l2-ctl,

$ v4l2-ctl — list-formatsioctl: VIDIOC_ENUM_FMTIndex : 0Type : Video CapturePixel Format: ‘YUYV’Name : YUV 4:2:2 (YUYV)Index : 1Type : Video CapturePixel Format: ‘H264’ (compressed)Name : H.264Index : 2Type : Video CapturePixel Format: ‘MJPG’ (compressed)Name : MJPEG

So, in the example above, the camera supports in three different formats. To get more details about resolution and frame, issue this command.

$ v4l2-ctl — list-formats-ext
Index : 1
Type : Video Capture
Pixel Format: ‘H264’ (compressed)
Name : H.264
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)

Now you can determine what your camera is capable of.

--

--