Managed Services

ffmpeg and imagemagick installation in linux servers

ffmpeg is a command-line tool that converts audio or video formats. It can also capture and encode in real-time from various hardware and software sources such as a TV capture card

This article is only for those trying to install ffmpeg in linux servers

ffmpeg(3.2.4)

ffmpeg has these dependent libraries and these have to be installed  C compiler, C++ compiler , nasm , yasm , libx264

Dependencies Installation :

for  C and C++ complier , yum -y install gcc*

for nasm installation follow below steps

download the zip file , wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.xz 

untar the zip file , tar -xvf nasm-2.13.01.tar.xz 

compile and then install , ./configure ; make ; make install  (If nasm is to be installed under a specific path then use this command ./configure –prefix=/path/to/directory)

for yasm installation follow below steps

ffmpeg 3.2.4 needs yasm version higher than 1.20 so make sure that the latest version of yasm is installed

download the zip file , wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

untar the zip file , tar -xzvf yasm-1.3.0.tar.gz

compile and then install , ./configure ; make ; make install  

for libx264 installation follow below steps

download the zip file ,  wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2

untar the zip file , tar -xjvf last_x264.tar.bz2

configure x264 library first , ./configure –enable-shared  (donot forget –enable-shared flag because if x264 is complied without this then the shared library(.so) files will be not be installed on the server )

compile and install ,  make ; make install

 

ffmpeg installation : 

download the latest version ffmpeg from ffmpeg.org website , https://www.ffmpeg.org/download.html all the stable releases are listed here

 wget http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.xz

untar the zip file , tar -xvf ffmpeg-3.2.4.tar.xz

configuring the ffmpeg ,  ./configure –enable-gpl –enable-libx264

compile and install , make ; make install

There seems to be no errors with installation , even though ffmpeg is not being identified on the server

 

This happened as the libx264.so file is not being identified by the ffmpeg binary , so validate if the .so file is actually existing on the server

[root@ip-10-145-xx-xx ffmpeg-3.2.4]# find / -iname “libx264*”
/usr/local/lib/libx264.so
/usr/local/lib/libx264.so.152

As per the above output libx264.so.152 which the ffmpeg claimed to un-identify on the server actually exists , so in-order to fix this issue edit the file ld.s0.conf(vim /etc/ld.so.conf) and add the path /usr/local/lib to the end of the file and then save it .

After coming out of the file run ldconfig command

Now type ffmpeg , this time the binary is identified

[root@ip-10-145-xx-xx ffmpeg-3.2.4]# ffmpeg
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: –enable-gpl –enable-libx264
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

Note : ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so

ImageMagick Installation : 

ImageMagick has many dependent libraries , so grouping all of these together there were two rpms which were released one for the installation and the other with all the dependent libraries

download both the rpms, namely ImageMagick-7.0.6-3.x86_64.rpm and ImageMagick-libs-7.0.6-3.x86_64.rpm from https://www.imagemagick.org/script/binary-releases.php 

Even before installing the libs rpm , run this command for getting all the OS level binary dependencies for these rpms ..

dependencies installation , yum -y install libICE* libSM* libX* libfft* libjpeg* libgs* ghostscript* libltdl* libpango* libwmflite*

libs installation , rpm -ivh ImageMagick-libs-7.0.6-3.x86_64.rpm

tool installation , rpm -ivh ImageMagick-7.0.6-3.x86_64.rpm

In order to validate if magick is properly installed , then run this command magick –version

Note : Since Ghost Script is installed as a dependency for magick installation , this doesn’t have to be installed again just type gs for initiating ghostscript

 

 

 

 

 

 

 

 

About The Author

One comment

  1. Suresh

    October 14, 2017 at 8:20 am

    nice information. Thankyou sri

Leave a Reply

*