Message Boards Message Boards


How to install FFmpeg on MacOS

Posted 4 months ago
11 Replies
8 Total Likes

for installing FFmpeg on Linux see this post,
for installing on Windows see this post


In an earlier community post, Piotr explained how installing FFmpeg can improve codec support in the Wolfram Language and how to do it on Windows. Chien-Yu expanded on this in another community post to give detailed instructions for installing FFmpeg on Linux. Here I explain some details on how this can be done on MacOS. Let's begin with a recap of why this is important.

Video object and video processing functions were introduced in Wolfram Language 12.1. To read from and write to video files, video functionality uses media libraries provided by operating systems as well as a limited version of FFmpeg that is shipped with the language and can be immediately used. Details and examples showing how to import and export video files can be found in the Importing & Exporting Video tutorial. The Codec Support section in that tutorial describes the limitations of the FFmpeg shipped with the language and shows how installing the full version of FFmpeg gets you a better support for audio and video codecs.

Without FFmpeg installed, the first time a video function is called a message is displayed, suggesting to install FFmpeg for more complete codec support. Here is the list of supported video decoders available before having FFmpeg installed. At the end of this post we will compare the list with the supported decoders after FFmpeg is installed.

In[1]:= Length /@ $VideoDecoders

During evaluation of In[1]:= General::sysffmpeg: Using a limited version of FFmpeg. Install FFmpeg to get more complete codec support.

Out[1]= <|"AVI" -> 37, "Matroska" -> 55, "MP4" -> 13, "Ogg" -> 1,  "QuickTime" -> 23, "VideoFormat" -> 83|>

Before proceeding, ensure the latest version of FFmpegTools is installed by evaluating the following:


A note on Apple Silicon Macs

Current versions of WL run using the Rosetta 2 technology on M1 Macs. Thus, it is necessary to install an Intel-based version of FFmpeg to use with Wolfram Language. Future versions of Wolfram Language will use the M1 chip natively and thus may require slightly different instructions.

Installing from a Package Manager

For Intel mac computers:

Installations of FFmpeg from Homebrew ( and MacPorts ( are supported. To install FFmpeg via brew, follow the installation instructions at Then run the following to install FFmpeg:

brew install ffmpeg

For Apple Silicon mac computers:

The installation instructions on for ARM computers installs software that won't work with WL 12.2.0 by default. To install an Intel-compatible version of brew, paste the instructions at to install in place of <brew-install>, then run the following commands:

arch -x86_64 <brew-install>
arch -x86_64 /usr/local/bin/brew install ffmpeg

Using an existing FFmpeg installation

This strategy works for both Intel and ARM based macs provided a compatible version of FFmpeg is installed. If FFmpeg is installed in a location other than the standard location installed by Homebrew or MacPorts, admin users can create symbolic links in /opt/Wolfram/ffmpeg/$SystemID/current (e.g. /opt/Wolfram/ffmpeg/MacOSX-x86-64/current). $SystemID can be obtained by evaluating $SystemID in the Wolfram Language.

The next few commands can be run in a terminal to create symbolic links in the correct directory after modifying ffmpegdir to the correct path the existing ffmpeg installation is located. For example, if ffmpeg is installed in /path/to/ffmpeg, the following creates symlinks in /opt/Wolfram/ffmpeg/MacOSX-x86-64/current:

sudo mkdir -p "$linkdir" && for dep in libavcodec.58 libavformat.58 libavutil.56 libavfilter.7 libswscale.5 libswresample.3; do find "$ffmpegdir" -type f -name '*'"$dep"'*dylib' -exec sudo ln -sf '{}' "$linkdir/$dep.dylib" \; ; done

If a different installation of ffmpeg should be used by a specific version of Wolfram Language on your system, /opt/Wolfram/ffmpeg/$SystemID/version is also supported (e.g. /opt/Wolfram/ffmpeg/MacOSX-x86-64/12.2.0). Simply change current to the 3 digit version number being targeted. The paths that Wolfram Language version 12.2 will search on for FFmpeg are (in order):


Final note

Once FFmpeg is installed via any of the methods previously described, restart Wolfram Language. When you evaluate $VideoDecoders again, you should see the list that contains many codecs not available before:

In[1]:= Length /@ $VideoDecoders

Out[1]= <|"AVI" -> 160, "Matroska" -> 260, "MP4" -> 34, "Ogg" -> 1,  "QuickTime" -> 70, "VideoFormat" -> 327|>

Another way to confirm that the full version of FFmpeg is used by Wolfram Language:

In[2]:= FFmpegTools`$SystemFFmpegQ
Out[2]= True
11 Replies
Posted 4 months ago

The Windows version of this post can be found here

The Linux version of this post can be found here

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 and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

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.

Posted 4 months 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*

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




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 months ago

I'm glad it's working for you with the symlinks, but I'm surprised the x86 brew would install to anywhere aside from /usr/local/Cellar with a symlink in /usr/local/lib. In case this helps other users, can you please confirm if the x86 brew is installed to /usr/local/bin/brew?

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.

Posted 4 months 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.

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 months 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.

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).

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract