How-To Build FFmpeg on Debian Squeeze
It’s been a long time now since I wrote my original How-To for building FFmpeg on Debian. A lot has changed since then, in both the Debian and FFmpeg world, so it’s definitely time for an update.
This tutorial describes how to build x264 and FFmpeg from scratch, on a base Debian Squeeze system. Throughout this tutorial I will be assuming that you are operating as either root or su, or aware of how to use sudo (make sure you’ve added yourself to the /etc/sudoers list).
First, we need to update the sources list. I use pico as my text editor, as I was a long time Pine mail user way back when. Feel free to use vi or emacs if you prefer.
Go to the Debian Multimedia repository site and download the keyring package. Follow the instructions for unpackaging it about half-way down the front page. Now update your sources list:
>pico /etc/apt/sources.list
Add deb http://www.debian-multimedia.org squeeze main on a new line and save the file.
>aptitude update
>aptitude full-upgrade
Now you’re using the latest sources and packages.
Next, install all the additional libraries we’ll need:
>aptitude install install build-essential subversion git-core yasm libgpac-dev libdirac-dev libgsm1-dev libschroedinger-dev libspeex-dev libvorbis-dev libopenjpeg-dev libdc1394-dev libsdl1.2-dev zlib1g-dev texi2html libfaac-dev libfaad-dev libmp3lame-dev libtheora-dev libxvidcore4-dev libopencore-amrnb-dev libopencore-amrwb-dev
Once that has successfully completed, it’s time to grab the latest x264 code:
>git clone git://git.videolan.org/x264.git
>cd x264
>./configure –enable-shared
>make
>make install
Hopefully all is still going well and you encountered no errors so far. Great, let’s grab FFmpeg from Subversion:
>svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
>cd ffmpeg
Now to configure FFmpeg. There’s so many options, it’s sometimes hard to know which ones to choose. The list below is my personal preference, but do try ./configure –help to assist in choosing your own.
>./configure –enable-gpl –enable-postproc –enable-pthreads –enable-libfaac –enable-libfaad –enable-libmp3lame –enable-libtheora –enable-libx264 –enable-shared –enable-nonfree –enable-libvorbis –enable-libgsm –enable-libspeex –enable-libschroedinger –enable-libdirac –enable-avfilter –enable-avfilter-lavf –enable-libdc1394 –enable-libopenjpeg –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-version3
After a successful configuration, all the enabled decoders, encoders and muxers will be displayed. There are some configuration dependencies here. If you don’t –enable-gpl things like postproc will fail at build time. Next….
>make
>make install
“Make” will probably take quite a long time.
Optionally you may like to build qt-faststart as well. If you don’t know what this does, use Google, but in short it arranges atoms in QuickTime header files to allow for progressive download delivery.
>make tools/qt-faststart
If you try to use FFmpeg now, by simply typing “ffmpeg” you are likely to encounter an error regarding shared libraries (we did build FFmpeg with –enable-shared). To fix this we do the following:
>pico /etc/ls.so.conf
Add the line “/usr/local/lib” (without quotes) to this file and then save it. Read more about dynamically linked libraries here, specifically the fourth paragraph to explain what we just did.
>ldconfig
That’s it! Finished. Pretty easy, right? Now you just need to learn how to use FFmpeg, but that’s a topic for another day. Very briefly though, here’s a command line for creating a 2-pass H264 file, at 750kbps and 480×360 resolution, in a mov container, with progressive download enabled.
>ffmpeg -y -i inputfile.mpg -pass 1 -vcodec libx264 -vpre fastfirstpass -s 480×360 -b 750k -bt 750k -threads 0 -f mov -an /dev/null && ffmpeg -deinterlace -y -i inputfile.mpg -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -s 480×360 -b 750k -bt 750k -threads 0 -f mov outputfile.mov
>/tools/qt-faststart outputfile.mov outputfilefast.mov
./configure enable-shared
Unknown option enable-shared, ignored
Found yasm 0.8.0.2194
Minimum version is yasm-1.0.0
If you really want to compile without asm, configure with –disable-asm.
No joy at all using debian sqeeze.
I was able to install yasm-1.0 on squeeze using this repository:
http://www.saillard.org/debian/debian-squeeze/yasm/
Worked. For the yasm error run:
aptitude -t squeeze-backports install yasm
also /usr/local/lib may already be called by checking:
cat /etc/ld.so.conf
I was able to build ffmpeg 0.11.1 on squeeze. I had to install yasm 1.0 from this repository:
http://www.saillard.org/debian/debian-squeeze/yasm/
Hey,
I have the same error, can we add -disable-asm ?
I have the same problem, any ideas how to resolve it?