My application requires libv4l to be built from source. However, I am having difficulty getting my builds of libv4L2 to use NVIDIA’s v4l2 shared libraries.
I am using Linux for Tegra 28.1
In the Linux for Tegra tools the script “apply_binaries.sh” provides libtegrav4l2.so, libv4l2_nvvidconv.so, and libv4l2_nvvideocode.so. These appear to be necessary for using certain functions of the gpu such as encoding with V4L2. They also appear to be used by NVIDIA’s libv4l shared libary binaries that can be found in the sample rootfs (libv4l2.so, libv4lconvert.so, and etc).
When using NVIDIA’s prebuilt libv4l shared libraries and the shared libraries provided by “apply_binaries.sh” there are no problems. However, when using a self built version of libv4l and the shared libraries provided by “apply_binaries.sh” the video devices cannot be opened due to ioctl errors.
I looked in the sample root file system sources for the libv4l source that allowed NVIDIA’s v4l2 extensions to be loaded. However, the source provided is identical to the matching version upstream (SHA256 sums of the tarballs match).
Are there modifications to libv4l source that allow libtegrav4l2.so, libv4l2_nvvidconv.so, and libv4l2_nvvideocode.so to be loaded? If so where can they be found?
Hi,
Please install tegra_multimedia_api via Jetpack and follow the samples to work out your usecases.
Hi Dane,
Thanks for your help. I have already successfully used the examples from the tegra_multimedia_api. Additionally, the custom application works as well. In both cases the applications work when using prebuilt libV4L binaries, and the NVIDIA V4L2 proprietary extensions. However, the extensions do not work when using libV4L binaries built from the libV4L source provided by NVIDIA.
How can libV4L be built from the source provided while while maintaining compatibility with the NVIDIA V4L2 extensions as the prebuilt versions have?
As far as I can tell, there must be a patch to libV4L, build configuration, or something else that makes this possible. The source provided is identical to the upstream version which means the binaries built with it are not aware of the NVIDIA V4L2 extensions and thus do not work with them. As of yet, I have not been able to find any documentation, patch files, or build configurations that I can use to perform the necessary modifications to libV4L.
The source I’m referring to can be downloaded from [url]https://developer.nvidia.com/embedded/linux-tegra-r281[/url] under the link “Sample Root File System Sources”. Inside the archive there is a file “v4l-utils_1.10.0.orig.tar.bz2” which I believe is the source NVIDIA is providing for the prebuilt libV4L binaries distributed with the Sample Root File System.
Hi,
libv4l2.so is installed via ‘sudo apt-get install libv4l-dev’. We don’t have any patch on it.
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.38-tegra aarch64)
* Documentation: https://help.ubuntu.com/
624 packages can be updated.
320 updates are security updates.
Last login: Fri Jun 15 07:12:15 2018
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
nvidia@tegra-ubuntu:~$ ls -all /usr/lib/aarch64-linux-gnu/libv4l2.so
ls: cannot access '/usr/lib/aarch64-linux-gnu/libv4l2.so': No such file or directory
nvidia@tegra-ubuntu:~$ sudo apt-get update
[sudo] password for nvidia:
Hit:1 http://ports.ubuntu.com/ubuntu-ports xenial InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports xenial-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease
Reading package lists... Done
nvidia@tegra-ubuntu:~$ sudo apt-get install libv4l-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
apt-clone archdetect-deb dmeventd dmraid dpkg-repack gir1.2-timezonemap-1.0
gir1.2-xkl-1.0 kpartx kpartx-boot libappstream3 libdebian-installer4
libdevmapper-event1.02.1 libdmraid1.0.0.rc16 liblockfile-bin liblockfile1
liblvm2app2.2 liblvm2cmd2.02 libparted-fs-resize0 libreadline5
lockfile-progs lvm2 os-prober pmount python3-icu python3-pam rdate
ubiquity-casper ubiquity-ubuntu-artwork
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libv4l2rds0
The following NEW packages will be installed:
libv4l-dev libv4l2rds0
0 upgraded, 2 newly installed, 0 to remove and 618 not upgraded.
Need to get 112 kB of archives.
After this operation, 502 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ports.ubuntu.com/ubuntu-ports xenial/main arm64 libv4l2rds0 arm64 1.10.0-1 [14.8 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports xenial/main arm64 libv4l-dev arm64 1.10.0-1 [97.7 kB]
Fetched 112 kB in 3s (33.9 kB/s)
Selecting previously unselected package libv4l2rds0:arm64.
(Reading database ... 149092 files and directories currently installed.)
Preparing to unpack .../libv4l2rds0_1.10.0-1_arm64.deb ...
Unpacking libv4l2rds0:arm64 (1.10.0-1) ...
Selecting previously unselected package libv4l-dev:arm64.
Preparing to unpack .../libv4l-dev_1.10.0-1_arm64.deb ...
Unpacking libv4l-dev:arm64 (1.10.0-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Setting up libv4l2rds0:arm64 (1.10.0-1) ...
Setting up libv4l-dev:arm64 (1.10.0-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
nvidia@tegra-ubuntu:~$ ls -all /usr/lib/aarch64-linux-gnu/libv4l2.so
lrwxrwxrwx 1 root root 16 Jan 24 2016 /usr/lib/aarch64-linux-gnu/libv4l2.so -> libv4l2.so.0.0.0
Not sure but it seems like your self-built libv4l2.so is not same as the installed one via ‘sudo apt-get install libv4l-dev’
Thanks, that lead me down the path to get to the bottom of the issue.
LibV4L has a plugin loading system that loads additional shared libraries at runtime through dlopen. It expects the plugins to be in a directory that is hardcoded at build time. This is how the NVIDIA V4L2 extensions are being loaded.
The libV4L from apt get was defaulting to: ‘/usr/lib/aarch64-linux-gnu/libv4l/plugins’ (which is where apply_binaries.sh was putting the NVIDIA V4L2 extensions).
The libV4L from upstream source was defaulting to:‘/usr/local/lib/libv4l/plugins’.
Placing the NVIDIA libv4l extensions into the expected folder solved the issue. The plugin directory could also be changed by changing the build configuration. That is probably what was done to the version retrieved via apt-get.
Thanks again.
Good to hear that and thanks for sharing the finding.
As of 32.2.1, this seems to no longer be the case. There is a binary for libv4l.so.0.0.999999 in nv_tegra/nv_drivers.tbz2 in the l4t distribution, while the ubuntu package contains libv4l.so.0.0.0 (see here: Ubuntu – File list of package libv4l-0/bionic/arm64)
is the source for this version of libv4l available somewhere?