NVIDIA VIDEO CODEC SDK 下载地址
注意查看需要的环境要求,有显卡驱动的要求和cuda的要求,因为我的环境,所以我选择10.0.26版本。
解压zip文件后:
cd Video_Codec_SDK_10.0.26/Samples
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
报错:
make时候报错:
-- Could NOT find Vulkan (missing: Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
-- Checking for module 'vulkan'
-- No package 'vulkan' found
解决办法:
sudo apt-get install libvulkan-dev
下载opencv3.4.16
下载opencv-contrib3.4.16
均下载zip包即可,然后进行解压
cd opencv-3.4.16
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D ENABLE_PRECOMPILED_HEADERS=OFF \
-D WITH_CUDA=ON \
-D WITH_CUDNN=ON \
-D ENABLE_FAST_MATH=1 \
-D CUDA_ARCH_BIN=7.5 \
-D WITH_CUBLAS=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_OPENGL=ON \
-D WITH_V4L=ON \
-D WITH_FFMPEG=ON \
-D WITH_NVCUVID=ON \
-D WITH_GTK_2_X=ON \
-D HAVE_FFMPEG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.16/modules \
-D CUDNN_INCLUDE_DIR=/usr/local/include \
-D CUDNN_LIBRARY=/usr/lib/x86_64-linux-gnu/libcudnn.so.8.2.2
-D WITH_LIBV4L=ON ..
make -j8
sudo make install
有几点需要注意:
-D CMAKE_INSTALL_PREFIX=/usr/local
是指定后续make install的安装位置
-D CUDA_ARCH_BIN=7.5
是指定显卡算力,因为我的显卡是2060,根据算力表可以得出
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-4.5.4/modules
是指定opencv-contrib
的位置
-D CUDNN_INCLUDE_DIR=/usr/local/include \ -D CUDNN_LIBRARY=/usr/lib/x86_64-linux-gnu/libcudnn.so.8.2.2 ..
用于指定cudnn位置,但是好像并没有卵用= =
生成的cmake信息:
-- Detected processor: x86_64
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
CMake Warning (dev) at /usr/local/share/cmake-3.18/Modules/FindOpenGL.cmake:305 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
cmake/OpenCVFindLibsGUI.cmake:101 (find_package)
CMakeLists.txt:700 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: /home/zty/opencv-3.4.16/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: /home/zty/opencv-3.4.16/build/3rdparty/ippicv/ippicv_lnx/iw
-- CUDA detected: 10.2
-- CUDA: Using CUDA_ARCH_BIN=7.5
-- CUDA NVCC target flags: -gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY)
-- A library with LAPACK API found.
-- Found VTK 6.3.0 (/usr/lib/cmake/vtk-6.3/UseVTK.cmake)
-- OpenCV Python: during development append to PYTHONPATH: /home/zty/opencv-3.4.16/build/python_loader
-- freetype2: YES (ver 21.0.15)
-- harfbuzz: YES (ver 1.7.2)
-- Module opencv_ovis disabled because OGRE3D was not found
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
-- Checking for module 'tesseract'
-- No package 'tesseract' found
-- Tesseract: NO
-- Allocator metrics storage type: 'long long'
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
--
-- General configuration for OpenCV 3.4.16 =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): /home/zty/opencv_contrib-3.4.16/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2021-11-17T02:35:26Z
-- Host: Linux 5.4.0-90-generic x86_64
-- CMake: 3.18.20200608-geec2e9b
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (16 files): + SSSE3 SSE4_1
-- SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (6 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (30 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++11: YES
-- C++ Compiler: /usr/bin/c++ (ver 7.5.0)
-- C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: m pthread /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda-10.2/lib64 -L/usr/lib/x86_64-linux-gnu
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cvv java matlab ovis
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- GTK+: YES (ver 2.24.32)
-- GThread : YES (ver 2.56.4)
-- GtkGlExt: YES (ver 1.2.0)
-- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so)
-- VTK support: YES (ver 6.3.0)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2_2)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
--
-- Video I/O:
-- DC1394: YES (ver 2.2.5)
-- FFMPEG: YES
-- avcodec: YES (ver 58.91.100)
-- avformat: YES (ver 58.45.100)
-- avutil: YES (ver 56.51.100)
-- swscale: YES (ver 5.7.100)
-- avresample: YES (ver 4.0.0)
-- GStreamer: YES
-- base: YES (ver 1.14.5)
-- video: YES (ver 1.14.5)
-- app: YES (ver 1.14.5)
-- riff: YES (ver 1.14.5)
-- pbutils: YES (ver 1.14.5)
-- libv4l/libv4l2: NO
-- v4l/v4l2: linux/videodev2.h
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2020.0.0 Gold [2020.0.0]
-- at: /home/zty/opencv-3.4.16/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2020.0.0)
-- at: /home/zty/opencv-3.4.16/build/3rdparty/ippicv/ippicv_lnx/iw
-- Lapack: NO
-- Eigen: YES (ver 3.3.7)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
-- NVIDIA GPU arch: 75
-- NVIDIA PTX archs:
--
-- OpenCL: YES (no extra features)
-- Include path: /home/zty/opencv-3.4.16/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.17)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.17)
-- numpy: /home/zty/.local/lib/python2.7/site-packages/numpy/core/include (ver 1.16.6)
-- install path: lib/python2.7/dist-packages/cv2/python-2.7
--
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.6.9)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (ver 3.6.9)
-- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
-- install path: lib/python3.6/dist-packages/cv2/python-3.6
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: NO
-- JNI: /usr/lib/jvm/java-1.8.0-openjdk-amd64/include /usr/lib/jvm/java-1.8.0-openjdk-amd64/include/linux /usr/lib/jvm/java-1.8.0-openjdk-amd64/include
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zty/opencv-3.4.16/build
报错:
fatal error: nvcuvid.h: 没有那个文件或目录
解决办法:
Video_Codec_SDK_10.0.26/interface/ 下面的cuviddec.h 和 nvcuvid.h文件拷贝到/usr/include下面
wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz
tar -zxvf ffmpeg-3.1.tar.gz
cd ffmpeg-3.1
./configure --prefix=/usr/local --enable-avdevice --enable-indev=v4l2 --enable-libv4l2 --enable-shared --disable-static
make && make install
vim /etc/ld.so.conf.d/ffmpeg.conf
#在下面加入
#/usr/local/lib此为ffmpeg安装的库的路径
sudo ldconfig
报错:
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
解决办法:
sudo apt-get install yasm
终端输入ffmpeg能有以下输出则成功:
zty@zty-NH5x-7xRCx-RDx:~$ ffmpeg
ffmpeg version N-85095-g22b0daa1b3 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr/local --enable-avdevice --enable-indev=v4l2 --enable-libv4l2 --enable-shared
libavutil 55. 59.100 / 55. 59.100
libavcodec 57. 90.100 / 57. 90.100
libavformat 57. 72.100 / 57. 72.100
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 83.100 / 6. 83.100
libswscale 4. 7.100 / 4. 7.100
libswresample 2. 8.100 / 2. 8.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
运行gpu的demo:
#include
#include "opencv2/opencv_modules.hpp"
// #if defined(HAVE_OPENCV_CUDACODEC)
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc, const char* argv[])
#include
#include "opencv2/opencv_modules.hpp"
// #if defined(HAVE_OPENCV_CUDACODEC)
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc, const char* argv[])
{
// if (argc != 2)
// return -1;
const std::string fname = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
// const std::string fname(argv[1]);
cv::namedWindow("CPU", cv::WINDOW_NORMAL);
cv::namedWindow("GPU", cv::WINDOW_OPENGL);
cv::cuda::setGlDevice();
cv::Mat frame;
cv::VideoCapture reader(fname);
cv::cuda::GpuMat d_frame;
cv::Ptr<cv::cudacodec::VideoReader> d_reader = cv::cudacodec::createVideoReader(fname);
// TickMeter tm;
std::vector<double> cpu_times;
std::vector<double> gpu_times;
for (;;)
{
// tm.reset(); tm.start();
if (!reader.read(frame))
break;
// tm.stop();
// cpu_times.push_back(tm.getTimeMilli());
// tm.reset(); tm.start();
if (!d_reader->nextFrame(d_frame))
break;
// tm.stop();
// gpu_times.push_back(tm.getTimeMilli());
cv::imshow("CPU", frame);
cv::imshow("GPU", d_frame);
if (cv::waitKey(3) > 0)
break;
}
if (!cpu_times.empty() && !gpu_times.empty())
{
std::cout << std::endl << "Results:" << std::endl;
std::sort(cpu_times.begin(), cpu_times.end());
std::sort(gpu_times.begin(), gpu_times.end());
double cpu_avg = std::accumulate(cpu_times.begin(), cpu_times.end(), 0.0) / cpu_times.size();
double gpu_avg = std::accumulate(gpu_times.begin(), gpu_times.end(), 0.0) / gpu_times.size();
std::cout << "CPU : Avg : " << cpu_avg << " ms FPS : " << 1000.0 / cpu_avg << std::endl;
std::cout << "GPU : Avg : " << gpu_avg << " ms FPS : " << 1000.0 / gpu_avg << std::endl;
}
return 0;
}
// #else
// int main()
// {
// std::cout << "OpenCV was built without CUDA Video decoding support\n" << std::endl;
// return 0;
// }
// #endif
CMakeLists.txt
:
cmake_minimum_required(VERSION 3.0.2)
SET(CMAKE_BUILD_TYPE "Debug")
include_directories(include)
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( test opencv_test.cpp )
target_link_libraries( test ${OpenCV_LIBS} )
报错:
error: (-218) Library was
built without OpenGL support in function cvNamedWindow**
解决办法:
安装opengl:
sudo apt-get install libgtkglext1 libgtkglext1-dev
报错:
(CPU:6731): GStreamer-CRITICAL **: 12:00:04.129: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
GStreamer: Error opening bin: URI“/device/video0”无源组件
OpenCV Error: Gpu API call (CUDA_ERROR_FILE_NOT_FOUND [Code = 301]) in CuvidVideoSource, file /home/zty/opencv-3.2.0/modules/cudacodec/src/cuvid_video_source.cpp, line 66
OpenCV Error: Unsupported format or combination of formats (Unsupported video source) in FFmpegVideoSource, file /home/zty/opencv-3.2.0/modules/cudacodec/src/ffmpeg_video_source.cpp, line 110
terminate called after throwing an instance of 'cv::Exception'
what(): /home/zty/opencv-3.2.0/modules/cudacodec/src/ffmpeg_video_source.cpp:110: error: (-210) Unsupported video source in function FFmpegVideoSource
已放弃 (核心已转储)
报错:
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Core", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Core" with any
of the following names:
Qt5CoreConfig.cmake
qt5core-config.cmake
Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
"Qt5Core_DIR" to a directory containing one of the above files. If
"Qt5Core" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:487 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Gui", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Gui" with any
of the following names:
Qt5GuiConfig.cmake
qt5gui-config.cmake
Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
"Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:487 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:487 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Test", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Test" with any
of the following names:
Qt5TestConfig.cmake
qt5test-config.cmake
Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
"Qt5Test_DIR" to a directory containing one of the above files. If
"Qt5Test" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:487 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5Concurrent", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Concurrent"
with any of the following names:
Qt5ConcurrentConfig.cmake
qt5concurrent-config.cmake
Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
"Qt5Concurrent_DIR" to a directory containing one of the above files. If
"Qt5Concurrent" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
CMakeLists.txt:487 (include)
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
CMake Error at /usr/share/cmake-3.5/Modules/FindQt4.cmake:1326 (message):
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
CMakeLists.txt:487 (include)
-- Configuring incomplete, errors occurred!
解决办法:
sudo apt-get install qt5-default
报错:
The called functionality is disabled for current build or platform in function 'throw_no_cuda'
解决办法:
发现cmake配置出来没有NVCUVID
,查看/home/zty/opencv-3.4.16/cmake/OpenCVDetectCUDA.cmake
的第49-77行:
find_path(_header_result
${_filename}
PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
ENV CUDA_PATH
ENV CUDA_INC_PATH
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
if("x${_header_result}" STREQUAL "x_header_result-NOTFOUND")
set(${_result} 0)
else()
set(${_result} 1)
endif()
unset(_header_result CACHE)
endmacro()
ocv_cuda_SEARCH_NVCUVID_HEADER("nvcuvid.h" HAVE_NVCUVID_HEADER)
ocv_cuda_SEARCH_NVCUVID_HEADER("dynlink_nvcuvid.h" HAVE_DYNLINK_NVCUVID_HEADER)
find_cuda_helper_libs(nvcuvid)
if(WIN32)
find_cuda_helper_libs(nvcuvenc)
endif()
if(CUDA_nvcuvid_LIBRARY AND (${HAVE_NVCUVID_HEADER} OR ${HAVE_DYNLINK_NVCUVID_HEADER}))
# make sure to have both header and library before enabling
set(HAVE_NVCUVID 1)
endif()
if(CUDA_nvcuvenc_LIBRARY)
set(HAVE_NVCUVENC 1)
endif()
endif()
发现他会找${CUDA_TOOLKIT_TARGET_DIR}
和${CUDA_TOOLKIT_ROOT_DIR}
文件夹,查找nvcuvid.h
或者dynlink_nvcuvid.h
如果找到了才会启动NVCUVID
因为之前将nvcuvid.h
拷贝到了/usr/include
下面,因此
将
PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
改为
PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}" "/usr/include"
报错:
运行别的视频文件显示
Unsupported format or combination of formats) Unsupported video source in function 'FFmpegVideoSource'
解决办法:
sudo apt install -y libv4l-0 libv4l-dev
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
并且在cmake中加入-D WITH_LIBV4L=ON
,最上面的编译指令已经修改过
还是无法解决,后续发现是视频编码的格式和支持的不符。这个以后再填坑。