Forward from White Wolf Stack: See the original article

About the installation of FFMPEG, some people may have to toss about for a long time, or even toss about for a week, the reason, the basic is to compile and install the trouble.

There are four types of installation available, the most complex being compilation and installation on Centos7.

  1. FFMPEG static library download and install
  2. Install FFMPEG on your Mac
  3. Build and install FFMPEG on Centos7
  4. Install FFMPEG using Docker

You can choose to install according to your preferences.

Today we’re going to look at how to install FFMPEG on a Mac.

There are three ways to install FFMPEG on a Mac.

The first, which we already mentioned in the FFMPEG installation article, is to download the static library directly.

The second is to compile and install, not only to install Xcode, but also to install a lot of dependent libraries, let our Mac save worry, ignore it;

The third is what we’re going to talk about today, through Homebrew installation.

If you have already installed FFmpeg through Homebrew, you can use the command brew uninstall FFmpeg to uninstall it.

Before installing, let’s take a look at the version of Homebrew, depending on which way we install it. The terminal executes BREW-V

Brew-v Homebrew 1.8.3 Homebrew/homebrew-core (git revision 38eb; last commit 2018-11-19)

If your computer shows Command Not Found, please execute the following command to install Homebrew.

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

Note that because of the different versions of Homebrew, we are going to have two different methods of doing this.

1. Homebrew version is less than 2.0

At this point, you can take a look at what configuration options Homebrew supports and select the options you want to install.

BREW OPTIONS FFMPEG -- with-Chromaprint Enable the Chromaprint Audio Fingerprinting Library -- with-FDK-AAC Enable the Fraunhofer FDK AAC library --with-fontconfig Build with fontconfig support ..............................

When installing, you can choose which configuration options you want to install. It is recommended that you include all of the above options

brew install ffmpeg --with-chromaprint --with-fdk-aac --with-xxx ......
2. Homebrew version is greater than 2.0

If you have a version of Homebrew greater than 2.0, you will see that the terminal does not output any options by checking the brew options FFmpeg. What’s going on here?

FFmpeg official says “Since v2.0, Homebrew does not offer options for its core formulae anymore. Users who want to build ffmpeg with additional libraries (including non-free ones) need to use so-called taps from third party repositories. These repositories are not Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux Linux So if you want to extend other libraries, you need to choose the third party repository Homebrew-FFmpeg. Of course, you can also choose brew install ffmpeg without any extension libraries, but the result of this installation is a lot of lack of codec libraries, slightly complex commands can not be executed.

Begin by executing the brew tap command

brew tap homebrew-ffmpeg/ffmpeg

Then look at the options supported by the repository

brew options homebrew-ffmpeg/ffmpeg/ffmpeg

At the end of the install, add the options as follows

brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint --with-fdk-aac --with-xxx ......

The installation will take some time, and after the installation, directly test the FFMPEG on the terminal to see if the installation is successful

The FFmpeg Developers Built with Apple LLVM Version 10.0.0 Copyright (C) 2000-2018 (clang - 1000.10.44.4) configuration: -- prefix = / usr/local/Cellar/ffmpeg / 4.1 - enable - Shared - enable - pthreads - enable - version3 - enable - hardcoded - tables - enable - avresample - cc = clang - host - cflags = '-i/Library/Java/JavaVirtualMachines jdk1.8.0 _251. JDK/Contents/Home/include - I/Library/Java/JavaVirtualMachines jdk1.8.0 _251. JDK/Contents/Home/include/Darwin '- host - ldflags = - enable - ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-chromaprint --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-librsvg --enable-librtmp --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtwolame --enable-libvidstab --enable-libwavpack --enable-libwebp --enable-libzmq --enable-opencl --enable-openssl --enable-videotoolbox - enable - libopenjpeg - disable - decoder = jpeg2000 - extra - cflags = upon - I/usr/local/Cellar/openjpeg 2.3.0 / include/openjpeg - 2.3 -- Enable-nonfree libavutil 56\.22.100/56 \.22.100 libavcodec 58\.35.100/58 \.35.100 libavformat 58\.20.100/58 \. 20.100 libavDevice 58\.5.100/58 \.5.100 libavFilter 7\.40.101/7 \.40.101 libavresample 4\.0 \.0/4 \.0 \.0 Libswscale 5\.3.100/5 \.3.100 libswresample 3\.3.100/3 \.3.100 libpostproc 55\.3.100/55 \.3.100

If you are using a repository called homebrew-ffmpeg/ffmpeg/ffmpeg, the version should also be 4.x. The only difference is that there are a few options.

But in either case, you should at least specify the configuration option, because we’ll get a little more complicated with FFMPEG later.