How To: Install Current FFmpeg and FFmpeg-PHP in CentOS/RHEL with x264, Xvid, MP3, AAC and more!

First of all, I’m going to assume you already have httpd and php installed. If you don’t have them already you should install them now. I recommend Jason Litka’s Yum Repository.

This guide is written with bash comments, so the whole text block below can be copied and pasted into an install.sh file if you’d rather not go through step by step. I wouldn’t recommend it though, as something could always go wrong, and it could be challenging hunting down the problem in that massive wall of output lines!

#!/bin/bash
# Mplayer Codecs
# Switch to working directory
cd /usr/local/src

# Download the codec files needed 
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2

# Extract the codec files 
bunzip2 essential-amd64-20071007.tar.bz2; tar xvf essential-amd64-20071007.tar

# Create a directory for the codecs & import them 
mkdir /usr/local/lib/codecs/ 
mv essential-amd64-20071007/* /usr/local/lib/codecs/ 
chmod -R 755 /usr/local/lib/codecs

# FLVTool2
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz

# Extract the Source files 
tar zxvf flvtool2-1.0.6.tgz 

# Compile
cd /usr/local/src/flvtool2-1.0.6
ruby setup.rb config 
ruby setup.rb setup 
ruby setup.rb install

# LAME MP3 Encoder
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.sourceforge.net/lame/lame-398-2.tar.gz

# Extract the Source files 
tar zxvf lame-398-2.tar.gz 

# Compile
cd /usr/local/src/lame-398-2
./configure 
make && make install

# libOGG
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4rc1.tar.gz

# Extract the Source files 
tar zxvf libogg-1.1.4rc1.tar.gz 

# Compile
cd /usr/local/src/libogg-1.1.4rc1
./configure 
make && make install

# libVorbis
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gz

# Extract the Source files 
tar zxvf libvorbis-1.2.3.tar.gz

# Compile
cd /usr/local/src/libvorbis-1.2.3
./configure 
make && make install

# liba52
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz

# Extract the Source files 
tar zxvf a52dec-0.7.4.tar.gz

# Compile
cd /usr/local/src/a52dec-0.7.4
./configure --enable-shared=PKGS
make && make install

# libFAAD2
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz

# Extract the Source files 
tar zxvf faad2-2.7.tar.gz

# Compile
cd /usr/local/src/faad2-2.7
autoreconf -vif
./configure --disable-drm --disable-mpeg4ip
make && make install

# libFAAC
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz

# Extract the Source files 
tar zxvf faac-1.28.tar.gz

# Compile
cd /usr/local/src/faac-1.28
./bootstrap
./configure --disable-mp4v2
make && make install

# YASM (required by x264)
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz

# Extract the Source files 
tar zxvf yasm-0.7.0.tar.gz

# Compile
cd /usr/local/src/yasm-0.7.0
./configure
make && make install

# x264 daily snapshot
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20090901-2245.tar.bz2

# Extract the Source files 
bzip2 -d x264-snapshot-20090901-2245.tar.bz2; tar xvf x264-snapshot-20090901-2245.tar

# Compile
cd /usr/local/src/x264-snapshot-20090901-2245
./configure --enable-mp4-output --enable-shared --enable-pthread
make && make install

# XVID
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz

# Extract the Source files 
tar zxvf xvidcore-1.2.2.tar.gz

# Compile
cd /usr/local/src/xvidcore/build/generic
./configure
make && make install

# Install SVN/Ruby 
yum install -y subversion ruby ncurses-devel

# Fix few Lib issues for next steps 
echo "/usr/local/lib" >> /etc/ld.so.conf 
ldconfig -v

# MPlayer Core
# Switch to working directory
cd /usr/local/src

# Get the latest version from the subversion 
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

# Compile
cd /usr/local/src/mplayer 
./configure 
make && make install

# FFMPEG 
# Switch to working directory
cd /usr/local/src

# Get the latest version from the subversion 
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg 

# Compile
cd /usr/local/src/ffmpeg 
./configure --enable-gpl  --enable-postproc --enable-nonfree --enable-postproc --enable-libfaad --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libfaac --disable-ffserver --disable-ffplay --enable-shared
echo '#define HAVE_LRINTF 1' >> config.h 
make && make install

# Finalize the codec setups 
ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50 
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51 
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49 
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0 
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

# Few tasks before compiling FFMPEG-PHP 
yum install -y automake autoconf libtool

# FFmpeg-php
# Switch to working directory
cd /usr/local/src

# Download the source files needed 
wget http://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.6.0.tbz2

# Extract the Source files 
bunzip2 ffmpeg-php-0.6.0.tbz2; tar xvf ffmpeg-php-0.6.0.tar 

# Compile
cd /usr/local/src/ffmpeg-php-0.6.0 
phpize 
./configure 
make 
make install

# Add FFMPEG-PHP as an extension of PHP 
# Add this line to your php.ini file (Check the correct path of php.ini) 
echo "extension=ffmpeg.so" >> /etc/php.ini

# Restart Apache to load FFMPEG-PHP 
service httpd restart

# Cleanup
cd ..
rm -f -r ./ffmpeg-php

Wow! That was long…glad that’s over. Anyway, you should check and make sure it worked by running phpinfo() in php and searching for a block called ‘ffmpeg’. If anyone has any suggestions for improvements to the script or other encoders I should add let me know.

Tiled Maps for XNA – Full support for the Tiled Map XML specification!

UPDATE: There is a newer, better version from here. Thanks, Zach Musgrave!

So yesterday I came across a very basic loader for Tiled Maps (*.tmx) made with the Tiled Map Editor. It only supported the basics–Tileset loading and Layer rendering–so I took it upon myself to complete the loader by adding support for the rest of the features that were left out;

-added ProhibitDtd = false, so you don’t need to remove the doctype line after each time you edit the map.
-changed everything to use SortedLists for named referencing–so much easier
-added objectgroups
-added movable and resizable objects
-added object images
-added meta property support to maps, layers, object groups and objects
-added support for non-binary encoded layer data
-added layer and object group transparency

I created a simple demo to show off some of the features. You should see a partially transparent object with a resized image of Ness (Earthbound) on top of a partially transparent layer of grass with the words “Tile Maps Rule” written in rock with a pulsating opacity. Use the arrow keys to move Ness around. All objects and object groups can have their X and Y coordinates set dynamically, so you can do cool stuff like parallax clouds drifting overhead.

Download the Tiled Maps Loader

Sui Generis – First two album released as Creative Commons, third on the way!

albums

Those that have read the “Whos’ Stephen?” page would know that apart from blogging about anime and video games, I also like to write electronic music. Well, today my first two albums, withStyle and CheCheChe, are being released under the Creative Commons license! Feel free to send the mp3s to anyone you like (or even don’t like?) or use them in YouTube videos or whatever else you might want to use them for. It’s all good, so long as it’s not commercial. If you want to use any of this music commercially let me know, and we can probably work something out. My third album is also nearing completion and will be released here under a Creative Commons license when it’s ready.

withStyle

CheCheChe

Sakanakushon – Like a mellow Asian Kung-Fu Generation with synthesizers!

folder1

I found this band called Sakanakushon on the internet not too long ago and thought their music was pretty catchy, so I wanted to share it with all of you. I have several videos to share with you, so I hope you enjoy them all–I certainly did!

I’ve actually been trying to post this for about a month, but I’ve had some serious problems with my web server and uploading files, so I’ve been unable to actually put in any content other than text, and that’s just no fun, right? As you can see though those issues are all sorted out, so back to posting awesome stuff! I have a bunch of other posts half written and needing images and such, so I’ll try and post like crazy for the next while. I’d really like to be more active on here, and I have a decent bit of free time right now, so I will try and be as active as I can. Hopefully this free time lasts. :D

Native Dancer

Sample

Center Tray

Word

House Rulez – Catchy Korean Funk/House Pop

houserulez

I found a folder entitled “Star House City” sitting on an FTP server the other day and decided to download it just because the name sounded interesting. Turns out that was a good idea. Star House City is the newest album from Korean House Superstars; House Rulez.

The whole album is just fantastic and I had to have every MP3 I could find of theirs. It’s been really hard trying to find stuff from their previous album…I found 10 of the 15 tracks and all of them are labelled wrong, so I can’t even tell what track numbers they are supposed to be. >.>

Check out video for their song “Do It!” below. It’s really catchy, just like all the rest of their songs.

Akikan – A Soda Can Harem.

snapshot20090103203313

Ever wondered what it would be like if you were about to drink a can of melon soda when suddenly it transformed into a cute, young girl? Yeah, me neither–but this bizarre concept turned out to be a win, in my opinion. It sprinkles a fresh twist on the harem genre with a main character that is…well…not some wussy, girl-fearing loner. Instead he is a mountain of sarcasm, topped with a thick layer of innuendo and narcissism.

snapshot20090103202947

Kakeru Daichi is a 16-year-old high school student and collector of aluminum soda cans–he has also been, for all 16 years, single. While on his way home he stops at a vending machine to purchase a melon soda, but he does not anticipate the coming disaster that would unfold. He gets home, has a quick shower and then takes a refreshing sip of his newly purchased lemon soda…only he finishes that sip with a cute blond girl locking lips with him. The girl, known as an Akikan, is glad to have finally transformed into her human form, however; she’s not so glad to find Kakeru lacking any form of clothing short of a towel over his shoulders. Needless to say she freaks and sends him flying with her strange carbonated beverage powers.

snapshot20090103203341

As it turns out, this is not an entirely unusual happening. Soda cans turning into girls have been relatively prevalent lately and are under investigation by the Department of Economy. Leading the investigation is Hidehiko Otoya, a government official who also happens to be flaming gay. He appears at Kakeru’s doorstep with his assistant and starts feeling him up before he even introduces himself. Kakeru is somewhere between panic and shock at this point, so the assistant steps in and tames the overly foward Hidehiko and drags him out the door. Kakeru leaps from disaster to disaster, each more disasterous than the last and all the while still pantsless.

snapshot20090103203157

The premise is certainly an odd one, but the writers did an excellent job of shaping it into something hilarious. The comedy in the show is very blunt and always tries to push the boundary just a bit further. I’m really looking forward to more episodes of this show and is definitely at the top of my watch list so far from this season.

snapshot20090103203230

The music provided a perfect accent to the quirky hilarity that had me laughing all throughout the show and at the same time was quite catchy. Many people underestimate the importance of audio in video medias–try playing a Tales game on mute and you’ll understand what I mean. Audio is a very important aspect in the creation of a good show and this one handled it brilliantly. Not only was the music great, the voices matched perfectly–it’s hard to capture so much sarcasm as Kakeru’s character, but they pulled it off flawlessly.

snapshot20090103203026

I highly recommend anyone that likes a good laugh have a look at this show because it is absolutely brillient. Just don’t watch it too late at night or you might get some angry phone calls from your neighbors. ;)

Gallery

FofR But Better – A modded skin for Foobar2000

fofr-but-better

I made my own personal mod of FofR, a really great skin for Foobar2000, the best audio player software out there.  I liked the design of the original, but found the fonts were a bit to small at 1920×1080 resolution so I changed them…then while I was already digging through the code I added a little button to download album art for the current playing song and fixed some minor graphical glitches that FofR has when viewed at such high resolutions. I might make some more changes, but I’m not sure what else I’d want to do with it yet, so here it is; version 0.1 of FofR But Better.

I’d recommend using version 0.9.5.2 of Foobar2000, as the newer versions broke much of the PanelsUI engine used to make this skin. You can find it here.

Bad Behavior has blocked 395 access attempts in the last 7 days.