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

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