This is the first of a three part series covering how to convert videos using the marvellous FFMPEG library. Video converison is a must have if you are planning on creating a social network site.
In this part I’ll be covering how to install FFMPEG on Ubuntu Hardy Heron (8.04).
Install FFMPEG Dependencing
First off, you need to download and install the dependency packages for FFMPEG. Without these, it’ll all go tits. So it’s a good thing to sort out.
sudo apt-get install build-essential subversion libx264-dev libdts-dev libswscale-dev liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev
The lib* files help you to convert various video formats into flash videos, or which ever format you wish. Subversion is needed so you can download the FFMPEG source.
Check Out FFMPEG Source
Next, you need to checkout the current FFMPEG source from subversion. So let’s do that:
mkdir src
cd src
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
Bosh! We now have the FFMPEG source on our server. So far so good.
Compiling FFMPEG
Now we’re ready to compile to beast. Make sure you’re in the ffmpeg directory that we just downloaded. Then run the configure command:
./configure --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-liba52 --enable-libdc1394 --enable-libgsm --enable-libfaad --enable-libfaac --enable-libxvid --enable-pthreads --enable-libx264 --enable-shared--enable-postproc --enable-avfilter-lavf --enable-swscale --enable-avfilter
Then we’re ready to compile:
make
sudo make install
This will take ages. So don’t worry if it seems to be going on for a while. The last time I did it, it took about 5 minutes or so.
Hopefully, once that’s finished, you should be ready to rock.
Testing FFMPEG
Now, hold your breath and type:
ffmpeg -v
You should now get a load of blurb along the lines of:
jim@jim-ubuntu:~$ ffmpeg -v
FFmpeg version SVN-r13207, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-libvorbis --enable-libtheora --enable-liba52 --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libxvid --enable-pthreads --enable-libx264 --enable-shared --enable-swscale --enable-avfilter --enable-postproc --enable-avfilter-lavf
libavutil version: 49.6.0
libavcodec version: 51.57.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
libavfilter version: 0.0.0
built on May 21 2008 11:55:20, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
ffmpeg: missing argument for option '-v'
If you don’t get anything similiar to the above, then you’ve fucked it. Check the FFMPEG docs or post here and I’ll try and help you out.
More In This Series
- Converting Videos with Rails: Installing FFMPEG
- Converting Videos with Rails: How to Convert Videos
- Converting Videos with Rails: Using Background Processes


4 Responses to “Converting Videos with Rails: Installing FFMPEG”
[...] How to Install FFMPEG [...]
[...] you’ve installed FFMPEG. Now it’s time to move onto converting the video. For this we’re going to be using a [...]
Thanks for this great post (all 3 parts)!
Today I decided to write an online video conversion tool as part of a pet project of mine and I thought, “hey, this is a good excuse to learn Ruby on Rails!” Then about 5mins later I found your blog post. Fits the bill perfectly!
Here are a couple of problems I ran into and how I solved them:
1. When running ./configure, some libraries were not found. For each missing lib, I went to http://packages.ubuntu.com/ and searched for the lib name, then did an “apt-get install” for the most likely-sounding module.
2. When running make, the libx264 library caused some errors so I simply reran ./configure without the –enable-libx264 flag.
3. When I tested with “ffmpeg -v” the newly installed libs weren’t found. I ran ldconfig to update the libs cache and that solved it.
Hope this helps somebody!