opencv_contrib
opencv_contrib copied to clipboard
jetson orin nano 8g : cap = cv2.cudacodec.createVideoReader(file_path) cv2.error: OpenCV(4.10.0) /home/nvidia/nvidia-codec/opencv_contrib-4.10.0/modules/cudacodec/src/video_reader.cpp:190: error: (-217:Gpu API call) Unknown error code [Code = 520480200] in function 'VideoReaderImpl'
cap = cv2.cudacodec.createVideoReader(file_path)
cv2.error: OpenCV(4.10.0) /home/nvidia/nvidia-codec/opencv_contrib-4.10.0/modules/cudacodec/src/video_reader.cpp:190: error: (-217:Gpu API call) Unknown error code [Code = 520480200] in function 'VideoReaderImpl'
this my sh
#!/bin/bash
#rm -rf opencv-4.10.0/build/
#rm -rf opencv-4.10.0/install/
sudo apt-get update
sudo apt install -y \
build-essential \
pkg-config \
libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libxvidcore-dev \
libx264-dev \
libjpeg-dev \
libtiff5-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
libvtk7-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libjpeg8-dev \
libpng-dev \
libdc1394-22-dev \
libxine2-dev \
libtbb-dev \
libatlas-base-dev \
libfaac-dev \
libmp3lame-dev \
libtheora-dev \
libvorbis-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
x264 \
v4l-utils \
libtbb2
BASE_DIR=$(pwd)
OPENCV_DIR="${BASE_DIR}/opencv-4.10.0"
INSTALL_DIR="${OPENCV_DIR}/install"
BUILD_DIR="${OPENCV_DIR}/build"
CONTRIB_DIR="${BASE_DIR}/opencv_contrib-4.10.0"
mkdir -p "${INSTALL_DIR}"
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-D OPENCV_EXTRA_MODULES_PATH="${CONTRIB_DIR}/modules" \
-D WITH_LIBV4L=ON \
-D CUDA_ARCH_BIN=8.7 \
-D WITH_CUDA=ON \
-D WITH_CUDACODEC=ON \
-D OPENCV_DNN_CUDA=ON \
-D WITH_CUFFT=ON \
-D WITH_IPP=ON \
-D WITH_EIGEN=ON \
-D CUDA_SDK_ROOT_DIR=/usr/local/cuda \
-D CUDNN_LIBRARY=/usr/lib/aarch64-linux-gnu/libcudnn.so.8 \
-D CUDNN_INCLUDE_DIR=/usr/include \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUBLAS=ON \
-D WITH_NVCUVID=ON \
-D WITH_TBB=ON \
-D WITH_OPENMP=ON \
-D WITH_OPENGL=ON \
-D ENABLE_CXX11=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D CUDA_nppi_LIBRARY=true \
-D OPENCV_GENERATE_PKGCONFIG=YES \
-D ENABLE_PRECOMPILED_HEADERS=OFF \
-D WITH_GSTREAMER=ON \
-D WITH_FFMPEG=ON ..
make -j$(nproc)
make install
Did you copy the Nvidia Video Codec SDK stub libraries into a directory on your path? See https://github.com/opencv/opencv_contrib/issues/3362 https://github.com/opencv/opencv_contrib/issues/3770 https://github.com/opencv/opencv_contrib/issues/3411
Did you copy the Nvidia Video Codec SDK stub libraries into a directory on your path? See #3362 #3770 #3411
The method I am using
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/nvidia/nvidia-codec/Video_Codec_SDK_12.0.16/Video_Codec_SDK_12.0.16/Lib/linux/stubs/aarch64/
The libraries in /home/nvidia/nvidia-codec/Video_Codec_SDK_12.0.16/Video_Codec_SDK_12.0.16/Lib/linux/stubs/aarch64/ are stubs (for building on systems which don't have the Nvidia driver installed), you do not want those loaded at runtime. You want the library which comes as part of your driver to be loaded. If that is on your path already you don't need to do anything and it should be picked up during your build. i.e. don't export LD_...
The libraries in /home/nvidia/nvidia-codec/Video_Codec_SDK_12.0.16/Video_Codec_SDK_12.0.16/Lib/linux/stubs/aarch64/ are stubs (for building on systems which don't have the Nvidia driver installed), you do not want those loaded at runtime. You want the library which comes as part of your driver to be loaded. If that is on your path already you don't need to do anything and it should be picked up during your build. i.e. don't export LD_...
I installed the Jetson system and all the software using SDK Manager, but I couldn't find the library. How should I install it Is video sdk not supported on the Jetson platform ?
I don't know if the Nvidia Video Codec SDK is compatible with Jetson and I don't have one to test on. All the documentation i can find mentions ffmpeg and Gstreamer but they might be using a different Jetson specific API to access hardware acceleration.
If it is then
which libnvcuvid.so
may return the location of the decoding library.
Either way if the output of
ldd <YOUR_EXECUTABLE> | grep nvcuvid
is the location of your stub library its not going to work.
The libraries in /home/nvidia/nvidia-codec/Video_Codec_SDK_12.0.16/Video_Codec_SDK_12.0.16/Lib/linux/stubs/aarch64/ are stubs (for building on systems which don't have the Nvidia driver installed), you do not want those loaded at runtime. You want the library which comes as part of your driver to be loaded. If that is on your path already you don't need to do anything and it should be picked up during your build. i.e. don't export LD_...
I installed the Jetson system and all the software using SDK Manager, but I couldn't find the library. How should I install it Is video sdk not supported on the Jetson platform ?
Hi, I met the same problem as you, have you found a solution?
Hi, I met the same problem as you, have you found a solution?
If you have a Jetson, find out if the Video Codec SDK is supported there, if so link against it if not the cudacodec module won't work on your platform.
Hi, I met the same problem as you, have you found a solution?
If you have a Jetson, find out if the Video Codec SDK is supported there, if so link against it if not the
cudacodecmodule won't work on your platform.
maybe not. See https://github.com/NVIDIA/VideoProcessingFramework/pull/515