Install FFmpeg Mencoder on CentOS 5.10 64-bit

Install FFmpeg & Mencoder on CentOS 6 would be easy job.
It cost me 2 days to install them and make script running on a client server which is CentOS 5.10 64-bit.
If you have to install FFmpeg & Mencoder on a CentOS 5 like me, i hope this article can save you some time.

Install FFmpeg

You can follow those two links to prepare system, install codecs and ffmpeg:

http://cumulusclips.org/docs/install-ffmpeg-x264-on-centos/
http://trac.ffmpeg.org/wiki/CentosCompilationGuide

Error on FFmpeg

1. When I run the configure script, it gives the following error:

ERROR: libx264 not found

To solve this issue, try adding “–extra-libs=-ldl“.

2. If you need use ‘drawtext‘ feature to add text on your video, you need a build it with –enable-libfreetype.

Otherwise, you may see this error:

ERROR: No such filter: ‘drawtext’

3. If all required libraries not install properly, when you run ffmpeg, you may see error:

ffmpeg: error while loading shared libraries: libtheoradec.so.1: cannot open shared object file: No such file or directory

OK, first let us list all libraries required by ffmpeg:

#ldd ffmpeg
linux-vdso.so.1 =>  (0x00007ffff6241000)
libasound.so.2 => /lib64/libasound.so.2 (0x0000003152800000)
libtheoraenc.so.1 => /usr/lib64/libtheoraenc.so.1 (0x00002afa90d96000)
libtheoradec.so.1 => not found
libmp3lame.so.0 => /usr/lib64/libmp3lame.so.0 (0x000000399c200000)
libfaac.so.0 => /usr/lib64/libfaac.so.0 (0x000000399b200000)

Missing ‘libtheoradec.so.1‘. Do i have this library on server ? Let’s find it:

# find / -name 'libtheoradec.so.1'
/var/www/html/libtheora-1.1.1/lib/.libs/libtheoradec.so.1

Last step, copy file to the folder like other libraries. Then you should able to run command ffmpeg.

#cp /var/www/html/libtheora-1.1.1/lib/.libs/libtheoradec.so.1 /usr/lib64

Install Mencoder

You can install Mencoder use

#yum install mencoder

If yum could not find Mencoder, you need install a third party repository. What i use is RPMforge, http://repoforge.org
Just go to their website and follow instruction to install it, then run following command to check:

# yum repolist
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.netaddicted.ca
 * epel: less.cogeco.net
 * extras: less.cogeco.net
 * rpmforge: mirror.team-cymru.org
 * updates: less.cogeco.net
base                                             | 1.1 kB     00:00
epel                                             | 3.7 kB     00:00
extras                                           | 2.1 kB     00:00
rpmforge                                         | 1.9 kB     00:00
updates                                          | 1.9 kB     00:00
updates/primary_db                               | 453 kB     00:00
repo id       repo name                                           status
base          CentOS-5 - Base                                      3,662
epel          Extra Packages for Enterprise Linux 5 - x86_64       7,693
extras        CentOS-5 - Extras                                      265
rpmforge      RHEL 5 - RPMforge.net - dag                         11,361
updates       CentOS-5 - Updates                                     454

Now, you can run yum to install mencoder.

Error on Mencoder

We need join several mp4 videos together, the following command is working well on a CentOS 6 with latest Mencoder version.

#mencoder -oac copy -ovc copy -idx -o /file_path/video_new.mp4 /file_path/video_1.mp4 /file_path/video_2.mp4 /file_path/video_3.mp4

But if you run it in CentOS 5, you may see an error

All video files must have identical fps, resolution, and codec for -ovc copy.

Looks like the old version mencoder can not auto re-size video during encoding.
To solve this issue, you can try change to this:

#mencoder -oac copy -ovc x264 -vf scale=1280:720,harddup -o /file_path/video_new.mp4 /file_path/video_1.mp4 /file_path/video_2.mp4 /file_path/video_3.mp4
affiliate_link
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

Comments are closed.