Installing FFMPEG and FFMPEG-PHP in Fedora 8 running on Amazon EC2
I’ve spent a bit of time working with Amazon EC2 recently. One of the things I’ve been working on is getting a stable build of FFMPEG and FFMPEG-PHP running on a Fedora 8 image in Amazon EC2. This is essentially going to be a tutorial to get things up and running. Of course, your milage may vary.
These instructions apply to a 32-bit Fedora 8 installation. The hardware I primarily use happens to be on EC2, but these instructions aren’t specific to EC2. You may need to tweak things a smidge for an x64 system.
Preparing the LAMP stack (and a few other things)
For FFMPEG-PHP to work, you need to have a web server with PHP support up and running. You’ll definitely need GD for image processing and mbstring is helpful in conjunction with PHP5’s built-in iconv support for managing multiple character sets in ID3 tags.
- Install PHP, necessary extensions and supporting software.
yum -y install php-devel php-gd php-mbstring gcc gcc-c++ libtool svn git yasm gsm-devel libogg-devel libvorbis-devel libtheora-devel;
- Also, I like to create a directory with symlinks to important files so that I can access everything more efficiently. These will be used throughout this tutorial.
mkdir /www-config; \ ln -s /etc/init.d/httpd /www-config/httpd; \ ln -s /etc/httpd/conf/httpd.conf /www-config/httpd.conf; \ ln -s /var/log/httpd/ /www-config/logs; \ ln -s /usr/lib/php/modules/ /www-config/php5-extensions; \ ln -s /etc/httpd/conf.d/php.conf /www-config/php.conf; \ ln -s /etc/httpd/conf.d/ /www-config/apache-conf; \ ln -s /etc/php.ini /www-config/php.ini; \ ln -s /etc/php.d/ /www-config/php-ini; \ ln -s /var/www/html/ /www-config/public-html; \ /www-config/httpd restart;
PHP 5.x should now be installed and you should have a directory prepared that lets you easily access important files for managing your configuration.
Installing FFMPEG
FFMPEG can be fairly complicated to get running properly, so here’s what I’ve gotten working thus far.
- Download FFMPEG source. Export the latest FFMPEG trunk from Subversion, then change to the source directory.
svn export svn://svn.mplayerhq.hu/ffmpeg/trunk /ffmpeg-trunk-source; \ cd /ffmpeg-trunk-source;
- Install x264. Export the latest x264 trunk from Git. Enter the directory, make, install, and go back to the parent directory.
git clone git://git.videolan.org/x264.git; \ cd x264; \ ./configure --prefix=/usr --enable-shared --enable-pthread; \ make; \ make install; \ cd ..;
- Install liba52. Download the latest version of liba52 (Currently 0.7.4). Decompress the package, enter the directory, run configure, make, install, and go back to the parent directory.
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz; \ tar -zxvf a52dec-0.7.4.tar.gz; \ cd a52dec-0.7.4; \ ./configure --prefix=/usr --enable-double; \ make; \ make install; \ cd ..;
- Install FAAC. Download the latest version of FAAC (Currently 1.26). Decompress the package, enter the directory, create the configure file, run configure, make, install, and go back to the parent directory.
wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz; \ tar -zxvf faac-1.26.tar.gz; \ cd faac; \ autoreconf -vif; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ..;
- Install FAAD. Download the latest version of FAAD (Currently 2.6.1). Decompress the package, enter the directory, create the configure file, run configure, make, install, and go back to the parent directory.
wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz; \ tar -zxvf faad2-2.6.1.tar.gz; \ cd faad2; \ autoreconf -vif; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ..;
- Install LAME. Download the latest version of LAME (Currently 3.98b8). Decompress the package, enter the directory, run configure, make, install, and go back to the parent directory.
wget http://downloads.sourceforge.net/lame/lame-3.98b8.tar.gz; \ tar -zxvf lame-3.98b8.tar.gz; \ cd lame-3.98b8; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ..;
- Install libmpeg2. Download the latest version of libmpeg2 (Currently 0.4.1). Decompress the package, enter the directory, run configure, make, install, and go back to the parent directory.
wget http://libmpeg2.sourceforge.net/files/mpeg2dec-0.4.1.tar.gz; \ tar -zxvf mpeg2dec-0.4.1.tar.gz; \ cd mpeg2dec-0.4.1; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ..;
- Install Xvid. Download the latest version of Xvid (Currently 1.1.3). Decompress the package, enter the directory, run configure, make, install, and go back to the parent directory.
wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz; \ tar -zxvf xvidcore-1.1.3.tar.gz; \ cd xvidcore-1.1.3/build/generic; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ../../../;
- Install AMR/3GPP. Download the latest version of AMR (Currently 7.0.0.1). Decompress the package, enter the directory, run configure, make, install, and go back to the parent directory.
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.1.tar.bz2; \ tar -jxvf amrnb-7.0.0.1.tar.bz2; \ cd amrnb-7.0.0.1; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ../;
- Compile FFMPEG. Configure, make, and install the software, including all options that enable enhanced functionality.
./configure --prefix=/usr --enable-static --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-liba52 --enable-liba52bin --enable-libamr-nb --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid; \ make; make install;
Installing FFMPEG-PHP
Once you have FFMPEG functioning properly, you can install the FFMPEG-PHP extension.
- Download and install FFMPEG-PHP source. Enter the directory, download the source, run phpize, configure, make, install, and go back to the parent directory.
cd /ffmpeg-trunk-source; \ wget http://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2; \ tar -jxvf ffmpeg-php-0.5.3.1.tbz2; \ cd ffmpeg-php-0.5.3.1; \ phpize; \ ./configure --prefix=/usr; \ make; \ make install; \ cd ..;
- Add FFMPEG-PHP to the PHP configuration.
echo "extension=ffmpeg.so" > /www-config/php-ini/ffmpeg.ini
- Restart Apache.
/www-config/httpd restart
FFMPEG and FFMPEG-PHP should now be installed and ready to go. Make sure to check your error log if something isn’t working properly.
cat /www-config/logs/error_log
Yahoo! Messenger redesign is live!
Internally known as “Aurora,” the new Yahoo! Messenger redesign has finally launched! I was going to write something up about it, but Ryan Doherty and Adrien Cahen have all written plenty. Check it out!
Also, Digg it! http://digg.com/tech_news/New_Yahoo_Messenger_website_is_LIVE
My thoughts on Twitter
Twitter has tweaked their design as of this morning, and they added a link titled “Tell us your story,” in which they ask about your thoughts as a Twitter user. Here’s what I had to say.
I’m an information junkie with a limited attention span. Twitter has all of the interesting links and thoughts of a Digg, Newspond, del.icio.us, or Ma.gnolia, but is filtered by people I follow, giving me a much higher signal to noise ratio for links and services that require my attention (or that I may want to give my attention to).
I’m interested in what people are thinking about. Twitter is perfect for this. “Tell us what you’re doing, in 140 characters or less” is fantastic because it forces the short, to-the-point posts. As a “thought publisher” on Twitter, it’s less demanding than, say, writing a blog post.
I work on a couple of open-source projects, as well as a commercial project. We’ve configured our subversion post-commit hook to trigger a Twitter update containing the log message. As we all work on the project throughout the day, I’m able to have up-to-the-minute notifications that tell me where in the development process we are at any given time. My commercial project has protected updates, and my open-source project has public updates so that our technically-oriented end-users can follow progress.
Twitter has become an indispensable utility for me. Being a Mac user, Twitter is as critical of a utility to me as Mail, Address Book, QuickSilver, Growl, and Adium. I don’t have to put a lot of time and effort into it, it has a very specific purpose, and I can engage with it passively if I choose to (I receive Growl notifications via Twitterrific, for example).
Twitter is interesting, useful, and non-demanding (both as a “publisher” of tweets as well as a “consumer” of tweets).
My only half-hearted complaint is that the Flash widgets are ugly as sin, but that’s why we have RSS feeds and open-source tools such as SimplePie to parse them, right?
![]()
