Install FFMPEG and FFMPEG-PHP on CentOS

พอดีได้มีโอกาสได้ลง FFmpeg ที่ Centos นั่งงมมาหลายวันแล้วพี่น้องส่วนอื่นๆลงได้หมดแล้วเหลือตัวที่สำคัญสุดดันไม่ผ่านซ่ะที มึนและงง ไปดูวิธีลงได้ตามนี้ครับ

Switch to working directory

cd /usr/local/src

Download the source files needed

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/
essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/
ffmpeg-php-0.5.0.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz



Extract the Source files

bunzip2 essential-20061022.tar.bz2; tar xvf essential-20061022.tar
tar zxvf flvtool2_1.0.5_rc6.tgz
tar zxvf lame-3.97.tar.gz
bunzip2 ffmpeg-php-0.5.0.tbz2; tar xvf ffmpeg-php-0.5.0.tar
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz

Create a directory for codecs & import them

mkdir /usr/local/lib/codecs/mv essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

Install SVN/Ruby

yum install subversionyum install ruby
yum install ncurses-devel

Get the latest FFMPEG/MPlayer from the subversion

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpegsvn checkout
svn://svn.mplayerhq.hu/mplayer/trunk mplayer

Fix few Lib issues for next steps
Add this line in /etc/ld.so.conf

/usr/local/lib

then run

ldconfig -v

Compile LAME

cd /usr/local/src/lame-3.97./configure
make
make install

Compile libOGG

cd /usr/local/src/libogg-1.1.3./configure
make
make install

Compile libVorbis

cd /usr/local/src/libvorbis-1.1.2./configure
make
make install

Compile flvtool2

cd /usr/local/src/flvtool2_1.0.5_rc6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

Compile MPlayer

cd /usr/local/src/mplayer./configure
make
make install

Compile FFMPEG

cd /usr/local/src/ffmpeg
./configure --enable-libmp3lame --enable-libogg --enable-libvorbis
 --disable-mmx --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 automakeyum install autoconf
yum install libtool

Compile FFMPEG-PHP

cd /usr/local/src/ffmpeg-php-0.5.0phpize
./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)

extension=ffmpeg.so

Restart Apache to load FFMPEG-PHP

service httpd restart

Check if FFMPEG-PHP is loaded correctly
Create a file called phpinfo.php in your webroot and add the following code

#gootum
<?php
phpinfo();
?>

ที่มา : http://www.nazly.net/index.php?page=showevents&selTopic=230

  • Pingback: blog-ffmpeg + mplayer + mencoder + flvtool2()

  • นายเอ

    ขอบคุณหลาย เด้อ Guru Tum อิอิ ที่ช่วย ลุง ลง อิอิ เดี๋ยวเลี้ยงมื้อใหญ่เลย 😛

  • ผ่านมาครับท่าน

    หลังจาก
    # vi /etc/ld.so.conf
    Add line:

    /usr/local/lib

    แก้ไขคำสั่งตรงบันทัด
    ldconfig -v ใน centos ต้องใช้แบบนี้แทนครับ

    /sbin/ldconfig -v

    มาบอกแค่นี้แหละเผื่อใครมึนแบบผมอิอิ
    ปล.ขอบคุณสำหรับวิธีลงครับไอ้ผมก้องมโข่งอยู่ตั้งนานฮาๆ

  • จะลองดูบ้าง thank

  • I absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for. Does one offer guest writers to write content for you? I wouldn’t mind writing a post or elaborating on some of the subjects you write in relation to here. Again, awesome site!

  • Have you ever thought about adding a little bit more than just your articles? I mean, what you say is important and everything. However think about if you added some great visuals or video clips to give your posts more, “pop”! Your content is excellent but with pics and videos, this website could certainly be one of the most beneficial in its field. Excellent blog!

  • Really informative article post.Really looking forward to read more. Keep writing.

  • Pingback: John Martin()

  • kdjfke,What else could you be expecting from a? woman, AND BLONDE!