<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; 3.4.1</li>
<li>Operating System / Platform =&gt; Ubuntu 16.04 amd64</li>
<li>Compiler =&gt; g++ 5.4</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I try to use cudacodec VideoReader to read a mkv :<br>
<code class="notranslate">cudacodec::createVideoReader("file.mkv")</code></p>
<p dir="auto">OpenCV throws this error :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="OpenCV(3.4.1) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform) in throw_no_cuda, file /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp, line 111
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.1) /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp:111: error: (-213) The called functionality is disabled for current build or platform in function throw_no_cuda"><pre class="notranslate"><code class="notranslate">OpenCV(3.4.1) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform) in throw_no_cuda, file /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp, line 111
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.1) /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp:111: error: (-213) The called functionality is disabled for current build or platform in function throw_no_cuda
</code></pre></div>
<p dir="auto">I compile OpenCV with external cuda-enabled ffmpeg :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ffmpeg
ffmpeg version n3.4.2-6-g1b9b469 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --enable-cuda --enable-nvenc --enable-cuvid --enable-nonfree --extra-cflags='-I/usr/local/cuda/include -I/home/damien/code/lib/Video_Codec_SDK_8.1.24/Samples/NvCodec/NvEncoder' --extra-ldflags=-L/usr/local/cuda/lib64 --enable-shared --disable-static
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
Hyper fast Audio and Video encoder"><pre class="notranslate"><code class="notranslate">$ ffmpeg
ffmpeg version n3.4.2-6-g1b9b469 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --enable-cuda --enable-nvenc --enable-cuvid --enable-nonfree --extra-cflags='-I/usr/local/cuda/include -I/home/damien/code/lib/Video_Codec_SDK_8.1.24/Samples/NvCodec/NvEncoder' --extra-ldflags=-L/usr/local/cuda/lib64 --enable-shared --disable-static
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
Hyper fast Audio and Video encoder
</code></pre></div>
<p dir="auto">I compile OpenCV with this cmake :<br>
<code class="notranslate">cmake --enable-shared -D WITH_NVCUVID</code><br>
Giving me this OpenCV configuration :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="General configuration for OpenCV 3.4.1 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /home/damien/code/lib/opencv-3.4.1/opencv_contrib-3.4.1/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2018-04-03T15:40:15Z
    Host:                        Linux 4.13.0-37-generic x86_64
...
  Video I/O:
    DC1394:                      YES (ver 2.2.4)
    FFMPEG:                      YES
      avcodec:                   YES (ver 57.107.100)
      avformat:                  YES (ver 57.83.100)
      avutil:                    YES (ver 55.78.100)
      swscale:                   YES (ver 4.8.100)
      avresample:                NO
...
  NVIDIA CUDA:                   YES (ver 9.1, CUFFT CUBLAS)
    NVIDIA GPU arch:             30 35 37 50 52 60 61 70
    NVIDIA PTX archs:

  OpenCL:                        YES (no extra features)
    Include path:                /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load
..."><pre class="notranslate"><code class="notranslate">General configuration for OpenCV 3.4.1 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /home/damien/code/lib/opencv-3.4.1/opencv_contrib-3.4.1/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2018-04-03T15:40:15Z
    Host:                        Linux 4.13.0-37-generic x86_64
...
  Video I/O:
    DC1394:                      YES (ver 2.2.4)
    FFMPEG:                      YES
      avcodec:                   YES (ver 57.107.100)
      avformat:                  YES (ver 57.83.100)
      avutil:                    YES (ver 55.78.100)
      swscale:                   YES (ver 4.8.100)
      avresample:                NO
...
  NVIDIA CUDA:                   YES (ver 9.1, CUFFT CUBLAS)
    NVIDIA GPU arch:             30 35 37 50 52 60 61 70
    NVIDIA PTX archs:

  OpenCL:                        YES (no extra features)
    Include path:                /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load
...
</code></pre></div>
<p dir="auto">After taking a look at the source code, I see that :</p>
<p dir="auto">Using cudacodec VideoReader needs the HAVE_NVCUVID envvar to be set :<br>
<a href="https://github.com/opencv/opencv/blob/3.4.1/modules/cudacodec/src/video_reader.cpp#L49-L54">https://github.com/opencv/opencv/blob/3.4.1/modules/cudacodec/src/video_reader.cpp#L49-L54</a></p>
<p dir="auto">This envvar is set only if CUDA_nvcuvid_LIBRARY is set :<br>
<a href="https://github.com/opencv/opencv/blob/3.4.1/cmake/OpenCVDetectCUDA.cmake#L36-L38">https://github.com/opencv/opencv/blob/3.4.1/cmake/OpenCVDetectCUDA.cmake#L36-L38</a></p>
<p dir="auto">And this variable is set only when we are on WIN32 :<br>
<a href="https://github.com/opencv/opencv/blob/3.4.1/cmake/FindCUDA.cmake#L792-L794">https://github.com/opencv/opencv/blob/3.4.1/cmake/FindCUDA.cmake#L792-L794</a></p>
<p dir="auto">So I think that there is no way to enable NVCUVID. Do I miss something ? If not, I think that it should be fixed.</p>
<p dir="auto">Furthermore, I don't want to use the CuvidVideoSource, but I want to use the shared FFMPEG lib that already can use cuvid, with the FFmpegVideoSource. And I think that there is no need for OpenCV to link to cuvid to use this ffmpeg backend. So the FFMPEG backend should be available event if HAVE_NVCUVID is not defined. Is it ?</p>
<p dir="auto">I can do these changes, but I think that having a confirmation before working on could be interresting.</p>
<h5 dir="auto">Steps to reproduce</h5>
<ul dir="auto">
<li>
<p dir="auto">Compile OpenCV 3.4.1 with CUDA 9.1, NVCUVID</p>
</li>
<li>
<p dir="auto">try to open a mkv :</p>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cudacodec::createVideoReader(&quot;file.mkv&quot;)"><pre class="notranslate"><span class="pl-en">cudacodec::createVideoReader</span>(<span class="pl-s"><span class="pl-pds">"</span>file.mkv<span class="pl-pds">"</span></span>)</pre></div>
</li>
</ul>
<p dir="auto">More informations about this problem : <a href="http://answers.opencv.org/question/188525/enable-cudacodecvideoreader/" rel="nofollow">http://answers.opencv.org/question/188525/enable-cudacodecvideoreader/</a></p>
<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; 3.4.3</li>
<li>CMake =&gt; 3.12.3</li>
<li>Operating System / Platform =&gt; OSX 10.13.6</li>
<li>Compiler =&gt; clang(?)</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">When configuring my OpenCV project, I get the following error:<br>
<code class="notranslate">CMake Error at /Library/Frameworks/opencv2.framework/OpenCVConfig.cmake:96: Parse error.  Expected a command name, got unquoted argument with text "@CUDA_CONFIGCMAKE@". Call Stack (most recent call first): CMakeLists.txt:3 (find_package)</code></p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">I downloaded the OpenCV ios pack and dragged the framework to my User Library. I installed CMake using the .dmg. My most recent error was that there was no OpenCVConfig.cmake file in my OpenCV_DIR path, so I added the one I found here on GitHub (without the ".in" suffix) to the folder Library/Frameworks/opencv2.framework.</p>
<p dir="auto">my project directory:<br>
<code class="notranslate">/OpenCV_Setup</code><br>
<code class="notranslate">----/OpenCV_Setup</code><br>
<code class="notranslate">--------/main.cpp</code><br>
<code class="notranslate">----/OpenCV_Setup.xcodeproj</code><br>
<code class="notranslate">----/CMakeLists.txt</code></p>
<p dir="auto">Here is my CMakeLists.txt:<br>
<code class="notranslate">cmake_minimum_required(VERSION 3.0)</code><br>
<code class="notranslate">project( DisplayImage )</code><br>
<code class="notranslate">find_package( OpenCV REQUIRED )</code><br>
<code class="notranslate">target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})</code><br>
<code class="notranslate">add_executable( DisplayImage DisplayImage.cpp)</code><br>
<code class="notranslate">target_link_libraries( DisplayImage ${OpenCV_LIBS})</code></p>
<p dir="auto">I have tried it with minimum required version as 3.12 as well, with the same result.</p>
<p dir="auto">I've seen that some people solved similar errors by detecting non-printing characters using a hex editor, and while I can see the hex version of this code in Sublime Text... understanding it is beyond me at the moment.</p>
<p dir="auto">I'm looking forward to starting to study OpenCV as soon as possible. I'll keep trying to figure this out on my own as well, but any help would be greatly appreciated.</p>