HowTo: Install ffmpeg, ffmpeg-php and codecs automagically (Centos 5.2)

A client recently requested ffmpeg to be installed on the server. I have done this in the past on a client's box but he had a different OS setup. For that installation I used a HowTo guide from VexxHost.

For the Lafayette Web server, we are running Centos 5.2, I did some scouting and found what seemed to be a good ffmpeg tutorial but in the end I couldn't get "make" and "make install" to take.

Everyone loves automagic installations! After the first failure I bumped into a forum that let's you download a tarball and install ffmpeg without any hitches and within 20 minutes. This attempt did work!

Pros and Cons of Auto Installer

Con: The downside to the ffmpeg auto install script, you end up downloading and installing many ffmpeg related libraries you might not need.
Pros: No errors and installtions works as expected (at least for my setup).

There are a few things you should know before you get started:

  • Must be a Linux/Unix/POSIX server
  • Must need root shell(bash) access
  • Must need 200 MB of free space in your server
  • The author of this gpl ffmpeg auto install script will know your server ip (see below how to remove this) upon installation.
  • Check if yum is installed or not in the server. If there is no yum, please make sure automake,autoconf and libtools are installed. It is reccommend to configure the distribution specific yum.

Privacy

The one thing I don't like about this script is that it auto emails your server ip to the script owner. You can change this if you want. See instructions below. You also are downloading most of the needed resources from the author (trulymanaged.com) as well, so they will know you (server ip) are using their resources. I would feel much better if the resources were being downloaded from sourceforge or some other trusted name in the Open Source community.

If this doesn't concern you, then no worries. I checked over each x.sh file and didn't see anything else that would cause a security concern.

Setup Installation

First, open up SSH (I like using putty) and login as "root". Once there, run the below commands:

mkdir ~/ffmpeg-packages
cd ~/ffmpeg-packages
wget http://trulymanaged.com/ffmpeg/ffmpeginstaller.tar.gz
tar -xvzf ffmpeginstall.tar.gz
cd ffmpeginstall

If you don't want the author to be emailed upon a successful installation, comment out line 47 of install.sh Here is how...

At the command prompt

# nano install.sh

Now comment out line 47

From

echo `hostname -i `|mail -s " FFmpeg installed $_version " vps @ esds.com

To

# echo `hostname -i `|mail -s " FFmpeg installed $_version " vps @ esds.com

Now let's begin the installation process

./install.sh

Once the installation starts you will see the verbose messages, letting you know the status of the installation.

End Result

You can end up serving videos youtube style. This video was transcoded yesterday with FFmpeg + Drupal + Open Package Video

Comments

Thanks! I'll give this a whirl and see if it work. I've been through 5 or 6 other tutorials that worked at one period of time, but not with my setup. Cheers! -Lee

Hi Lee. Hope it works out for you. Taking a look at the code it seems to cover all types of unix distros and having gcc or not. I was surprised at how easy it was to install a working version of ffmpeg...

I ended up screwing something up. =/ I'm not sure what yet, but its not working. I'm going to have to learn more about SSH and Linux before I can figure out what I did wrong. Suck as life.... =)

During the install with the auto script, did you get any errors? Also, I assume you were logged in as root, right?

Yeah I was signed into as the the root user. Just for the heck of it I tried the script again and it worked! Must of have been some sort of OE (operator error... me) You are da man & long live FairTax =)

I stumbled on this blog after looking at numerous other tutorials. I was asked to come into a hosting company and compile this on a few machines. They attempted a manual compile of all the components and it didn't work well for them. This script had a few tiny setbacks on centos but got ffmpeg working for me within an hour. Thanks!

I installed this successfully but when I run this in command line to see inject modules... /usr/bin/ldd /usr/bin/mencoder

I don't see libxvid. I know xvid installed correctly, but Do you know how xvid can be added to that list so my video script sees it and recognizes it? All other modules were listed just perfectly except this one.

I followed your tutorial and got "Post installation Procedures ....... Completed" at the end. But now ffmeg-info says "/usr/lib64/php/modules/ffmpeg.so: cannot open shared object file: No such file or directory in Unknown on line 0" We are running Centos 5 and PHP 5.2.10 Please advice what to do....

see above ^^^
I can't seem to find ffmpeg.so also. I tried updatedb and then locate ffmpeg.so. But it doesn't seem to be on the system. I do see codecs and i do have an cpffmpeg folder, so the install script seem to worked. But where is the ffmpeg.so file??

Hey.

I just cannot get this thing to install properly. The error i'm getting is:

cp: cannot create regular file `/usr/local/cpffmpeg/etc/mplayer/codecs.conf': No such file or directory
Installation of MPlayer-1.0rc1.tar.bz2 ....... Completed
Mplayer installation Failed :( , please visit the forum

I tried a newer (?) version of this installer also, located at http://www.sherin.co.in/ffmpeg/ - the result is the same.

Hi Allan, both versions are the same. Chances are your server is configured differently than most web servers. Please share some server specs. I assume you were logged in as root?

Hey. I already got it working. I commented out mplayer and ffmpeg installations at the end of the script .. and installed them by myself using YUM after running it.

Good deal. Thanks for posting back.

worked like a charm on centOS 64 :)

Thanks for posting back.

Hello, This auto installation, make the installation and of ffmpeg-php . Thanks for the post

Worked like a charm!! Thanks!

will this work on CENTOS 5 i686 thanks in advance bro

Others above have said it does. Let us know your findings.

Link has changed, should be ffmpeginstaller.tar.gz instead of ffmpeginstall.tar.gz.

Anyway, good find! Will be definitely using this. It works with CentOS 5 i686.

Thanks Liam! Link updated.

Thank you for this ;) This is such a good article and reminder.

excellent tut got all the way to the end of the install and had an error about not being able to install mplayer please visit the forum Mplayer installation Failed :( , please visit the forum and Im like what forum? elvis blogs forum? or truly managed.com forums well I tried both places and couldnt find a forum. anyone got any ideas of what I should do now? on another note when running the installer it first showed me the path to the php.ini and the loaded confuration file /usr/local/lib and /usr/local/lib/php.ini then expected me to type in the path wasnt sure which one to use path to the directory where the file is located or path to the file itself

I can't believe no one picked that up. There's a slight error on the instructions and that will cause noobs to get stuck in the middle of the installation process. See below:

mkdir ~/ffmpeg-packages
cd ~/ffmpeg-packages
wget http://trulymanaged.com/ffmpeg/ffmpeginstaller.tar.gz
tar -xvzf ffmpeginstaller.tar.gz
----> (Here should be installer, not install)
cd ffmpeginstaller (Same here)

Everything else should be fine.