This guide for supported releases of Ubuntu, Debian, and Linux Mint will provide a local install of the latest FFmpeg tools and libraries including several external encoding and decoding libraries (codecs). This will not interfere with repository packages.
You may also refer to the Generic FFmpeg Compilation Guide for additional information.
Recent static builds are also available for lazy people or those who are unable to compile.
Copy and paste the whole code box for each step.
sudo apt-get update sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \ libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \ libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev mkdir ~/ffmpeg_sources
Notes:
You can compile ffmpeg to your liking. If you do not require certain encoders you may skip the relevant section and then remove the appropriate ./configure option in FFmpeg. For example, if libopus is not needed, then skip that section and then remove --enable-libopus from the Install FFmpeg section.
This guide is designed to be non-intrusive and will create several directories in your home directory:
You can easily undo any of this as shown in Reverting Changes Made by This Guide.
An assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.
If your repository offers a yasm package ≥ 1.3.0 then you can install that instead of compiling:
sudo apt-get install yasm
Otherwise you can compile:
cd ~/ffmpeg_sources wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz tar xzvf yasm-1.3.0.tar.gz cd yasm-1.3.0 ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install make distclean
H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples.
Requires ffmpeg to be configured with --enable-gpl --enable-libx264.
If your repository offers a libx264-dev package ≥ 0.118 then you can install that instead of compiling:
sudo apt-get install libx264-dev
Otherwise you can compile:
cd ~/ffmpeg_sources wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 tar xjvf last_x264.tar.bz2 cd x264-snapshot* PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static PATH="$HOME/bin:$PATH" make make install make distclean
AAC audio encoder. See the AAC Audio Encoding Guide for more information and usage examples.
Requires ffmpeg to be configured with --enable-libfdk_aac (and --enable-nonfree if you also included --enable-gpl).
sudo apt-get install unzip cd ~/ffmpeg_sources wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master unzip fdk-aac.zip cd mstorsjo-fdk-aac* autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
MP3 audio encoder.
Requires ffmpeg to be configured with --enable-libmp3lame.
If your repository offers a libmp3lame-dev package ≥ 3.98.3 then you can install that instead of compiling:
sudo apt-get install libmp3lame-dev
Otherwise you can compile:
sudo apt-get install nasm cd ~/ffmpeg_sources wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar xzvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared make make install make distclean
Opus audio decoder and encoder.
Requires ffmpeg to be configured with --enable-libopus.
If your repository offers a libopus-dev package ≥ 1.1 then you can install that instead of compiling:
sudo apt-get install libopus-dev
Otherwise you can compile:
cd ~/ffmpeg_sources wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz tar xzvf opus-1.1.tar.gz cd opus-1.1 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
VP8/VP9 video encoder and decoder. See the VP8 Video Encoding Guide for more information and usage examples.
Requires ffmpeg to be configured with --enable-libvpx.
cd ~/ffmpeg_sources wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2 tar xjvf libvpx-v1.3.0.tar.bz2 cd libvpx-v1.3.0 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples PATH="$HOME/bin:$PATH" make make install make clean
Note: Server users can omit --enable-x11grab (this option is for x11 screen grabbing).
cd ~/ffmpeg_sources wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xjvf ffmpeg-snapshot.tar.bz2 cd ffmpeg PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="$HOME/ffmpeg_build" \ --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-libass \ --enable-libfdk-aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libtheora \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-nonfree \ --enable-x11grab PATH="$HOME/bin:$PATH" make make install make distclean hash -r
Installation is now complete and ffmpeg is now ready for use. Your newly compiled FFmpeg programs are in ~/bin. To use it:
You can tell your shell (assuming you're using Bash) to persistently use your new ffmpeg in ~/bin. The first command will allow you to simply run man ffmpeg to get the FFmpeg man pages. The second command will source ~/.profile which will add ~/bin to your $PATH. In short, the following commands will allow you to simply type ffmpeg and man ffmpeg in your terminal and they will "just work":
echo "MANPATH_MAP $HOME/bin $HOME/ffmpeg_build/share/man" >> ~/.manpath . ~/.profile
Note:
See Ubuntu Wiki: Persistent Environment Variables for more info.
Development of FFmpeg is active and an occasional update can give you new features and bug fixes. First you need to delete (or move) the old files:
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm}
Now just follow the guide from the beginning.
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm} sudo apt-get autoremove autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \ libmp3lame-dev libopus-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \ libvorbis-dev libvpx-dev libx11-dev libx264-dev libxext-dev libxfixes-dev texi2html zlib1g-dev sed -i '/ffmpeg_build/c\' ~/.manpath hash -r