V4L(Video For Linux, or Video4Linux):

The V4L API is essentially a kernel interface for analog video capture and output drivers, and is applicable to most video streams that are not related to DVB devices (see explanation below) or graphics cards – though, the V4L API also entails a few oddities such as analog radio and RDS services. Examples of devices which fall within the scope of V4L are, amongst others, webcams, MPEG encoders/decoders, digital video streamers, analog TV tuners and video capture devices.


v4l-utils 是一系列多媒体设备处理包的集合。

v4l-utils 组成

v4l-utils 提供了一系列库和实用工具,用于控制各种多媒体设备。它不仅可以控制我们常见的视频输入输出,还包括红外控制,CEC的控制,无线电控制等等。

v4l-utils 主要包含下面3个库:

  • libv4l 库: 帮助 V4L2 应用处理不同的视频格式, i包括一些比较特殊的webcam模块的格式;
  • libdvbv5库:帮助开发使用 Linux [DVB version 5 API]的DVB 应用;
  • libv4l2rds 库: 帮助开发 RDS 无线电应用;


v4l-utils 包含下面一系列实用程序:

  • DVBv5_Tools: tools to scan, zap and do other neat things with DVB devices;
  • ir-keytable: Dump, Load or Modify ir receiver input tables;
  • ir-ctl: A swiss-knife tool to handle raw IR and to set lirc options;
  • media-ctl: Tool to handle media controller devices;
  • qv4l2: QT v4l2 control panel application;
  • v4l2-compliance: Tool to test v4l2 API compliance of drivers;
  • v4l2-ctl: tool to control v4l2 controls from the cmdline;
  • v4l2-dbg: tool to directly get and set registers of v4l2 devices;
  • v4l2-sysfs-path: checks the media devices installed on a machine and the corresponding device nodes;
  • rds-ctl: tool to handle RDS radio devices;
  • cec-ctl: tool to control CEC devices from the command line;
  • cec-follower: tool used to emulate CEC followers;
  • cec-compliance: tool to test CEC API compliance of drivers and remote CEC devices;
  • xc3028-firmware: Xceive XC2028/3028 tuner module firmware manipulation tool;
  • cx18-ctl: tool to handle cx18 based devices (deprecated in favor of v4l2-ctl);
  • ivtv-ctl: tool to handle ivtv based devices (deprecated in favor of v4l2-ctl);
  • decode_tm6000: ancillary tool to decodes tm6000 proprietary format streams;



  1. 安装

    sudo apt-get install v4l-utils
  2. 列出camera设备

    v4l2-ctl --list-devices
  3. 列出camera支持的配置参数

    v4l2-ctl -d <videoName> --list-ctrls
    v4l2-ctl -d <videoName> -l
    v4l2-ctl -d <videoName> --list-ctrls-menus
    v4l2-ctl -d <videoName> -L
  4. 获取某个配置参数的值

    v4l2-ctl -d <videoName> --get-ctrl=<name>
    v4l2-ctl -d <videoName> -C <name>
  5. 设置某个配置参数的值

    v4l2-ctl -d <videoName> --set-ctrl=<name>=<value>
    v4l2-ctl -d <videoName> -c <name>=<value>
  6. 列出camera支持的格式、分辨率、帧率

    v4l2-ctl -d <videoName> --list-formats-ext
  7. 简单拍摄

    v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --stream-skip=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/data/out.yuv --stream-count=60 --stream-poll
  8. v4l2-ctl 其他功能
    可以通过 v4l2-ctl -h 查看工具的其它参数

  9. 打印 Media Control 拓扑结构

    media-ctl –d /dev/mediaX –p



Linux API version 2 (V4L2 API):



V4L 和 V4L2的差异:

The Video For Linux API was first introduced in Linux 2.1 to unify and replace various TV and radio device related interfaces, developed independently by driver writers in prior years. Starting with Linux 2.5 the much improved V4L2 API replaces the V4L API. The support for the old V4L calls were removed from Kernel, but the library Libv4l Userspace Library supports the conversion of a V4L API system call into a V4L2 one.