I am available for freelance work! Click here to email me.

Converting Videos with Rails: Installing FFMPEG

June 2nd, 2008

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

(Possibly) Related Posts

Recommend Me

If you found this post or anything else on this site of any use, then please take the time to recommend me on Working with Rails.

You can follow any responses to this entry through the RSS 2.0 feed. Trackback from your own site.

  • Hello,

    I had problems after installation. When I run ffmpeg it returns the error:

    ffmpeg: symbol lookup error: ffmpeg: undefined symbol: swscale_version

    Someone can help me?
  • How do I install the dependencies with Fedora Core 7???
  • Matz
    Hi Jim,

    do you ever want to complete the third part of your series using ffmpeg ?
    -> Converting Videos with Rails: Using Background Processes


    That would be really great.

    THX and regards from Germany

    Matz
  • You know what, I think ffmpeg can be installed now (at least on ubuntu hardy) simply via:

    sudo apt-get install ffmpeg
  • Here are some problems I ran into as well.

    1. With my /etc/apt/sources.list on ubuntu hardy, I needed to add 'multiverse' to the end of each of the lines so it looked like the following


    deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse

    deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse

    deb http://security.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
    deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted universe multiverse


    Then I ran sudo aptitude update to let ubuntu know I updated my sources list.

    2. I couldn't find libfaad2-dev for ubuntu hardy so I installed libfaad-dev instead using apt-get install
  • Chris
    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!
  • Chris
    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!
blog comments powered by Disqus
Purify - Issue Tracker

Jim Neath is a 26 year old Freelance Ruby on Rails developer from Manchester, UK.

Recommend Me

Categories