Linux – Understanding webcam ‘s Linux device drivers

cameradriverslinuxv4l

As far as I know, device driver is a part of SW that is able to communicate with a particular type of device that is attached to a computer.

In case of a USB webcam, the responsible driver is UVC that supports any UVC compliant device. This means that enables OS or other computer program to access hardware functions without needing to know precise details of the hardware being used.

For this reason, I installed UVC Linux device driver by running:

opkg install kernel-module-uvcvideo

Webcam has been recognised by Linux kernel: dev/video0. However, I still wasn't able to perform video streaming with FFmpeg, as I was missing V4L2 API. I installed V4L2, by configuring kernel.

My queries are:

  • How UVC driver and V4L2 are linked together?
  • What is the purpose of V4L2 API?
  • If I haven't installed UVC first, it would be installed with V4L2?

LinuxTV refers: The uvcvideo driver implementation is adherent only to the V4L2 API. This means that UVC is part of V4L2 API?

Best Answer

The USB video class (UVC) is a specification to which USB webcams, etc., are supposed to conform. This way, they can be used on any system which implements support for UVC compliant devices.

V4L2 is the linux kernel video subsystem upon which the linux UVC implementation depends. In other words, in the kernel UVC support requires V4L2, but not the other way around.

The V4L2 API refers to a userspace programming interface, documented here.

Related Question