Check USB camera supported output format on Linux

Pete Houston
Dec 23, 2015 · 1 min read

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.

Code / Design / Love @

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade