Installing FFMPEG from source on Ubuntu 14.0.4

Replace paths with where you like, but make sure you change also in my guide!

#go to opt folder, make directories, make directories if not exits
$cd /opt/dev-tools-sources
$mkdir ffmpeg
$cd ffmpeg

#make build and bin directories
$mkdir build
$mkdir bin

#clone the repo
$git clone https://github.com/FFmpeg/FFmpeg.git source

#go to the source dir
$cd source

#install required packages
$sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev

#install yasm compilre
$sudo apt install yasm

#instal h264 lib
$sudo apt install libx264-dev

#configure
$./configure –prefix=”/opt/dev-tools-sources/ffmpeg/build” –bindir=”/opt/dev-tools-sources/ffmpeg/bin” –enable-gpl –enable-libx264 –enable-static –enable-shared

#make
$make -j4

#install
$sudo make install

#do not forget to add “/opt/dev-tools-sources/ffmpeg/bin” to you environment. eg in /home/usr/.profile

#you may face problem with ffmpeg binary can not find libavdevice.so.XX where XX is a number e.g. 57
#to fix this, first find out where it has been compiled in the make step:
$sudo find / -name libavdevice.so.57

#the output of the find should look like something like this:
/opt/dev-tools-sources/ffmpeg/build/lib/libavdevice.so.57
/opt/dev-tools-sources/ffmpeg/source/libavdevice/libavdevice.so.57

#now that you have found where the libavdevice is, you have to make it available to system by ldconfig
#to do so, go to /etc/ld.so.conf.d folder
$cd /etc/ld.so.conf.d

#now make a new config file
$sudo nano ffmpeg.conf

#add the following content to the file (replace where actually you libavdevice.so.XX is!!!!)
/etc/ld.so.conf.d

#save and exit the nano editor

#now update the ldconfig by just calling it
$sudo ldconfig

#If you need to use header files provide by ffmpeg for other stuff, like opencv, you can find them here:

/opt/dev-tools-sources/ffmpeg/build/include

#ENJOY!

Saeid Yazdani

An Electronics Engineer with passion in Embedded Systems, Wireless Sensor Networks, Assembly, Desktop and Mobile Development, Web Development and generally anything that has to do with hardware and software of any kind!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.