title: Error while using h264_cuvid decoder with ffmpeg
body: <p>I am trying to decode a video using the <strong>NVIDIA cuvid</strong> hardware acceleration with <strong>ffmpeg</strong>.</p>
  <p>I am using a NVIDIA GeForce GT 745M Graphics card (GPU:GK107), which is compatible with <strong>cuvid</strong> as specified by NVIDIA <a href="https://developer.nvidia.com/video-encode-decode-gpu-support-matrix#Encoder" rel="nofollow noreferrer">here</a></p>
  <p>I compiled ffmpeg with the following flags:</p>
  <pre><code>./configure --enable-cuda --enable-nvenc --enable-cuvid
  </code></pre>
  <p>Then, I used <strong>ffmpeg</strong> with the following command line:</p>
  <pre><code>ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i video.mkv video.mkv
  </code></pre>
  <p><strong>ffmpeg</strong> finishes and seems to be unable to open cuvid functions:</p>
  <pre><code>Cannot load cuvidGetDecoderCaps
  [h264_cuvid @ 07047b80] Failed loading nvcuvid.
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (h264 (h264_cuvid) -&gt; h264 (libx264))
    Stream #0:1 -&gt; #0:1 (ac3 (native) -&gt; vorbis (libvorbis))
    Stream #0:3 -&gt; #0:2 (subrip (srt) -&gt; ass (ssa))
  Error while opening decoder for input stream #0:0 : Unknown error occurred
  </code></pre>
  <p>In <strong>ffmpeg</strong> source code, I can find out that this error message is printed by the following macro:</p>
  <pre><code>#define LOAD_SYMBOL(fun, tp, symbol)                                \
      do {                                                            \
          if (!((f-&gt;fun) = (tp*)dlsym(f-&gt;lib, symbol))) {             \
              av_log(NULL, AV_LOG_ERROR, &quot;Cannot load %s\n&quot;, symbol); \
              ret = AVERROR_UNKNOWN;                                  \
              goto error;                                             \
          }                                                           \
          av_log(NULL, AV_LOG_TRACE, &quot;Loaded sym: %s\n&quot;, symbol);     \
      } while (0)
  </code></pre>
  <p>Which is called by:</p>
  <pre><code>static inline int cuvid_load_functions(CuvidFunctions **functions)
  {
      GENERIC_LOAD_FUNC_PREAMBLE(CuvidFunctions, cuvid, NVCUVID_LIBNAME);
  
      LOAD_SYMBOL(cuvidGetDecoderCaps, tcuvidGetDecoderCaps, &quot;cuvidGetDecoderCaps&quot;);
      LOAD_SYMBOL(cuvidCreateDecoder, tcuvidCreateDecoder, &quot;cuvidCreateDecoder&quot;);
      LOAD_SYMBOL(cuvidDestroyDecoder, tcuvidDestroyDecoder, &quot;cuvidDestroyDecoder&quot;);
      LOAD_SYMBOL(cuvidDecodePicture, tcuvidDecodePicture, &quot;cuvidDecodePicture&quot;);
  #ifdef __CUVID_DEVPTR64
      LOAD_SYMBOL(cuvidMapVideoFrame, tcuvidMapVideoFrame, &quot;cuvidMapVideoFrame64&quot;);
      LOAD_SYMBOL(cuvidUnmapVideoFrame, tcuvidUnmapVideoFrame, &quot;cuvidUnmapVideoFrame64&quot;);
  #else
      LOAD_SYMBOL(cuvidMapVideoFrame, tcuvidMapVideoFrame, &quot;cuvidMapVideoFrame&quot;);
      LOAD_SYMBOL(cuvidUnmapVideoFrame, tcuvidUnmapVideoFrame, &quot;cuvidUnmapVideoFrame&quot;);
  #endif
      LOAD_SYMBOL(cuvidCtxLockCreate, tcuvidCtxLockCreate, &quot;cuvidCtxLockCreate&quot;);
      LOAD_SYMBOL(cuvidCtxLockDestroy, tcuvidCtxLockDestroy, &quot;cuvidCtxLockDestroy&quot;);
      LOAD_SYMBOL(cuvidCtxLock, tcuvidCtxLock, &quot;cuvidCtxLock&quot;);
      LOAD_SYMBOL(cuvidCtxUnlock, tcuvidCtxUnlock, &quot;cuvidCtxUnlock&quot;);
  
      LOAD_SYMBOL(cuvidCreateVideoSource, tcuvidCreateVideoSource, &quot;cuvidCreateVideoSource&quot;);
      LOAD_SYMBOL(cuvidCreateVideoSourceW, tcuvidCreateVideoSourceW, &quot;cuvidCreateVideoSourceW&quot;);
      LOAD_SYMBOL(cuvidDestroyVideoSource, tcuvidDestroyVideoSource, &quot;cuvidDestroyVideoSource&quot;);
      LOAD_SYMBOL(cuvidSetVideoSourceState, tcuvidSetVideoSourceState, &quot;cuvidSetVideoSourceState&quot;);
      LOAD_SYMBOL(cuvidGetVideoSourceState, tcuvidGetVideoSourceState, &quot;cuvidGetVideoSourceState&quot;);
      LOAD_SYMBOL(cuvidGetSourceVideoFormat, tcuvidGetSourceVideoFormat, &quot;cuvidGetSourceVideoFormat&quot;);
      LOAD_SYMBOL(cuvidGetSourceAudioFormat, tcuvidGetSourceAudioFormat, &quot;cuvidGetSourceAudioFormat&quot;);
      LOAD_SYMBOL(cuvidCreateVideoParser, tcuvidCreateVideoParser, &quot;cuvidCreateVideoParser&quot;);
      LOAD_SYMBOL(cuvidParseVideoData, tcuvidParseVideoData, &quot;cuvidParseVideoData&quot;);
      LOAD_SYMBOL(cuvidDestroyVideoParser, tcuvidDestroyVideoParser, &quot;cuvidDestroyVideoParser&quot;);
  
      GENERIC_LOAD_FUNC_FINALE(cuvid);
  }
  </code></pre>
  <p>Does anybody know if a specific file is needed by <strong>cuvid</strong> to load its functions?
  Any clue to what is wrong here?</p>