A bunch of us have begun working on a new codebase for Indymedia, based on CakePHP. I’m not exactly Captain PHP, so there’s going to be a bit of a learning curve for me, but we’ll see how it goes.
One of the things I am interested in setting up is some kind of FLV video conversion system for the new CMS. There’s a nice pleasant-looking PHP library to deal with the FFmpeg video conversion utility on the server side (is anybody in the Rails world noticing this?), so here’s my experience installing it on Ubuntu.
First things first. Enable the universe repositories, and then install ffmpeg. Keep in mind that the ffmpeg binaries in Ubuntu are built without the necessary MP3 support (for patent reasons) to actually encode sound in FLV files. In addition, if you install the “normal” FFMpeg binaries from the Ubuntu repositories, you won’t get the development headers necessary to compile the ffmpeg-php code. So, let’s do things the hard way and compile FFMpeg from source, so we have everything working.
I’ll outline the basic steps here. First, you need the mp3 libraries:
apt-get install liblame-dev
Next, you need to get ready to build FFMpeg from source:
sudo apt-get install liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 \
liba52-0.7.4-dev libx264-dev libdts-dev libgsm1-dev libvorbis-dev libdc1394-13-dev \
checkinstall build-essential gcc
Get the FFMpeg source:
cd /usr/local/src
sudo apt-get source ffmpeg
cd ffmpeg-*
sudo ./configure --enable-gpl --enable-pp --enable-libvorbis --enable-libogg \
--enable-liba52 --enable-libdts --enable-dc1394 --enable-libgsm --disable-debug \
--enable-libmp3lame --enable-libfaad --enable-libfaac --enable-xvid --enable-pthreads \
--enable-x264 --enable-shared --prefix=/usr
The second-last option,—enable-shared, should allow the php5 script to find the FFMpeg shared libraries so that ffmpeg-php can compile properly.
sudo make
sudo checkinstall
When you do the checkinstall, it’ll ask you a bunch of questions so that it can build you a .deb package and install it. For most of them you can just accept the defaults. I set the package description to FFMpeg video conversion utility, and I set the version to 3:0.cvs20070308-5ubuntu4. This makes the package you’re making slightly newer than the one in the regular Ubuntu repositories, so Ubuntu won’t hassle you all the time, taunting you with a newer version of the package when you log in.
Ok, that was a big hassle, I know. But it should get you video encoding capability.
The next thing I did was download the latest release of ffmpeg-php from http://ffmpeg-php.sourceforge.net/ and extracted it on my machine. The first thing you need to do at that point is to run a utility called “phpize” in order to set up some configuration files for your machine. However, Ubuntu doesn’t include phpize in the main php package, so you’ll need to do this first:
apt-get install php5-dev
Then cd into the ffmpeg-php-0.X.X directory (maybe you extracted it on your desktop?), and run the following command to generate a config script:
phpize5
You can then do this to build the library:
./configure && make
And finally this to install it:
sudo make install
Now you’ve got ffmpeg support for PHP, and an FFMpeg binary installed that will do its stuff with sound encoding capabilities.
