Group Abstract Group Abstract

Message Boards Message Boards

How to install FFmpeg on MacOS

Posted 4 years ago
POSTED BY: Sean Cheren
16 Replies

Sean, I noticed that libavdevice.58 is missing in your list of links that need to be created manually! With this addition, your script works with Mathematica 13.0.1 under MacOS x86. Many thanks :)

POSTED BY: Pascal Paillier
Posted 3 years ago

After Homebrew automatically upgraded ffmpeg v4 to v5 I found that Mathematica could no longer find the extra codec files on my Intel Mac running OSMonterey 12.3. To resolve the issue I had to do the following in Homebrew terminal:

The first line removes ffmpeg v5.The second line installs ffmpeg v4. The last line is critical as it installs the symlinks that Mathematica needs to find ffmpeg. These symlinks are NOT installed automatically when Homebrew installs ffmpeg v4 because this version is now considered outdated. Evidently, Mathematica 13.0.1 is not currently compatible with ffmpeg v5; at least I couldn't find a way to make it work.

Good luck!

POSTED BY: John Snyder
Posted 3 years ago

Thanks! That also worked on a M1 Mac! It seems some of the calls from Mathematica to FFmpeg are hardcoded and not dynamic, that's unfortunate.

Thank you very much!

POSTED BY: M Schneider
Posted 3 years ago

Thanks for confirming this workaround! We're working hard to make FFmpeg work as out of the box as possible.

POSTED BY: Sean Cheren
Posted 3 years ago

I saw different approaches to using FFmpeg on a M1 Mac, but none have worked so far. With 13.0.1 and brew install ffmpeg or brew install ffmpeg@4 Mathematica refuses to find the FFmpeg installation. It's installed in /opt/homebrew/Cellar and links are present in /opt/homebrew/bin/ and /opt/homebrew/lib/. I think M13.0.1 is fully compatible with ARM Macs so a x86-installation shouldn't be necessary, right?

POSTED BY: M Schneider

In 12.3, there is a nice dialog box that comes up and tells me how to install ffmpeg with MacPorts:

enter image description here

Clicking the command copies it.

The problem is that it copies the wrong command. The clipboard will contain sudo port install ffmpeg + gpl3 + nonfree, which is incorrect and does not work as intended. There must be no spaces after the + signs. The correct command is sudo port install ffmpeg +gpl3 +nonfree (which is what is displayed, but is not what is copied).

Posted 4 years ago

/usr/local/Cellar sounds right but I have no idea why it would have put the symlinks in usr/local/opt/ffmpeg. When I tried this on a m1 mac last week arch -x86_64 /usr/local/bin/brew install ffmpeg created symlinks in /usr/local/lib like brew usually does. I'd be curious to see what arch -x86_64 /usr/local/bin/brew reinstall ffmpeg looked like in terms of install locations in the brew output.

POSTED BY: Sean Cheren

I have made the reinstall. I think I understand what the problem was.

I already had a ffmpeg in /usr/local/bin (don't ask me why ... I don't know).

The installer told me it could not create a symlink because of this and as consequence the symlinks for the libraries were not created.

I removed the binary I had. I made a reinstall again and now it looks like all the libraries are symlinked in /usr/local/lib.

So, next time : I'll read the output of the homebrew installer because I probably got the same warning the first time I installed the x86 version.

I'll test later if it works when I have removed the other symlinks I had created.

Posted 4 years ago

Thank you so much for confirming this, I just wanted to make sure that the typical arch -x86_64 /usr/local/bin/brew install ffmpeg still works as expected.

POSTED BY: Sean Cheren
Posted 4 years ago

Hi Christophe, was the x86 brew install of ffmpeg installed to /usr/local/lib? what do you get for this? ls -ls /usr/local/lib/libavc*

POSTED BY: Sean Cheren

I have the x86 homebrew in /usr/local and the ARM homebrew in /opt/homebrew

ls -ls /usr/local/lib/libavc*

is giving nothing :-) It is empty.

But I have the lib here: /usr/local/opt/ffmpeg/lib/libavcodec.58.91.100.dylib

And by creating the symbolic links to that place, everything is working.

At least, I see the list of codecs in

$VideoDecoders

and

FFmpegTools`$SystemFFmpegQ

is returning True.

It is not a problem for me. But I wanted to share just in case other people may have similar issues. I have not yet tested if the encoding is working.

I have followed your instructions to install the x86 version of home-brew and ffmpeg. I have done nothing special.

Posted 4 years ago
POSTED BY: Sean Cheren

I have /usr/local/bin/brew. Don't know how to check if this executable is x86 or arm.

I don't have the symlinks in /usr/local/lib pointing to ffmpeg in Cellar.

But I do have ffmpeg in /usr/local/Cellar.

The /usr/local/opt/ffmpeg is a symlink to the version in /usr/local/Cellar.

So in short : it looks like /usr/local/lib was not used but instead it is /usr/local/opt/ffmpeg.

I do see some codecs in /usr/local/lib like libvorbisenc.a

But the libavcodec.58 libavformat.58 libavutil.56 libavfilter.7 libswscale.5 libswresample.3 are in the ffmpeg folder.

With both the ARM and x86 versions of Homebrew installed it does not work. But using the symbolic links to point to the x86 version solved the issue.

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Posted 4 years ago

The Windows version of this post can be found here

The Linux version of this post can be found here

POSTED BY: Sean Cheren
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard