FFMPEG install for MAMP OSX

Tinkering a lot to get FFmpeg running on a MAMP development environment.  Since I will  need it again here a step by step guide for non Linux or Mac Terminal Geeks like me to fix it.

First of all make clear that your system is clean and everything is linked as it should . FFMPEG needs/install a lot of libraries to convert .If a older install fail you simple can mess up and it get hard to find the missing or wrong linked part. Some great Blogs been a major part in debugging and showed me the path where to go mentioned at the end. We will need to compile ffmpeg for our MAMP php version here PHP 5.3.14  since our second PHP version for MAMP is PHP 5.4 we need to repeat the compile process for every version we whant ffmpeg running. Imagick is installed on my System so i will not go in detail for that but its needed for ffmpeg.so to work.

First Part run some general check to prove system consistense . Second part will guide step by step thrue isntall Third part will show some Errors and bugs and how to get around them.

1. General System Check open  Terminal we will make some general check of your system health.

brew doctor

Make sure Homebrew Packet manager is installed and all files linked +update

brew update

2. Installation preparation

  • Point to your MAMP install dir

export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.3.14/bin:/usr


  • which php pecl phpize

return :


  • phpize -v

Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626


  • Install ffmpeg 
  • sudo brew install ffmpeg

==> Downloading http://ffmpeg.org/releases/ffmpeg-1.2.4.tar.bz2

Check & Test your FFMPEG in Terminal

  • ffmpeg -v

ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 29 2013 18:32:07 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: –prefix=/usr/local/Cellar/ffmpeg/1.2.4 –enable-shared –enable-pthreads –enable-gpl –enable-version3 –enable-nonfree –enable-hardcoded-tables –enable-avresample –enable-vda –cc=gcc-4.2 –host-cflags= –host-ldflags= –enable-libx264 –enable-libfaac –enable-libmp3lame –enable-libxvid
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

  • which ffmpeg


Look for every error or problem in the log file output !

Test in Terminal that ffmpeg is working from terminal with a simple command cd to a random folder with a video .mp4

  •  ffmpeg -i  video.mp4

will return video information like frame rate ect

If Imagick install missing

  • brew install ImageMagick


  • sudo pecl channel-update pecl.php.net
  • sudo pecl install imagick

Now lets Build the Extension  for MAMP

Install ImageMagick  required for the  PHP ffmpeg.so extension

Unpack and  Create directory for your PHP sources for your php version . Place it in the dir MAMP/bin/php/php5.3.14 /include/php If the dir dont exist create it


 Install ffmpeg-php 

  • svn co svn://svn.code.sf.net/p/ffmpeg-php/code/trunk ffmpeg-php-code
  • cd ffmpeg-php-code
  • phpize
  • . /configure
  • make install

A lot of log files and checks ….

Libraries have been installed in:

Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/

Here you will find you new compiled  ffmpeg.so  copy them to your MAMP extension folder


 Set MAMP Path for your FFMPEG 

Add the Extensions to your Mamp /conf /php5.3.14/ php.ini file

; Dynamic Extensions ;



SET the Correct PATH for FFMPEG

On many Install tutorial i have seen that the path get not recognised and they add the path in the php file like these example .

exec(“/usr/local/bin/ffmpeg -i $srcFile $destFile 2>&1”, $output);

To prevent that specialy if we use other software and the code is written without path like . You need to set the ENV vars for MAMP !

exec(“ffmpeg -i $srcFile $destFile 2>&1”, $output);

  • Open MAMP Env file .


Comment out if not already done !


Add the path of your FFMPEG and IMAGEMagick installation 

#METAMODE 2014 !Important ffmpeg path
export PATH=”$PATH:/usr/local/bin/”

#METAMODE 2014 path for imagmagic
export PATH=”$PATH:/usr/local/opt/imagemagick/bin/”

Dont forget to Restart MAMP to take effect

  • Install ffmpeg-php for PHP 
  • svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php
  • cd ffmpeg-php/trunk/ffmpeg-php
  • phpize

Don’t forget to run ‘make test’



Some Error DEBUGING 

If you get any error like “Possible conflicting files are: ”  remove all files by hand ffmpeg will add recent version needet

If you get these kind of Error during ffmpeg-php you ffmpeg-php is not compatible , the version in the drupal tutorial point to a outdated version ffmpeg-php 0.6

include/php/ffmpeg-php/ffmpeg_movie.c:531: error: ‘AVFormatContext’

full error logs strungling on ffmpeg-php 


Check you Apache, in logs for any error

File PermissionProblems

MAMP is accesing ffmpeg in root by default MAMP php cant acces root files , so lets change permission on ffmpeg

ls -l /usr/local/bin/ffmpeg

returns -rwxr-xr-x

If you get any error reinstall ffmpeg with option overwrite brew will guide you quite nice

brew –overwrite ffmpeg

The Drupal Forum on MAMP 

Plesk add additional Codecs to ffmpeg Tutorial

Add Memcoder FFMPEg