13

After recently updating to Mavericks 10.9.5, my installation of ffmpeg has been bugging out

Error:

dyld: Library not loaded: /usr/local/lib/libx264.142.dylib
  Referenced from: /usr/local/bin/ffmpeg
  Reason: image not found
Trace/BPT trap: 5

Any thoughts? I'm not very familar with manual compiling and I installed ffmpeg through Homebrew.

I tried uninstalling and doing:

brew install ffmpeg --HEAD
brew install ffmpeg --build-from-source

but it spits back a ./configure error

==> ./configure --prefix=/usr/local/Cellar/ffmpeg/2.4.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample
If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting

These open issues may also help:
gpac 0.5.0 doesn't build against ffmpeg 2.4.1 (https://github.com/Homebrew/homebrew/issues/32978)
Hudson Buddy
  • 726
  • 2
  • 9
  • 20

4 Answers4

25

My solution after some fiddling.

brew uninstall ffmpeg
brew doctor

then it told me i had an unlinked ffmpeg and i had some dependencies

brew install faac lame xvid
brew doctor

then it told me i JUST had an unlinked item.

brew install ffmpeg

and it worked.

danielson317
  • 3,121
  • 3
  • 28
  • 43
chrisallick
  • 1,330
  • 17
  • 18
  • 3
    Based on your answer I just did this: `brew uninstall ffmpeg faac lame xvid` `brew cleanup` `brew install faac lame xvid ffmpeg` – danielson317 Feb 26 '15 at 18:05
6
brew upgrade ffmpeg

Worked for me

n0nSmoker
  • 832
  • 11
  • 26
4

I think this is worth sharing as pointed out by James. I had this similar issue and able to fix mine by looking into /usr/local/lib/ the location of the lib

dyld: Library not loaded: /usr/local/lib/libx264.142.dylib

$ ls -lsha /usr/local/lib/libx264.* 

In my case I found out that I have libx264 installed but a different version from what ffmpeg was looking for. I found

/usr/local/lib/libx264.152.dylib 

which is a symbolic link to actual installation location

/usr/local/Cellar/x264/r2854/lib/libx264.152.dylib

Notice it is only a difference of version number thus, I had to create a symbol link to the version that was needed by ffmpeg. With the command below, I was able to resolved this on MacOS 10.13

sudo ln -s /usr/local/Cellar/x264/r2854/lib/libx264.152.dylib /usr/local/lib/libx264.148.dylib

The only issue I would expect from this is incompatibility problem like function depreciation (because I am using a newer version) which did not occur. I hope this will help someone too. You will need to use the exact version available in your system if it is different from mine.

Paullo
  • 2,038
  • 4
  • 25
  • 50
  • When I try to run ffmpeg, my anaconda installation is referenced: dyld: Library not loaded: @rpath/libx264.138.dylib Referenced from: /anaconda3/bin/ffmpeg Reason: image not found So obviously I want to add the path to the brew installation of ffmpeg. Will the last line you've posted ("sudo ln .......") help with that, or is my problem completely different? – J.D Oct 29 '18 at 13:18
  • For this particular error you are seeing, i solved by downloading a binary ffmpeg from their site. – chrisallick Aug 09 '19 at 04:29
  • 1
    Thanks for the insight! In my case, I dug a tiny bit deeper and discovered that the reason for the version mismatch was that x265 had been pinned, so it wouldn't upgrade to the version that ffmpeg expected. So "brew unpin x265" followed by "brew reinstall x265" (which also reinstalled ffmpeg) eliminated the error without the need for a symbolic link to an older version. Hope this helps someone! – B. Shefter Jan 28 '22 at 21:57
-3

For High Sierra (macOS 10.13) I tried the uninstall ffmpeg method in the answer from chrisallick, but it didn't resolve the matter for me. I ended up going a big step further and completely removed and reinstalled my homebrew.

Proceed at your own risk.

Step 1. Uninstall Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Step 2. Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Step 3. Install ffmpeg

brew install ffmpeg

Obviously any other applications you installed via homebrew will have to be reinstalled if you chose this option.

This approach actually worked for me on High Sierra. There's probably a more direct method, until someone posts it, consider just doing this. And again, chrisallick's more direct method didn't actually work for my case.

James T Snell
  • 1,588
  • 1
  • 15
  • 28
  • 1
    This is too EXPENSIVE and should not or Posted as answer or you should make your WARNING very BOLD about the Risk. I still have same issue BUT I CANNOT TRY THIS – Paullo Apr 17 '18 at 10:07
  • @Paullo - I do explain what the consequences are and state that the other proposed solution didn't work for me. Should I then delete this, what actually worked for me, when the only other proposed solution didn't work? Do you have a better solution? – James T Snell Apr 17 '18 at 15:01
  • What I normally do when I am desperate for solution is that once I see answers like this I will start coping and pasting the codes without reading most of the details. I did not try it here as I see "Uninstall Homebrew" and I knew what that means. It could have been better if make the warning very clear by highlighting it same way Step 1,2,3 was. – Paullo Apr 17 '18 at 20:37
  • I was able to resolve this by looking into /usr/local/lib/ (ls -lsha /usr/local/lib/libx264.*). In my case I noticed I have libx264 installed but a different version from what ffmpeg was looking for, thus I had to create a symbol link to the version that was needed by ffmpeg. This command resolved this for me on MacOS 10.13 sudo ln -s /usr/local/Cellar/x264/r2854/lib/libx264.152.dylib /usr/local/lib/libx264.148.dylib. The only issue I would expect from this is incompatibility problem like function depreciation which did not occur notice the version numbers are not much difference – Paullo Apr 17 '18 at 20:44
  • @paulio I think it's pretty clear when Step 1 is bold and says "Uninstall Homebrew", so if someone decides to try this without actually wanting it, then that's their fault. Since you found a possible solution, you should post it as an actual answer. – James T Snell Apr 18 '18 at 02:04