Trouble installing libav with nVidia Codec SDK support

I am trying to compile the libva library with nVideo Codec SDK support according to the instructions at:

I installed the nvidia-396 driver and the CUDA according to the instructions. I found I also needed to install nvidia-cuda-dev as it wasn’t already installed. I also had to modify the configure command to include the nvidia-396 library directory. The command I am using is:

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags='-L/usr/local/cuda/lib64 -L/usr/lib/nvidia-396'

However, it gives me the error:


In the config.log it reports

fatal error: nvEncodeAPI.h: No such file or directory

Any idea how to proceed from here? I am building on Ubuntu 16.04.
Thanks, David

1 Like

OK, so I found that I needed to download the Codec SDK and copy the nvEncodeAPI.h file to /usr/include. Now when I run the configure command it shows h264_cuvid under Enabled hwaccels. However, after compiling, when I run:

avconv -hwaccels

it only shows cuda and vdpau. If I try and decode a file with:

avconv -vsync 0 -c:v h264_cuvid -i t.mp4 -f rawvideo t.yuv

I get the error:

Unknown decoder 'h264_cuvid'

Any idea what I am doing wrong?

Could it be that the correct command is:

avconv -hwaccel cuda -vsync 0 -c:v h264 -i T.mp4 -f rawvideo t.yuv


Hi, it seems that nobody did help you, nice forums! Avconv can have different keywords for arguments, the err you got says unknown decoder, which is supposed to be encoder i believe, and is called “h264_nvenc” in libav.
Example syntax: ~ $ avconv -i input.mp4 -vcodec libx264 -acodec copy output.mp4
BTW i had to register to download the Codec SDK which i find very offensive! After all i found it useless as it would require the 2+GB cuda package installed too… No way. Solution was to use ffmpeg instead of avconv, ffmpeg has its own headers instead of this SDK package and compiled just fine. Here is the guide for you… The time spent trying to make work libav + nV codec SDK was worth nothin’…
Why the hell this multimillion company is not able to provide working builds of avconv and ffmpeg with hw accel? Is that so hard?