Build latest ffmpeg and all (generally) needed codecs from source

Jan 9, 2014, 3:53:21 PM


In projects where you need to work with video data - converting video files or creating frame screenshot preview for a video, convert mp3 etc. it is very likely you will decide to use ffmpeg.
It is open source and free lib that is de-facto standard tool to operate with media files. But in Linux repositories it is often outdated version of ffmpeg and to get most recent features you'd better compile it from source. It is not a trivial things to get all needed dependencies, that's why I have gathered it all in one bash script.

Script to install ffmpeg + h264, AAC, MP3, Theora and other essential codecs in Ubuntu Linux from source codes.


sudo apt-get update
sudo apt-get -y install autoconf automake build-essential git libass-dev libfaac-dev libgpac-dev libmp3lame-dev libopus-dev libtheora-dev libtool libvorbis-dev libvpx-dev pkg-config texi2html yasm zlib1g-dev

tar xf yasm-1.2.0.tar.gz
cd yasm-1.2.0
make install
cd ..

# x264
git clone --depth 1 git://
cd x264
./configure --prefix="$HOME/ffmpeg_build" --bindir="/usr/bin" --enable-static
make install
cd ..

# fdk-aac
git clone --depth 1 git://
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make install
cd ..

# ffmpeg
git clone --depth 1 git://
cd ffmpeg
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="/usr/bin" --enable-gpl --enable-libass \
  --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora \
  --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
make install
cd ..

just save this scipt to file e.g "" and make

sudo chmod a+x
sudo ./

the most recent version of this script could be found in this Gist

comments powered by Disqus
Kuzminov "iJackUA"
Web Team Lead
at MobiDev (Kharkiv, Ukraine)
Code in Ruby and Elixir, but still love PHP. Explore ES6 and Vue.js. Explore databases, use Ubuntu and MacOS, think about IT people and management