Hi,
I have a Jetson Orin NX 16GB running R35 (flashed the 5.3.1 SDK).
With a fresh install, I can import cv2 in python3 without any issue. As soon as I install ffmpeg from the nvidia repository (simply by running sudo apt install ffmpeg), I will no longer be able to do the previous import, and will get the following error:
import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/dist-packages/cv2/__init__.py", line 180, in <module>
bootstrap()
File "/usr/lib/python3.8/dist-packages/cv2/__init__.py", line 152, in bootstrap
native_module = importlib.import_module("cv2")
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /usr/lib/aarch64-linux-gnu/libavcodec.so.58: undefined symbol: v4l2_open
Thatâs with a fresh install, and I can see that ffmpeg is coming from the nvidia package repository:
sudo apt install ffmpeg
[...]
Get:1 https://repo.download.nvidia.com/jetson/ffmpeg r35.5/main arm64 ffmpeg arm64 7:4.2.7-nvidia [14.8 MB]
[...]
Preparing to unpack .../ffmpeg_7%3a4.2.7-nvidia_arm64.deb ...
Unpacking ffmpeg (7:4.2.7-nvidia) ...
Replacing files in old package libavcodec-dev:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libavformat-dev:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libavutil-dev:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libswresample-dev:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libswscale-dev:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libavcodec58:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libavformat58:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libavutil56:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libswresample3:arm64 (7:4.2.7-0ubuntu0.1) ...
Replacing files in old package libswscale5:arm64 (7:4.2.7-0ubuntu0.1) ...
Setting up ffmpeg (7:4.2.7-nvidia) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.14) ...
I have tried to install nvidia-opencv, python3-opencv on top of that, but still get the same error. I might be missing something, but it looks like the ffmpeg provided by Nvidia is missing some options when built.
Removing ffmpeg and reinstalling all the ffmpeg libraries (libavformat, libavcodec, libavutil, libswscale, libswresample) solves the python import, but I would need to keep ffmpeg.
Thanks in advance,
Antoine