Fedora

HOW-TO install ffmpeg, Mplayer, mencoder,FLVtool2 and Yamdi on Plesk Linux based server

A hosting client made a request for some additional server requirement for AdultVideoScript. I’ve found some tutorials on the internet about how to install ffmpeg and other codecs for it. I’ve tried them but there is always something that doesn’t work. I’ve tried to find the best solution and to adapt it to what happens on a CentOS 5.3 at 64 bit (same for 32 bit). This might help others too. All the times you can try to see if no new version is out on the market and download the newest version.

IMPORTANT FOR BEGGINERS

Before continue this tutorial, you need to have knowledge of SSH or you may ruin your server.

If you need installation support, better order this service from us, we will do this job for you for only 50USD. Usually could take aprox 2 hours.

We will need to get from you SSH access with root access.

So login with SSH and enter as root.

We need to make sure the correct lib directories are setup in ldconfig. Edit the /etc/ld.so.conf file and add the following lines. After you save it, run the command ldconfig

view sourceprint?

1./usr/local/lib

2./usr/lib

Compiler install

Because in many cases no compiler or maybe other incompatbile compiler is installed, so you can get "fails sanity check" for example.

view sourceprint?

1.yum install gcc-c++ make

2.rpm -Uhv http://dl.atrpms.net/el6-x86_64/atrpms/testing/cmake-2.8.4-1.el6.x86_64.rpm

Some initial libraries

We like to install with yum because it is more easy like this.

view sourceprint?

1.yum install libogg zlib-devel libtool

2.rpm -ivh  http://rpm.livna.org/livna-release.rpm

FAAC = become FFAD in new version (http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz) if you want to use it. FAAC is an Advanced Audio Coder (MPEG2-AAC, MPEG4-AAC). The goal of FAAC is to explore the possibilities of AAC and exceed the quality of the currently best MP3 encoders. If missing the package, go to sourceforge and download latest version or from mirror.

view sourceprint?

1.wget "http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz"

2.tar xvfz faac-1.28.tar.gz

3.cd faac-1.28/

4../bootstrap

5../configure --enable-shared

6.make

7.make install

8.ldconfig

If you get error (mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’) remove line 126 containing strcasestr from mpeg4ip.h found in the commom folder, as a temporary workaround. It seems it does not properly exclude its own prototype when it is already included by means of glibc's strcasestr (#define _GNU_SOURCE 1). Then "make clean" then "make".

x264 is a free library for encoding H264/AVC video streams. If missing from YUM, use link below, or find the latest one (or correct OS).

view sourceprint?

1.rpm -ivh http://pkgs.repoforge.org/yasm/yasm-1.0.1-1.el6.rf.x86_64.rpm

view sourceprint?

1.yum install yasm

2.wget  ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20130616-2245.tar.bz2

3.tar xjvf  x264-snapshot-20121021-2245.tar.bz2

4.cd x264-snapshot-20100607-2245

5../configure --enable-shared  --disable-asm

6.make

7.make install

8.ldconfig

The OpenJPEG library is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, the new still-image compression standard from the Joint Photographic Experts Group (JPEG). In addition to the basic codec, various other features are under development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool useful for the JPIP protocol, JPWL-tools for error-resilience, a Java-viewer for j2k-images, ...

view sourceprint?

1.wget "https://openjpeg.googlecode.com/files/openjpeg-1.5.1.tar.gz"

2.tar zxvf openjpeg-1.5.1.tar.gz

3.cd openjpeg-1.5.1

4.cmake .

5.make install

6.ldconfig

Theora is a free and open video compression format from the Xiph.org Foundation. Like all our multimedia technology it can be used to distribute film and video online and on disc without the licensing and royalty fees or vendor lock-in associated with other formats. Theora scales from postage stamp to HD resolution, and is considered particularly competitive at low bitrates. It is in the same class as MPEG-4/DiVX, and like the Vorbis audio codec it has lots of room for improvement as encoder technology develops.

view sourceprint?

1.yum install libogg libogg-devel libvorbis libvorbis-devel

2.wget  http://downloads.xiph.org/releases/theora/libtheora-1.1.0.tar.gz

3.tar zjvf  libtheora-1.1.0.tar.gz

4.cd libtheora-1.1.0

5../configure --enable-shared

6.make

7.make install

The Xvid video codec implements MPEG-4 Simple Profile and Advanced Simple Profile standards. It permits compressing and decompressing digital video in order to reduce the required bandwidth of video data for transmission over computer networks or efficient storage on CDs or DVDs. Due to its unrivalled quality Xvid has gained great popularity and is used in many other GPLed applications, like e.g. Transcode, MEncoder, MPlayer, Xine and many more.

view sourceprint?

1.wget  http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz

2.tar zxvf xvidcore-1.2.2.tar.gz

3.cd xvidcore

4.cd build/generic

5../configure --enable-shared

6.make

7.make install

yamdi stands for Yet Another MetaData Injector and is a metadata injector for FLV files. It adds the onMetaData event to your FLV files. yamdi should run under *BSD, Linux and Win32

view sourceprint?

1.wget  "http://downloads.sourceforge.net/project/yamdi/yamdi/1.9/yamdi-1.9.tar.gz"

2.tar zxvf yamdi-1.9.tar.gz

3.cd yamdi-1.9

4.gcc yamdi.c -o yamdi -O2 -Wall  -D_FILE_OFFSET_BITS=647

5.cp yamdi /usr/bin/

Pure install of FFmpeg is not enough, the FLV (Flash Video Files) converted has no audio, because FLV audio codec is mp3, so you need LAME support.

view sourceprint?

1.wget "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz"

2.tar xvzf lame-3.99.5.tar.gz

3.cd lame-3.99.5

4../configure –-enable-shared

5.make

6.make install

FLVTool2 is a manipulation tool for Macromedia Flash Video files (FLV). It can calculate a lot of meta data, insert an onMetaData tag, cut FLV files, add cue points (onCuePoint), show the FLV structure and print meta data information in XML or YAML. Type flvtool2 in command line to see help after install succeed.

view sourceprint?

1.yum install ruby

2.wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz

3.tar xvzf flvtool2-1.0.6.tgz

4.cd flvtool2-1.0.6/

5.ruby setup.rb config

6.ruby setup.rb setup

7.ruby setup.rb install

Finally FFMPEG

FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

view sourceprint?

1.yum install subversion

2.svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

3.cd ffmpeg

4../configure --enable-libfaac --enable-shared --enable-memalign-hack --enable-gpl  --enable-libtheora --enable-libmp3lame --enable-libopenjpeg  --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-avfilter  --enable-swscale

5.make

6.make install

Symlink some libraries if needed (ignore file exists errors):

view sourceprint?

1.ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50

2.ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51

3.ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49

4.ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0

5.ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

6.ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52

7.ln -s /usr/local/lib/libavdevice.so.52.2.3 /usr/lib/libavdevice.so.52.2.3

ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP's image functions. This works well for automatically creating thumbnail images from movies. ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...)

view sourceprint?

1.wget "http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=garr"

2.tar xjvf ffmpeg-php-0.6.0.tbz2

3.cd ffmpeg-php-0.6.0

4.phpize

5../configure

6.make

7.make install

When encountering this error compiling ffmpeg-php:

/root/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: 'PIX_FMT_RGBA32' undeclared (first use in this function) make: *** [ffmpeg_frame.lo] Error 1 "

do this and after make command again:

view sourceprint?

1.vim ffmpeg_frame.c

2.:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32/g

3.:wq

Now you need to copy the ffmpeg.so file that was created from it’s location (from the build) to /usr/local/lib/php/extensions/, it should look something like:

cp /usr/local/lib/php/extensions/no-debug-non-zts-????????????/ffmpeg.so /usr/local/lib/php/extensions/

This creates the ffmpeg.so file. Create a file /etc/php.d/gdffmpeg.ini

; Enable ffmpeg extension module (please use the correct path)

extension_dir = "/usr/lib64/php/modules/"

extension=ffmpeg.so

It is important to name it as gdffmpeg.ini because seems try to load this before gd.ini and then will work. Restart Apache (service httpd restart).

MPlayer is a movie player which runs on many systems (see the documentation). It plays most MPEG/VOB, AVI, Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, NUT, NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files, supported by many native, XAnim, and Win32 DLL codecs. You can watch VideoCD, SVCD, DVD, 3ivx, DivX 3/4/5, WMV and even H.264 movies.

view sourceprint?

1.wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2

2.tar xjvf essential-20071007.tar.bz2

3.mkdir /usr/local/lib/codecs/

4.mv essential-20071007/ /usr/local/lib/codecs/

5.chmod -R 755 /usr/local/lib/codecs/

view sourceprint?

1.wget http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc3.tar.bz2

2.tar xjvf  MPlayer-1.0rc3.tar.bz2

3.cd MPlayer-1.0rc3/

4../configure

5.make

6.make install

IMPORTANT FOR BEGGINERS

Before continue this tutorial, you need to have knowledge of SSH or you may ruin your server.

If you need installation support, better order this service from us, we will do this job for you for only 50USD. Usually could take aprox 2 hours.

We will need to get from you SSH access with root access.