Failed loading CUDA library when trying to use ffmpeg with nvenc
NOTE:
Back up your old LD_LIBRARY_PATH first!
This command will place the value of the environment variable LD_LIBRARY_PATH into your home directory in the file "LD_LIBRARY_PATH.old"
#>$ echo $LD_LIBRARY_PATH >> ~/LD_LIBRARY_PATH.old
MY FIX:
I had this issue when I installed the NVidia/Cuda drivers in Fedora. I had to update my library path:
#>$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/cuda/lib
REVERT CHANGES:
#>$ export LD_LIBRARY_PATH=$(cat ~/LD_LIBRARY_PATH.old)
Related videos on Youtube
KallDrexx
Updated on September 18, 2022Comments
-
KallDrexx almost 2 years
On Ubuntu 14.04 I am following the instruction guide from NVIDIA's site to get ffmpeg running using GPU encoding.
I followed the instructions (as far as I can tell), installed the NVIDIA SDK local .dep, installed the
cuda
package and thenvidia-352
package, then compiled ffmpeg.However, when I try to do the following call:
ffmpeg -i ~/test/StreamInstructions.mp4 -vcodec nvenc -b:v 5M -f avi output.mp4
ffmpeg tells me
Failed loading CUDA library
.Searching google shows me the source code for this error message originates on the line of code:
dl_fn->cuda_lib = dlopen("libcuda.so", RTLD_LAZY);
.This says to me (who hasn't done much c++ or linux in the past decade) that it can't find the libcuda.so shared library.
Doing a search of the file system I see that
libcuda.so
is in the following locations:/usr/local/cuda-7.5/doc/man/man7/libcuda.so.7 /usr/local/cuda-7.5/targets/x86_64-linux/lib/stubs/libcuda.so /usr/lib/i386-linux-gnu/libcuda.so.1 /usr/lib/i386-linux-gnu/libcuda.so /usr/lib/i386-linux-gnu/libcuda.so.352.63 /usr/lib/x86_64-linux-gnu/libcuda.so.1 /usr/lib/x86_64-linux-gnu/libcuda.so.352.63
I can't find any other results in my searching to help resolve this issue, and because of that I feel like I might be doing something wrong on the linux level rather than the ffmpeg level.
Anyone have any suggestions on where to go from here?
Edit: I just noticed that
ldconfig -p
actually shows that it can find thelibcuda.so
library, yet I'm still getting errors that it can't find the library:ldconfig -p | grep cuda libicudata.so.52 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libicudata.so.52 libcuda.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so.1 libcuda.so.1 (libc6) => /usr/lib/i386-linux-gnu/libcuda.so.1 libcuda.so (libc6) => /usr/lib/i386-linux-gnu/libcuda.so
-
KallDrexx over 8 yearsUnfortunately, that didn't fix it. However, I did notice that libcuda.so is showing up when I do
ldconfig -p | grep cuda
so that makes this even more confusing.