Log in  \/ 
x
or
Register
x

Installing FFMPPEG, FLVTool2 and Yamdi on CentOS 6

on . Posted in Tutorials

FFMPEGThis article provide you a walk through to compile ffmpeg/FLVTool2/Yamdi from source files on CentOS 6.
Most Linux distributions have outdated packages in their repositories so compiling those software is the best solution to have the latest updates, bug fixes and features.

Tutorial updated on March 2015 with the addition of many codecs:

 

libx265, libx264, libvpx, Amr, Theora, libXvid, libogg, libopus, LAME, libfdk-aac, libfaac, libvorbis

 

Install development tools

To compile most of the required software, the GNU C and C++ compilers and other development utilities must been installed first

yum groupinstall "Development Tools" -y


Dynamic Linked Libraries Path

Linux uses a system of shared libraries, similar to Windows dlls, for the efficient use of space and resources, and modularity. The search path for dynamic libraries is configured globally in /etc/ld.so.conf.

Type these commands into SSH:

grep /usr/local/lib /etc/ld.so.conf || echo "/usr/local/lib" >> /etc/ld.so.conf

 

yasm

Yasm is an assembler released under the BSD license . Although it is not strictly required for compiling the tools, it helps to improve the conversion speed of ffmpeg when using HD codecs, so its installation is highly recommended. yasm is frequently available in the repositories of most popular Linux distribution, but it is preferred to install the latest version by compiling its source code:

mkdir /usr/local/src
cd /usr/local/src
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar zxf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure  && make && make install

Check

If the installation finished successfully we should be able to run the yasm command, for example:

yasm --version
yasm 1.2.0 (this is how the result should look)

 

Codecs and video conversion tools

Install LIBOGG

Ogg is a free, open standard container format maintained by the Xiph.Org Foundation. The Ogg format is unrestricted by software patents and is designed to provide for efficient streaming and manipulation of high quality digital multimedia.
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar zxvf libogg-1.3.0.tar.gz
cd /usr/local/src/libogg-1.3.0
make distclean
./configure && make clean && make && make install

 Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib

ls /usr/local/lib/libogg*
/usr/local/lib/libogg.a   /usr/local/lib/libogg.so.0
/usr/local/lib/libogg.la  /usr/local/lib/libogg.so.0.8.0


Install LIBVORBIS

Vorbis is a audio compression format. It is roughly comparable to other formats used to store and play digital music, such as MP3, VQF, AAC, and other digital audio formats. It is different from these other formats because it is completely free, open, and unpatented.
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar zxvf libvorbis-1.3.3.tar.gz
cd /usr/local/src/libvorbis-1.3.3
make distclean
./configure && make clean && make && make install

Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib

ls /usr/local/lib/libvorbis*
/usr/local/lib/libvorbis.a            /usr/local/lib/libvorbisfile.so
/usr/local/lib/libvorbisenc.a         /usr/local/lib/libvorbisfile.so.3
/usr/local/lib/libvorbisenc.la        /usr/local/lib/libvorbisfile.so.3.3.5
/usr/local/lib/libvorbisenc.so        /usr/local/lib/libvorbis.la
/usr/local/lib/libvorbisenc.so.2      /usr/local/lib/libvorbis.so
/usr/local/lib/libvorbisenc.so.2.0.9  /usr/local/lib/libvorbis.so.0
/usr/local/lib/libvorbisfile.a        /usr/local/lib/libvorbis.so.0.4.6
/usr/local/lib/libvorbisfile.la

 

Install LibXvid

Xvid is a video decoder and encoder library aimed at providing the best compression efficiency and picture quality possible.

cd /usr/local/src
wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz
tar zxvf xvidcore-1.3.3.tar.gz
cd xvidcore/build/generic
./configure
make
make install

check

ls /usr/local/lib/libxvid*
/usr/local/lib/libxvidcore.a    /usr/local/lib/libxvidcore.so.4@
/usr/local/lib/libxvidcore.so@  /usr/local/lib/libxvidcore.so.4.3

 

Install Theora

Theora is a free and open video compression format from the Xiph.org Foundation. 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.
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar zxvf libtheora-1.1.1.tar.gz
cd /usr/local/src/libtheora-1.1.1
./configure && make clean && make && make install

Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib

ls /usr/local/lib/libtheora*
/usr/local/lib/libtheora.a            /usr/local/lib/libtheoraenc.so
/usr/local/lib/libtheoradec.a         /usr/local/lib/libtheoraenc.so.1
/usr/local/lib/libtheoradec.la        /usr/local/lib/libtheoraenc.so.1.1.2
/usr/local/lib/libtheoradec.so        /usr/local/lib/libtheora.la
/usr/local/lib/libtheoradec.so.1      /usr/local/lib/libtheora.so
/usr/local/lib/libtheoradec.so.1.1.4  /usr/local/lib/libtheora.so.0
/usr/local/lib/libtheoraenc.a         /usr/local/lib/libtheora.so.0.3.10
/usr/local/lib/libtheoraenc.la

 

Install LIBX264

x264 is a free software library for encoding video streams into the H.264/MPEG-4 AVC format. It is released under the terms of the GNU General Public License.
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xvjf last_x264.tar.bz2 cd x264-snapshot-*
make distclean
./configure --enable-shared && make clean && make && make install

The x264 project creates a daily snapshot with the format x264-snapshot-yyyymmdd-2245.tar.bz2 . We recommend to use the last available snapshot.
Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib (the actual version number after libx264.so.* may vary)

ls /usr/local/lib/libx264*
/usr/local/lib/libx264.so  /usr/local/lib/libx264.so.124

Common Problems

No suitable assembler found. Install 'yasm' to get MMX/SSE optimized code. If you really want to compile without asm, configure with --disable-asm.

    If you get this error, then you should use the disable asm option, or install yasm (version 0.6.1) using your distribution package manager (apt-get,yum.etc) or compiling it from the source. We do not recommend compiling the x264 libraries without yasm, as it noticeably reduces the HD decoding and decoding speed.

 


Install Amr (for 3gp conversion)

3GP is a simplified version of the MPEG-4 Part 14 (MP4) container format, designed to decrease storage and bandwidth requirements in order to accommodate mobile phones. It stores video streams as MPEG-4 Part 2 or H.263 or MPEG-4 Part 10 (AVC/H.264), and audio streams as AMR-NB, AMR-WB, AMR-WB+, AAC-LC or HE-AAC. A 3GP file is always big-endian, storing and transferring the most significant bytes first. It also contains descriptions of image sizes and bitrate.

Opencore-amr is a free implementation of the of AMR-NB and AMR-WB codecs under Apache License V2.0
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar zxf opencore-amr-0.1.3.tar.gz
cd /usr/local/src/opencore-amr-0.1.3
make distclean
./configure && make clean && make && make install

Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib

ls /usr/local/lib/libopencore*
/usr/local/lib/libopencore-amrnb.a
/usr/local/lib/libopencore-amrnb.la
/usr/local/lib/libopencore-amrnb.so
/usr/local/lib/libopencore-amrnb.so.0
/usr/local/lib/libopencore-amrnb.so.0.0.3
/usr/local/lib/libopencore-amrwb.a
/usr/local/lib/libopencore-amrwb.la
/usr/local/lib/libopencore-amrwb.so
/usr/local/lib/libopencore-amrwb.so.0
/usr/local/lib/libopencore-amrwb.so.0.0.3

 


Install libfaac

FAAC is an MPEG-4 and MPEG-2 AAC encoder. Installing the libfaac libraries enable ffmpeg to encode audio stream using the AAC codec
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
tar zxvf faac-1.28.tar.gz
cd /usr/local/src/faac-1.28
./configure && make clean && make && make install

Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib

ls /usr/local/lib/libfaac*
 /usr/local/lib/libfaac.a   /usr/local/lib/libfaac.so    /usr/local/lib/libfaac.so.0.0.0
 /usr/local/lib/libfaac.la  /usr/local/lib/libfaac.so.0

Common Problems

In recent Linux distrubutions (Centos 6, Debian 6) the compilation may fail with the following error

In file included from mp4common.h:29, from 3gp.cpp:28:mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’

That is because the C function strcasestr declared in the libfaac sources is already declared in a system-wide library.

To solve it: Edit the file /usr/local/src/faac-1.28/common/mp4v2/mpeg4ip.h and delete the following line (around line 126)

char *strcasestr(const char *haystack, const char *needle); 

Then run

make clean && ./configure && make && make install

 

 

Install libfdk-aac

The Fraunhofer FDK AAC codec library. This is currently the highest-quality AAC encoder available with ffmpeg.

yum install unzip
cd /usr/local/src
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure
make
make install
make distclean


check

ls /usr/local/lib/libfdk-aac*
/usr/local/lib/libfdk-aac.a  /usr/local/lib/libfdk-aac.la*  /usr/local/lib/libfdk-aac.so@  /usr/local/lib/libfdk-aac.so.1@  /usr/local/lib/libfdk-aac.so.1.0.0*


Install LAME

LAME is an open source application used to encode audio into the MP3 file format. The name LAME is a recursive acronym for LAME Ain't an MP3 Encoder, reflecting LAME's early history when it was not actually an encoder, but merely a set of patches against the freely available ISO demonstration source code.
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
make distclean
./configure && make clean && make && make install

Check

If the installation process finished ok the compiled libraries will be placed at /usr/local/lib

ls /usr/local/lib/libmp3lame*
/usr/local/lib/libmp3lame.a   /usr/local/lib/libmp3lame.so.0
/usr/local/lib/libmp3lame.la  /usr/local/lib/libmp3lame.so.0.0.0
/usr/local/lib/libmp3lame.so

 

Install libopus

Opus is a totally open, royalty-free, highly versatile audio codec. Opus is unmatched for interactive speech and music transmission over the Internet, but is also intended for storage and streaming applications. It is standardized by the Internet Engineering Task Force (IETF) as RFC 6716 which incorporated technology from Skype's SILK codec and Xiph.Org's CELT codec.

cd /usr/local/src
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar zxvf opus-1.1.tar.gz
cd opus-1.1
./configure --enable-static --enable-shared
make
make install
ldconfig

Check

ls /usr/local/lib/libopus*
/usr/local/lib/libopus.a  /usr/local/lib/libopus.la*  /usr/local/lib/libopus.so@  /usr/local/lib/libopus.so.0@  /usr/local/lib/libopus.so.0.5.0*

 

Install libvpx

VP8 and VP9 are open video compression formats, aimed at providing high picture quality at lower bitrate. libvpx provide decoding and encoding capabilities for the VP8 and VP9 formats.
The Installation Process

cd /usr/local/src
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2
tar xvjf libvpx-1.5.0.tar.bz2
cd libvpx-1.5.0
./configure --disable-examples --enable-shared && make && make install && ldconfig

Check

ls /usr/local/lib/libvpx*
/usr/local/lib/libvpx.a /usr/local/lib/libvpx.so.1 /usr/local/lib/libvpx.so.1.1.0
/usr/local/lib/libvpx.so /usr/local/lib/libvpx.so.1.1



Install libx265

x265 refers to one of the latest open source video codec used for encoding videos. It is available as free software. The x265 encoder uses the latest x265 codec based on the HEVC High Efficiency Video Coding or H.265 standard. The main objective of H.265/x265 is to improve video quality by doubling the data compression ratio of the previous standard known as H.264/x264 encoding standard. Even if the actual browsers and mobile devices do not really support it yet, it's very interesting for our computers, or even to store videos on our personal clouds/NAS...

cd /usr/local/src
hg clone http://hg.videolan.org/x265
cd /usr/local/src/x265/build/linux ./make-Makefiles.bash make -j6 make install ldconfig

Note that I used 'make -j6' because my CPU has 6 Cores/threads, adapt that line to your number of cores.

check

ls /usr/local/lib/libx265*
/usr/local/lib/libx265.a  /usr/local/lib/libx265.so@  /usr/local/lib/libx265.so.41*

 

 

Install Libass-devel (for the subtitles)

We need to install the EPEL repository and install it:

yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update
yum --enablerepo=epel install libass-devel

 

 

Install FFMPEG

FFMPEG is a computer program that can record, convert and stream digital audio and video in numerous formats.[1] FFMPEG is a command line tool that is composed of a collection of free software / open source libraries. It includes libavcodec, an audio/video codec library used by several other projects, and libavformat, an audio/video container mux and demux library. The name of the project comes from the MPEG video standards group, together with "FF" for "fast forward".
The Installation Process

Type these commands into SSH:

cd /usr/local/src
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
wget https://www.ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2
tar xjf ffmpeg-snapshot-git.tar.bz2
cd ffmpeg
make distclean
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --disable-static --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libfaac --enable-libvpx --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libtheora --enable-libxvid --enable-libfdk_aac --enable-libopus --enable-libass
make clean && make && make install
make tools/qt-faststart
cp tools/qt-faststart /usr/local/bin/
ldconfig

 
 

Metadata injection tools

Metadata, in the context of multimedia files, is information that complements and better describes the content, such as its duration, author or resolution or codecs used. Although all types of multimedia files can contain metadata (for example the ID tag in the case of mp3 files), it is specially important when converting video files to the flv format, as metadata is required for some nice features as displaying the process bar and pseudostreaming. hwdMediaShare may use several tools for injecting metadata, so installing one of them is enough. If you are not interested in converting uploaded videos to flv you don't need to install these tools either.
Yamdi

 

Yamdi (Yet another medata injector) is it a very efficient tool that can process big files with fast and with a low memory usage,
The Installation Process

Type these commands into SSH:

cd /usr/local/src
wget http://downloads.sourceforge.net/project/yamdi/yamdi/1.8/yamdi-1.8.tar.gz
tar xzf yamdi-1.8.tar.gz
cd yamdi-1.8
gcc yamdi.c -o yamdi -O2 -Wall
strip yamdi
cp yamdi /usr/bin/yamdi

 

 FLVTOOL2

FLVTOOL2 is probably the most popular open source tool for injecting metadata in FLV files. It is written in Ruby, so it requires the installation of this programming language for it to work.
Installing Ruby
Installing Using YUM

Type these commands into SSH:

yum update 
yum install ruby rubygems

Common Problems
WHM/Cpanel

WHM setup may prevent that Ruby can be installed using a package manager. To easily install Ruby in a WHM/cpanel server use the provided script

/scripts/installruby 

The Installation Process

Once installed Ruby and Ruby gems, flvtool2 can be easily installed using:

gem install flvtool2 

Alternatively, it can be installed using the following procedure:

Type these commands into SSH:

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
tar zxvf flvtool2-1.0.6.tgz
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config && ruby setup.rb setup && ruby setup.rb install
Share this article
FaceBook  Twitter

Comments (1)

  1. v8clubdigital

hi

  Attachments
 
There are no comments posted here yet

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok