5

I installed Nvidia Video Codec SDK 8.2 + ffmpeg inside a docker container by using nvidia-docker but when I run this

ffmpeg -f rawvideo -s:v 1920x1080 -r 30 -pix_fmt yuv420p -i HeavyHand_1080p.yuv -c:v h264_nvenc -preset slow -cq 10 -bf 2 -g 150 output.mp4

I got this error

Cannot load libnvidia-encode.so.1

The minimum required Nvidia driver for nvenc is 390.25 or newer Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Otherwise nvidia-smi displays this

enter image description here

this gpu used is GeForce 1050 Ti and the cuda version is 9.0

2 Answers2

11

When running inside a Docker container, by default not all of Nvidia libraries are mounted inside the container. Read more here and here. You can see all libraries available in your Docker container by running this: ldconfig -p | grep -E 'libcuda|libnvidia'

To fix this, you should modify the NVIDIA_DRIVER_CAPABILITIES environment variable in your Docker image. For example, you can append ENV NVIDIA_DRIVER_CAPABILITIES=all to your Dockerfile to mount all libraries/binaries in your docker container.

By doing so, the libnvidia-encode library will also be mounted, and so FFMPEG will be able to use NVENC codec.

matanb
  • 484
  • 4
  • 14
1

If you are using nvidia-docker for running the docker image then everything should be taken from the host. You should have cuda installed on you host system first. "sudo apt-get install cuda" and then run the docker image.

You should also use the nvidia-cuda image instead of linux (in the dockerfile)