From white Wolf Stack: Check out the original

Ffmpeg installation, some people may have to agonize for a long time, or even for a week, the basic reason is the compilation and installation caused by the disaster.

We provide four installation methods, the most complicated being compiled and installed on Centos7.

  1. Ffmpeg static library download installation
  2. Install FFMPEG on your MAC
  3. Compile and install ffmpeg on centos7
  4. Install FFMPEG using Docker

You can install it according to your preference.

Today we’ll look at how to install FFMPEG on a MAC.

There are three ways to install FFMPEG on a MAC.

The first, which we covered in ffMPEG installation, is to download the static library directly;

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

The third option, which we’ll talk about today, is Homebrew installation.

If you have already installed FFmpeg through Homebrew, you can run brew uninstall ffmpeg to uninstall ffmpeg.

Before we install, let’s take a look at the version of Homebrew, depending on how 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)
Copy the code

If your computer displays Command not found, execute the following command to install Homebrew.

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

Note that due to the different versions of Homebrew, we have two different ways to do this next.

1. Homebrew version is less than 2.0

In this case, you can first take a look at the configuration options supported by Homebrew, and then select the required options 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
  ..............................
Copy the code

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

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

If your Homebrew version is greater than 2.0, you will find no options output by brew Options ffmpeg. What’s going on here?

Ffmpeg officially 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 Maintained by Homebrew. “, presumably meaning that as of Homebrew2.0, Homebrew no longer provides configuration options for its core formulas. So partners who want to extend other libraries need to choose a third-party repository called Homebrew-ffmpeg. Of course, you can also choose brew Install ffmpeg without any extension libraries, but this will result in the absence of many codecs and will not be able to execute more complex commands.

The brew tap command is first executed

brew tap homebrew-ffmpeg/ffmpeg
Copy the code

Then take a look at the options supported by the repository

brew options homebrew-ffmpeg/ffmpeg/ffmpeg
Copy the code

Add these options to install as well, similar to the following

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

It takes some time to install ffMPEG. After the installation, test whether FFMPEG is successfully installed on the terminal

» FFMPEG-Version FFMPEG Version 4.1 Copyright (C) 2000-2018 The FFMPEG developers built with Apple LLVM Version 10.0.0 (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.100Copy the code

If you are using homebrew-ffmpeg/ffmpeg/ffmpeg, the version will be 4.x, the only difference may be a few more options.

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