edoceo

Building ffmpeg on Ubuntu Linux | Edoceo's Blog

Building ffmpeg on Ubuntu Linux

Recently decided to take advantage of some ffmpeg new latest features on an Ubuntu system. Here’s what had to be done to get it ready.

First, install all the necessary Ubuntu packages.

aptitude install git-core nasm 
  libswscale-dev libavcodec-dev libavformat-dev 
  libvorbis-dev libtheora-dev 
  liblame-dev liblame0  libgsm1-dev libgsm-tools libgsm1  
  libfaad2-dev libfaac-dev libgpac-dev  
  libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev 
  libdc1394-13-dev 

Then, make a location for the source and export the newest stuff!

cd /usr/src
git clone git://git.videolan.org/x264.git 
cd x264
./configure --prefix=/usr --enable-pthread --enable-shared 
  --enable-mp4-output --enable-pic
make
make install

mkdir /usr/src/ffmpeg-trunk
cd /usr/src
svn export svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg-trunk
cd ffmpeg-trunk
./configure --enable-gpl --enable-shared --enable-swscale --enable-pthreads 
  --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libgsm 
  --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 
  --disable-debug --extra-version 'edoceo'
make

Now there is this custom ffmpeg stored in /usr/src/ffmpeg-trunk/. If it fails you’ll need to search for the necessary -dev package with apt-cache search libXXX

I choose to leave it here, notice I did not indicate to run make install. This means I have Ubuntu standard ffmpeg in the path, as the distribution expects it and the custom stuff stays out of the main system. Just have to remember the full path every time.

The ffmpeg that is built will not have some of it’s lib files installed in an expected location (because we left off the make install). So we’ll have to sym-link them into place

cd /usr/src/ffmpeg-trunk
ln -s libswscale/libswscale.so.0 ./
ln -s libavdevice/libavdevice.so.52 ./
ln -s libavformat/libavformat.so.52 ./
ln -s libavcodec/libavcodec.so.52 ./
ln -s libavutil/libavutil.so.49 ./

Then run this custom ffmpeg as follows

LD_LIBRARY_PATH="/usr/src/ffmpeg-trunk" /usr/src/ffmpeg-trunk/ffmpeg [options] [outfile]

Another option, common for us is to specify a new prefix, such as --prefix=/opt/ffmpeg-trunk then install there.

http://blog.edoceo.com/
  • http://linux.goeszen.com/ Zen of Linux

    VERY helpful post, worked 98% for me!