[V4L2_Utils]1,How to use v4l-utils

v4l-utils provides a series of utilities for media devices, allowing to handle the proprietary formats available at most webcams (libv4l), and providing tools to test V4L devices.

v4l-utils为媒体设备提供了一系列实用程序,允许处理大多数网络摄像头(libv4l)可用的专有格式,并提供工具来测试V4L设备。

NOTE:交叉编译时,不要用apt-get的aarch64-linux-gnu交叉编译工具链,重新到linaro的官网去下载。


1 Install v4l-utils

sudo apt install v4l-utils

Download (HTTP):https://www.linuxtv.org/downloads/v4l-utils/
Download MD5 sum: 18996bd5e9d83d47055c05de376708cd
Download size: 1.9 MB
Estimated disk space required: 97 MB

2 Build Guildline

-------------
* make and a C and C++ compiler
* optionally libjpeg v6 or later
* optionally Qt5 for building qv4l2

Building:
---------

If you checked out the source repository you need to install the autotools
environment and gettext first.

The autotools/gettext should be updated to the version that are shipped
on your distro. This can be done by running:
	$ ./bootstrap.sh

Then you need to configure any any desired options with:
	$ ./configure

You can get a summary of possible configurations via the --help option.
If used without arguments, it will set the install prefix to /usr/local/.

After configuration you need to start the build process with:
	$ make

Installing:
-----------

To install it at the prefix configured by ./configure, do, as root:
	# make install

Note that v4l-utils' "make install" supports DESTDIR for installing into
a build root for example:
	# make install DESTDIR=/mnt/sysimage

Cross Compiling:
----------------

Cross compiling has been tested with the Code Sourcery and Linaro ARM Linux
toolchain.

To cross compile with the Code Sourcery toolchain run the following commands:

export PATH=/opt/arm-2009q3/bin:$PATH
export PKG_CONFIG_LIBDIR=/path/to/cross/root/lib
./configure --host=arm-none-linux-gnueabi --without-jpeg
make

To cross compile with the Linaro toolchain run the following commands:

export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin:$PATH
export PKG_CONFIG_LIBDIR=/path/to/cross/root/lib
./configure --host=arm-linux-gnueabihf --without-jpeg
make

Building static binaries:
-------------------------

There are two options in building static binaries: either fully static or
dynamically linking to system shared libraries while statically linking
libraries that are a part of v4l-utils.

In either case, building static binaries requires telling pkg-config the
static libraries will be needed, and telling configure to disable building
of shared libraries. This way system libraries will still be linked
dynamically:

	$ PKG_CONFIG="pkg-config --static" ./configure --disable-shared

Fully static binares can be built by further setting LDFLAGS for the
configure:

	$ PKG_CONFIG="pkg-config --static" LDFLAGS="--static -static" \
	  ./configure --disable-shared

Note that this requires static variants of all the libraries needed for
linking which may not be available in all systems.

Android Cross Compiling and Installing:
----------------

v4l-utils will only build using the complete AOSP source tree, because of the
stlport dependency.

List of v4l-utils that supply an Android.mk makefile:
* utils/v4l2-compliance
* utils/v4l2-ctl
* utils/v4l2-dbg

To cross compile an utility you must first configure the shell with Android's
envsetup.sh to add the mm alias, before running lunch to select your target
device.

cd /path/to/aosp
source build/envsetup.sh
lunch
cd /path/to/v4l-utils
cd <utility>
mm

Output binary will be located in the Android out directory, below the
target/product/<name>/system/bin/<v4l-utils executable name> path.

The binary executable can be pushed to the target Android device using
adb push <v4l-utils executable> /system/bin

附上我的尝试:

export PATH=/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin:$PATH
export PKG_CONFIG_LIBDIR=/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/lib
./configure --host=aarch64-linux-gnu --prefix=/opt/v4l2/v4l2-utils
make
sudo make install

用file到上面的prefix目录里看一下,如果是ARM aarch64则交叉编译成功
在这里插入图片描述

3 Short Descriptions

  • cx18-ctl is a tool to handle cx18 based devices.

  • decode_tm6000 decodes multiplexed formats from TM5600/TM6000 USB devices.

  • dvb-fe-tool is a command line tool for digital TV services.

  • dvb-format-convert is a tool meant to convert among different file formats. It is compliant with version 5 of the DVB API.

  • dvbv5-scan is a command line frequency scanning tool for digital TV services that are compliant with version 5 of the DVB API.

  • dvbv5-zap is a command line tuning tool for digital TV services that is compliant with version 5 of the DVB API.

  • ir-keytable is a tool that lists the Remote Controller devices, allows one to get/set IR keycode/scancode tables, test events generated by IR, and to adjust other Remote Controller options.

  • ivtv-ctl is a utility that can control many card settings, like changing the inputs from tuner to svideo or composite, setting video resolution or changing video mode (PAL, SECAM, NTSC).

  • media-ctl is a utility used to configure V4L2 devices.

  • qv4l2 is used to test video4linux capture devices.

  • rds-ctl is a utility for decoding raw RDS data from V4L2 Radio devices and offers simple ways to access the received RDS information.

  • v4l2-compliance is a compliance test tool.

  • v4l2-ctl is a tool to control v4l2 controls from the cmdline.

  • v4l2-dbg is a 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.


Q1: fatal error: X11/Xlib.h: No such file or directory

A1: 缺少相应的库支持

For Centos:

sudo yum install libXt-devel

For Ubuntu:

sudo apt-get install libghc-x11-dev

参考文献:
1 man V4L2-CTL howto
http://rpm.pbone.net/index.php3/stat/45/idpl/31475743/numer/1/nazwa/v4l2-ctl
2 Introduction to v4l-utils
http://www.linuxfromscratch.org/blfs/view/cvs/multimedia/v4l-utils.html
3 v4l-utils.git/tree/INSTALL
https://git.linuxtv.org//v4l-utils.git/tree/INSTALL

要下载和安装 `v4l2-utils` 工具,可以按照以下步骤进行操作: ### 下载 `v4l2-utils` 1. 访问官方下载页面: ``` http://www.linuxtv.org/downloads/v4l-utils/ ``` 在此页面上,可以选择适合的版本进行下载,例如 `v4l-utils-0.8.5.tar.bz2` 或更高版本。 2. 使用 `wget` 命令直接下载: ``` wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-1.26.1.tar.bz2 ``` ### 安装 `v4l2-utils` 1. 解压下载的压缩包: ``` tar -xvf v4l-utils-1.26.1.tar.bz2 ``` 2. 进入解压后的目录: ``` cd v4l-utils-1.26.1 ``` 3. 编译并安装: - 如果是本地编译(非交叉编译),可以使用以下命令: ``` make sudo make install ``` - 如果需要进行交叉编译(例如针对 ARM 平台),可以参考以下步骤: 1. 设置交叉编译环境,例如使用 `Poky` 工具链: ``` source /opt/poky/5.0.1/environment-setup-cortexa57-poky-linux ``` 2. 创建编译目录并进入: ``` mkdir build && cd build ``` 3. 使用 `meson` 配置交叉编译环境: ``` meson --cross-file=../meson_cross_file.txt .. ``` 4. 编译并安装: ``` ninja DESTDIR=../install ninja install ``` ### 验证安装 安装完成后,可以通过以下命令验证 `v4l2-ctl` 是否安装成功: ``` v4l2-ctl --version ``` 这将显示当前安装的 `v4l2-utils` 版本信息。 ### 常见问题 1. **依赖问题**:在安装过程中,如果提示缺少依赖库,可以使用 `apt-get` 安装相关依赖,例如: ``` sudo apt-get install libjpeg62 libjpeg62-dev ``` 2. **交叉编译工具链问题**:如果遇到交叉编译工具链路径错误,确保工具链已正确安装,并且路径配置正确。例如: ``` sudo ./aarch64-himix100-linux.install ``` 3. **Meson 版本问题**:如果遇到 `meson` 相关错误,可以尝试更新或安装特定版本的 `meson`: ``` pip3 install meson==0.62 ``` 通过上述步骤,可以成功下载并安装 `v4l2-utils` 工具[^5]。
评论 7
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山猫Show

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值