6

On my fairly old laptop running 16.04, whenever I try to use ffmpeg I get the following error:

$ ffmpeg
ffmpeg: error while loading shared libraries: libcudart.so.5.5: cannot open shared object file: No such file or directory

ffmpeg used to work fine and broke at some point. I can't be sure exactly when, but it might well have been when I upgraded from 14.04 to 16.04.

Running ldd confirms that this library (the CUDA runtime library) is missing, but everything else is fine:

$ ldd /usr/bin/ffmpeg | grep libcudart
libcudart.so.5.5 => not found

I am fairly sure that the file (libcudart5.5) does not exist anywhere on my system (I have tried `find' etc), or indeed any other version of libcudart. The closest thing in the repo to what I need is libcudart7.5, a later version. But this comes along with an nvidia driver upgrade (nvidia-367) as a dependency which I have found several times now tanks the whole system (due to the graphics card being a bit out of date I think).

So basically I'm confused as to why ffmpeg is trying to link to libcudart5.5 in the first place. Surely it should be possible to run ffmpeg without needing GPU support? In fact I know it is because on another computer I use running 16.04, ldd shows no dependency on any version of libcudart and ffmpeg works just fine. The version of the ffmpeg package is the same in both cases:

$ dpkg -s ffmpeg | grep Version
Version: 7:2.8.11-0ubuntu0.16.04.1

So why is it looking for it on my laptop? I have tried purging ffmpeg and reinstalling it several times with no luck. One thing that seems relevant was that I found a residual-config entry for a package called libcudart5.5 installed on my system. I don't really know what this means, but after removing it and reinstalling ffmpeg, it didn't make a difference. It might also be relevant that at one stage (under 14.04) I had the full CUDA sdk installed, but then completely removed it and don't want to reinstall it.

I'd really appreciate any help because I'd really like to use ffmpeg on my laptop for video conversion and this has been bugging me for a while now.

Thanks!

  • 1
    Any results from this command: sudo find /usr -iname libcudart.so*? If so a simple link might make FFmpeg happier... – andrew.46 Feb 25 '17 at 0:19
  • Sorry, I should have been clearer, there is no version of libcudart.so on the system, I used a command similar to that to check. I will edit the question to point this out. Thanks anyway! As an aside, why use sudo for find? – C Bridge Feb 25 '17 at 8:47
  • 1
    Maybe there is some other library (used by ffmpeg) depending on libcudart? On both your systems, compare the complete output of ldd ... to see if there are other dependencies found. – ridgy Feb 25 '17 at 11:40
7

I'm answering my own question after some investigation inspired by ridgy's comment on the original question (thanks!). I began exploring whether some other library used by ffmpeg had libcudart as a dependency. The lddtree tool from the package pax-utils is really helpful for this as it gives you a hierarchical list of the linker dependencies rather than a flat list. E.g.

$ lddtree /usr/bin/ffmpeg

Using this, I discovered that libcudart.so.5.5 was a linker dependency of libopencv_core.so.2.4 which was left lying around in /usr/local/lib from a while back when I compiled OpenCV 2.4 from source and never cleaned up when the new version (version 3.0) came along.

To fix this, I uninstalled ffmpeg and all opencv packages using apt, then manually deleted the leftover opencv 2.4 files in /usr/local/lib using

$ sudo rm /usr/local/lib/libopencv_*.so.2.4*

Then reinstalled ffmpeg from the repo and now all is well.

This seems like a fairly specific set of circumstances that might not be that relevant to others, but perhaps this answer can be useful to others with similar problems.

0

I had a similar issue.and I solved it by deleting all instances of opencv and ffmpeg, uninstalling ffmpeg, and then installing it again:

sudo find / -name "*opencv*" -exec rm -R {} \; 
sudo find / -name "*ffmpeg*" -exec rm -R {} \;
sudo apt-get install ffmpeg
  • 1
    This command sequence as it stands will result in broken OpenCV and FFmpeg installations because the package manager remains unaware of the previously deleted files. On top of that it's dangerous advice to remove such a broad set of files and directories without further checks; it could easily delete something valuable that happened to have the same substring in its name. -1 – David Foerster May 29 '18 at 14:08
0

Run ffmpeg to see what's missing. Try to find where is libopencv_core.so.2.4 (or any file that's missing). For example:

find / -name "*libopencv_core.so*"

and if you find it in some directory copy it to /usr/lib/:

sudo cp /path-where-you-found-it/ /usr/lib/

Finally run again ffmpeg.

If everything is alright it will show help options for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.