Working with UVC devices

Commands and sample responses

List devices

Command

v4l2-ctl --list-devices

Sample response

This is from a post-2018 Logitech C922

C922 Pro Stream Webcam (usb-0000:00:0c.0-1):
        /dev/video0
        /dev/video1
        /dev/media0

List supported formats

Command

v4l2-ctl -d /dev/video0 --list-formats

Sample response

This is from a post-2018 Logitech C922

ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'YUYV' (YUYV 4:2:2)
        [1]: 'MJPG' (Motion-JPEG, compressed)

Frequently asked questions

How do I get H.264 output from my Logitech C920 / C922 camera?

In 2012 the Logitech C920 camera was able to output a 1080P H.264 stream without using the host CPU. The C922 was also able to do this up until some point in 2018. Logitech has now dropped the hardware H.264 encoder in favor of encoding video on the host CPU.

Unfortunately the cameras were not renamed so if you bought one of these cameras you’ll have to check its capabilities in order to find out which one you have.

A camera with a hardware encoder will report these supported formats:

ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUV 4:2:2 (YUYV)
  
        Index       : 1
        Type        : Video Capture
        Pixel Format: 'H264' (compressed)
        Name        : H.264
 
        Index       : 2
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : MJPEG

A camera without a hardware encoder will report these supported formats:

ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'YUYV' (YUYV 4:2:2)
        [1]: 'MJPG' (Motion-JPEG, compressed)

This is problematic for Logitech camera owners because they’ll find a lot of articles telling them to use format 1 to get H.264 encoded video straight out of the camera. But if you have a newer camera the output will be motion JPEG instead. This will break certain configurations you’ll find for common capture applications (e.g. motion

Additional references about this change: