Archive for the tag 'ffmpeg'

Necessary packages for ffmpeg and ffmpeg-php Install

First run the command uname to find the arch

uname -i
x86_64

Then download rpmforge-release

rpm -Uhv http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
yum clean all
yum update
yum install ffmpeg ffmpeg-devel
yum install mplayer mencoder
yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran
yum install subversion ruby ncurses-devel ruby-libs
yum install flvtool2*

Run svn checkout:

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd /usr/local/src/mplayer
svn update
cd /usr/local/src

Copy codecs for mplayer:

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

If you are using secure tmp:

mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp

For ffmpeg-php

wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=nchc
tar -xjf ffmpeg-0.5.2.1.tbz2
phpize
./configure
make
make install

FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1

If you get the following error when running the command make to compile FFmpeg, that means ffmpeg was either installed or previously compiled on your server .

Go into the source’s directory and run the following command.

make distclean
or
make clean

Then rebuild ffmpeg again.

SBDavid

Testing FFmpeg

Verify that FFmpeg is working properly by running the following two commands:

#php -r ‘phpinfo();’ | grep ffmpeg

You will get a few lines similar to the following:

ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April 15 2010 15:31:45
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

This is the second command to make sure that FFmpeg is working properly:

#/usr/local/bin/ffmpeg
SBDavid

FFmpeg error

FFmpeg error

After installing FFMpeg , when you execute the command : ffmpeg or ffmpeg -v, you may receive an error.

ffmpeg: error while loading shared libraries: libavformat.so.50:

Resolution :

Execute the following command :

export LD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH

But this value will be cleared once you log off that session.

So it is better to save this value in bashrc.

vi .bashrc
LD_LIBRARY_PATH=/usr/local/lib
SBDavid

FFMPEG in Debian

FFMPEG in Debian

Install the essentials

apt-get update
apt-get upgrade
apt-get install libjpeg-progs libjpeg62 libjpeg62-dev libsdl1.2-dev php5-dev build-essential

Create a directory and download all the files inside it

cd /usr/local/ffmpeg
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
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.4.tar.bz2

Extract all the files

tar zxvf flvtool2_1.0.5_rc6.tgz
tar zxvf lame-3.97.tar.gz
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz
tar zxvf flvtool2_1.0.5_rc6.tgz
tar jxvf essential-20061022.tar.bz2
tar jxvf ffmpeg-php-0.5.0.tbz2
bzip2 -cd amrnb-6.1.0.4.tar.bz2 | tar xvf -

We need a codec directory

mkdir /usr/local/lib/codecs/

Install Ruby on Rails, subversion & ncurses

apt-get install subversion ruby libcurses-ruby

Run some SVN queries

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd /usr/local/src/mplayer
svn update

Copy Codecs for mplayer

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

We also need to secure the tmp directory

mkdir /usr/local/ffmpeg/tmp
chmod 777 /usr/local/ffmpeg/tmp
export TMPDIR=/usr/local/ffmpeg/tmp

Install lame

cd /usr/local/ffmpeg/lame-3.97
./configure
make && make install

Install libogg

cd /usr/local/ffmpeg/libogg-1.1.3
./configure && make && make install

Install libvorbis

cd /usr/local/ffmpeg/libvorbis-1.1.2
./configure && make && make install

Install flvtool2

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

Install mplayer & mencoder

cd /usr/local/ffmpeg/mplayer
./configure –enable-jpeg
make && make install

Install AMR (for 3gp conversion)

cd /usr/local/ffmpeg/amrnb-6.1.0.4
./configure
make && make install

Install ffmpeg

cd /usr/local/ffmpeg/ffmpeg/
./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –disable-mmx –enable-shared –enable-amr-nb
make
make install
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
ln -s /usr/local/lib/libamrnb.so.2 /usr/lib/libamrnb.so.2

Install ffmpeg-php

cd /usr/local/ffmpeg/ffmpeg-php-0.5.0/
phpize
./configure
make
make install

You now need to add the new ffmpeg-php module to the php.ini file

pico /etc/php5/apache2/php.ini
extension=ffmpeg.so (add this line to the end of the file)

Restart & done

/etc/init.d/apache2 restart

Verify your work:

php -r ‘phpinfo();’ | grep ffmpeg

Next »