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