video(4)

video4

Video capture framework

Usage

device video

#include <sys/videoio.h>

Overview

The video framework provides a common interface for video capture devices. It creates /dev/video%d device nodes and handles buffer management, memory mapping, and ioctl dispatch on behalf of hardware drivers.

Userland applications access capture devices through the Video4Linux2 (V4L2) ioctl interface. The framework translates V4L2 requests into driver callbacks, so hardware drivers do not implement ioctls directly.

The following V4L2 ioctls are supported:

  • VIDIOC_QUERYCAP

  • VIDIOC_ENUM_FMT, VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT

  • VIDIOC_ENUM_FRAMESIZES, VIDIOC_ENUM_FRAMEINTERVALS

  • VIDIOC_G_PARM, VIDIOC_S_PARM

  • VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT

  • VIDIOC_QUERYCTRL, VIDIOC_G_CTRL, VIDIOC_S_CTRL

  • VIDIOC_REQBUFS, VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF

  • VIDIOC_STREAMON, VIDIOC_STREAMOFF

Two capture modes are supported:

read

Frames are obtained by calling read(2) on the device node. Streaming starts automatically on the first read.

mmap

Buffers are allocated with VIDIOC_REQBUFS, mapped with mmap(2), and cycled with VIDIOC_QBUF and VIDIOC_DQBUF. Streaming is started and stopped with VIDIOC_STREAMON and VIDIOC_STREAMOFF.

Up to 8 buffers may be allocated per device. Buffer memory remains valid until the last mapping is unmapped, even if the device is closed or detached.

History

The video framework first appeared in FreeBSD 16.0.

Authors

Abdelkader Boudih ⟨[email protected]⟩

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.