This article turns from: Compiling FFmpeg on Mac OS | Www.samirchen.com
Install Xcode and Command line Tools
Install Xcode from the App Store and make sure that Command linePreferences -> Downloads -> ComponentsTools is installed under Xcode.
Of course you can also download Xcode and Command line Tools from https://developer.apple.com/.
Installing Brew
Homebrew is a very useful package management tool on your MAC, and the installation method allows the following commands:
-e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Using Brew to install dependent libraries
install automake fdk-aac git libtool libvorbis libvpx opus sdl shtool yasm texi2html theora wget x264 xvid lame libass
When you install these libraries, you can try again if an error occurs, and sometimes the installation fails due to network reasons that caused the download to be incomplete. You can install a single library in this way:
Install x264 with brew.$ brew install x264
If the library is always installed unsuccessfully, then you can try to upgrade the update under Brew first:
brew update
The tragedy is, sometimes after the executionbrew update, brew may be error, most of the reason is the local brew warehouse (usually in the/usr/local/directory) conflict, it is necessary to perform the next git command to deal with the conflict and then update Brew, the command is as follows:
$ cd $(brew --prefix)$ git reset --hard HEAD$ brew update
If you still encounter other problems, Google to solve it first.
Compiling FFmpeg
Next, download the FFmpeg source code and compile it with the following command:
// Download FFmpeg source code:
$ git clone http://source.ffmpeg.org/git/ffmpeg.git ffmpeg
// Compile:
$ cd ffmpeg
$ ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus - -enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --extra-ldflags=-L/usr/local/lib
$ make && make install
When your config is sometimes an error to find some libraries, you can add a--extra-ldflags=-L/usr/local/libtry.
Test it.
Compile the completion of the error, then you can try to take a video to play the test, in the FFmpeg directory, execute the following command to let FFmpeg playback a video:
http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/gear5/prog_index.m3u8
Other
If you want to compile FFmpeg for IOS projects, you can look at Ffmpegcompiletool.
Compiling the FFmpeg on Mac OS