Skip to main content
Version: BSP 6.x.y

Webcam (Linux)

Introduction

Linux kernel drivers for regular USB Video Class (UVC) Webcam devices are enabled in our BSP Layers and we provide a Reference Multimedia Image with a graphical back-end, GStreamer and Video4Linux2 (V4L2).

The driver exports the webcam through the Video4Linux2 (V4L2) API. User-space video utilities such as GStreamer can be used to display or store the video stream.

For supported UVC compatible webcams have a look at www.ideasonboard.org/uvc.

Here is an excerpt of kernel log after a webcam is plugged in:

[30262.107825] usb 1-1.2: new high-speed USB device number 5 using xhci-hcd
[30264.475698] uvcvideo: Found UVC 1.00 device C922 Pro Stream Webcam (046d:085c)
[30264.485550] input: C922 Pro Stream Webcam as /devices/platform/32f10108.usb/38200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1.2/1-1.2:1.0/input/input4

GStreamer and Video4Linux2

Installation

GStreamer comes pre-installed in the Reference Multimedia Image.

You must Build a Reference Image with Yocto Project/OpenEmbedded if you want to add or remove packages from the image. In any case, you must customize the reference images as they are not production-ready.

If you don't want to do a custom OpenEmbedded build, consider using Torizon, where you can install libraries and packages inside Debian Containers with commands as apt install. Have a look at our collection of Multimedia, Camera and Video Processing articles for Torizon.

How to Use

Most likely, for the basics you won't need to run any V4L2, and you can focus on searching how to capture video from a webcam using a GStreamer pipeline.

Both the GStreamer documentation and the SoC vendor documentation are good places to look for examples. For instance, the NXP i.MX Linux User's Guide has a section dedicated to webcam usage. Please refer to our article Video Encoding and Playback (Linux) to find instructions on how to access the GStreamer and the NXP documentation.



Send Feedback!