Skip to content

Instantly share code, notes, and snippets.

@moust
Last active August 29, 2015 14:19
Show Gist options
  • Save moust/35c6b5183b3dfcf51dce to your computer and use it in GitHub Desktop.
Save moust/35c6b5183b3dfcf51dce to your computer and use it in GitHub Desktop.
FFmpeg install script for OS X
#!/bin/bash
# Any subsequent commands which fail will cause the shell script to exit immediately
set -e
# OS version
OS_Version=$(sw_vers -productVersion)
# install homebrew if not already installed
if hash brew 2>/dev/null; then
# already installed
continue
else
# install homebrew
curl -o homebrew.rb -fsSkL http://raw.github.com/mxcl/homebrew/go
/usr/bin/env ruby homebrew.rb
rm homebrew.rb
fi
# install dependencies
brew install automake celt faac git lame libass libtool libvorbis libvpx libvo-aacenc opencore-amr openjpeg opus sdl schroedinger shtool speex texi2html theora wget x264 xvid yasm libmodplug
# install fdk-aac
git clone git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/fdk-aac
cd fdk-aac
autoreconf -fvi
./configure --disable-shared
make && make install
cd ..
rm -rf fdk-aac
# install libaacplus
wget http://tipok.org.ua/downloads/media/aacplus/libaacplus/libaacplus-2.0.2.tar.gz
tar xzf libaacplus-2.0.2.tar.gz
cd libaacplus-2.0.2
# libtool on osx is quite different from the gnu libtool, which is called glibtool on osx
sed -i '.bck' -e 's/libtool/glibtool/' autogen.sh
./autogen.sh --enable-shared --enable-static
make && make install
cd ..
rm -rf libaacplus-2.0.2
# install ffmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
# Mac OS X Lion comes with Freetype already installed (older versions may need 'X11' selected during installation), but in an atypical location: /usr/X11.
# Running freetype-config in Terminal can give the locations of the individual folders, like headers, and libraries
if [[ ${OS_Version} < 10.7 ]]; then
CFLAGS=`freetype-config --cflags` LDFLAGS=`freetype-config --libs` PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig
fi
./configure --prefix=/usr/local --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libaacplus --enable-libass --enable-libcelt --enable-libfaac \
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-openssl \
--enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 \
--enable-libxvid --enable-swscale --enable-avfilter --enable-libmodplug --enable-shared --enable-pthreads --enable-yasm --enable-zlib && make && make install
# install qt-faststart
cd tools
cc qt-faststart.c -o qt-faststart
sudo cp qt-faststart /usr/local/bin
cd ../../
rm -rf ffmpeg
echo "ffmpeg installed successfully"
echo `ffmpeg -version`
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment