Media & Entertainment Industry Trends, Technology and Research

#3 Technical Series : How to compile and setup FFmpeg on Mac

Posted In Technical - By Nitin Narang on Tuesday, April 28th, 2015 With 1 Comment

FFmpeg is a rich multimedia framework which can handle most exhaustive image and video processing tasks. FFmpegFFmpeg on Mac can perform encoding, decoding, transcoding, muxing, demuxing, playback and streaming for audio and video content. In addition to open source, FFmpeg has unique advantage of supporting large number of media containers, codecs and file formats.

FFmpeg can be used on Mac by either downloading a static build or compiling FFmpeg for Mac. Compiling FFmpeg on Mac is easy and and similar to doing it on other Linux distributions. Below are step by step instructions to setup FFmpeg on Mac using Homebrew.  If you are a Windows user and want to compile FFmpeg for windows, please refer here to setup FFmpeg under Cygwin for Windows.

1. Install or Update Xcode

Latest version of Xcode (6.3.1) is quite bulky ~ 2.5 GB so it is going to take time. Download Xcode from App Store and install it.

XCode Installation

2. Install Homebrew

Homebrew is an excellent package manager and can save trouble to downloading, configuring and building binaries separately. Install Homebrew using below command

Key in super user password and all dependencies start to get download and get installed. Once finished run “brew doctor” to confirm the status of brew.

3. Use Homebrew to explore FFmpeg compile options 

Brew takes the pain of finding and downloading the dependencies. Use brew to find FFmpeg options. The command “brew options ffmpeg ” will provide all package option available for FFmpeg, some of these options are shown below

4. Select FFmpeg options and compile

One can select required FFmpeg options and run “brew install ffmpeg” along with the selected options. Brew will resolve all dependencies, download and compile the dependent libraries. Below command has most of the FFmpeg options selected

FFmpeg will get built without libfaac for licensing reasons. User can use libvo-aacenc as default audio encoder.

5. FFmpeg is ready to use

FFmpeg binaries are generated under “/usr/local/Cellar” with sym link created

Run “ffmpeg” which display all compile option used for building the FFmpeg binary

FFmpeg is ready to use… Happy image and video processing with FFmpeg.

References 1 and 2

About - Digital Media Technology Consultant. I have passion for TV technology, digital convergence and changing face of Media and Entertainment industry.