How to install FFmpeg on Linux?

On Ubuntu or Debian based linux operating systems using apt-get installed makes installation of FFMPEG is easy:

$ sudo apt-get update 
$ sudo apt-get install ffmpeg 

This will install the latest FFMPEG package but some linux users will want to install from source. FFMPEG requires compilation and installation of various codecs and libraries not bundled with FFMPEG source code.

Linux users who want to configure extra dependencies are required to install from source. Here’s an example of install dependencies, given from the FFMPEG wiki:

cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://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" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --extra-libs="-lpthread -lm" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libaom \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree && \
PATH="$HOME/bin:$PATH" make && \
make install && \
hash -r

Source: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!

buy now on amazon