Ubuntu: Compiling ffmpeg from source

Ubuntu uses avconv instead of ffmpeg. It also doesn’t have a package for libswresample. This can be problematic at times. So I resorted to installing ffmpeg from source. You need the following packages to compile ffmpeg from source.

sudo apt-get install yasm pkg-config

Lets clone the ffmpeg repository and compile it.

git clone https://github.com/FFmpeg/FFmpeg.git FFmpeg
cd FFmpeg
./configure --prefix=/usr/local/ffmpeg --enable-shared
sudo make install

After the above step successfully completes, ffmpeg should be installed in /usr/local/ffmpeg directory. Since we have installed ffmpeg in non standard location, we have to set PKG_CONFIG_PATH and LD_LIBRARY_PATH correctly. Add these lines at the end of your ~/.bashrc.

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ffmpeg/lib/pkgconfig/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ffmpeg/lib/