That took some time to figure out… I’ve tried at least 6 different articles from the top Google results, none worked and most were outdated.

Anyways, no commitment here either, it worked for me, but I’m no Debian expert.. so use at your own risk.

First – Add the new multimedia packages –

Selec All Code:
1
vi /etc/apt/sources.list

Add the following lines:

Selec All Code:
1
2
deb http://www.deb-multimedia.org squeeze main non-free
deb http://www.deb-multimedia.org squeeze-backports main

Install all the dependancies and build tools –

Selec All Code:
1
apt-get install build-essential subversion git-core yasm libgpac-dev libdirac-dev libgsm1-dev libschroedinger-dev libspeex-dev libvorbis-dev libopenjpeg-dev libdc1394-22-dev libsdl1.2-dev zlib1g-dev texi2html libfaac-dev libfaad-dev libmp3lame-dev libtheora-dev libxvidcore4-dev libopencore-amrnb-dev libopencore-amrwb-dev libvpx-dev libfreetype6-dev frei0r-plugins-dev librtmp-dev libaacplus-dev libx264-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev

Build and Install x264 –

Selec All Code:
1
2
3
4
5
6
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-shared
make
make install
cd ..

Install libxavs

Selec All Code:
1
2
3
4
5
6
svn co https://xavs.svn.sourceforge.net/svnroot/xavs/trunk xavs
cd xavs
./configure --enable-shared --disable-asm
make
make install
cd ..

Build and Install FFMPEG

Selec All Code:
1
2
3
4
5
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-shared --enable-libx264 --enable-gpl
make
make install

Install qt-faststart –

Selec All Code:
1
2
make tools/qt-faststart
make install tools/qt-faststart

Add lavf support to x264 –

Selec All Code:
1
2
3
4
5
cd ../x264
make distclean
./configure --enable-static
make
make install

Finish by calling ldconfig.

Test by calling ffmpeg -version which should output something like below:

Selec All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
ffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 13 2012 14:01:54 with gcc 4.4.5
  configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libfreetype --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
ffmpeg 0.7.13
libavutil    50. 43. 0 / 50. 43. 0
libavcodec   52.123. 0 / 52.123. 0
libavformat  52.111. 0 / 52.111. 0
libavdevice  52.  5. 0 / 52.  5. 0
libavfilter   1. 80. 0 /  1. 80. 0
libswscale    0. 14. 1 /  0. 14. 1
libpostproc  51.  2. 0 / 51.  2. 0
  • but wait, there’s more codecs to install 😉

    libvpx and LAME are two sides of the patent coin.http://ffmpeg.org/trac/ffmpeg/wiki/CentosCompilationGuide

  • you can certainly compile many more codecs…
    btw – if you’d really like to go the easy way, don’t compile at all.. after adding the repos above, you can just call apt-get install ffmpeg

  • Blizzz_zzz

    What do you mean by calling idconfig?

  • Blizzz_zzz

    I do 
    /sbin/ldconfig -X -N

    But my ffmpeg still not working as i would

    here is my command:
    ffmpeg -i “source.mkv” -an -b 700k -r 25 -vcodec libx264 “output.mp4”

    i get an “unkow encoder : libx264”
    Any ideas?Thanks

  •  I have the same problem

  • Aspgraver

    Many thanks for the article, I also could not find a normal manual installation.

  • Christian

    Thanks for the tutorial 🙂 I found only outdated tutorials.

  • Lou L

    This guide is bad.
    * Development packages for x264 and ffmpeg are listed as dependencies
    although you are going to be compiling x264 and ffmpeg from source.

    * It installs stuff outside of the package management system.

    * ‘–enable-shared’ is used for almost everything for no apparent
    reason.

    * Several useless packages are installed (libfaad-dev) and some
    external libraries are very questionable as to their usefulness for
    the general public.

    * None of the many external libraries that are installed are actually
    enabled in the ffmpeg configure step! For example, to enable libx264 you need
    ‘–enable-gpl’ and ‘–enable-libx264’.A better option is to adapt:http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideHardy

  • Andry Kindler

     

    This blog post is excellent probably because of how well the
    subject was developped. I like some of the comments too though I would prefer
    we all stay on the suject in order add value to the subject!

    remote
    computer repair

  • @google-d74877a33438159b34453e6513bb8ff0:disqus – Thanks for the review and sharing your thoughts. You can see that from calling ffmpeg -version x264 and gpl are enabled along other things.
    My install guide above is merely my share of what worked for me, this is certainly not the officially recommended option by anyone. When writing this, I have tested with the link you provided (http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideHardy) , and have found it wasn’t enough for my case (Debian Squeeze).

    @google-dfe1af0774d1aba8b5a9751b43810d6e:disqus – thanks for the comment!  

  • Tango!

    Thanks! Worked like a charm!

  • aster1sk

    Add a `apt-get build-dep ffmpeg` in there to be sure all ffmpeg deps are satisfied.

  • yearisaday musicblog

    Hi Zohar,

    Thanks for these instructions. I just wanted to report that ffmpeg now (February 2013) requires yasm 1.2.0 and the apt repository still has 1.1.0, so I had to build yasm separately to then get ffmpeg to build.

    http://yasm.tortall.net/releases/Release1.2.0.html

  • Alex Benedek

    תודה כפרה עליך !!!!