Installing FFMPEG on Linux
FFMPEG is an open source application that allows you to convert video and audio files easily between a variety of different formats. It supports most industry-standard codec and can convert from one file format to another quickly and easily. This article will guide you to installing FFMPEG and other codec on Linux.
FFMPEG Installation Requirements:
- FFMPEG
- LAME Mp3 Audio Codec (Requred for mpg, flv, avi, wmv etc files)
- AMR Audio Codec (Required for 3gp video files)
- XVID Audio Codec
- FFMPEG-PHP
Note on installing FFMPEG:
- All the Audio Codec getting used in FFMPEG are not part of FFMPEG Source base
FFMPEG Download URL:
On the download page of FFMPEG they have geven the download link from SVN and checkout-snapshot but i would suggest to use SVN source code base.
FFMPEG Download Page FFMPEG
The url for the SVN source code for FFMPEG is: svn://svn.mplayerhq.hu/ffmpeg/trunk
To download from SVN you will have to install subversion located at subversion.tigris.org, or you can use “TortoiseSVN” located at tortoisesvn.tigris.org.
LAME Mp3 Codec download URL: Lame Mp3 Codec
AMR Audio Download URL: AMR Audio Codec
To install the AMR codec you will require both AMR-WB and AMR-NB files.
XVID Audio Download URL: XVID Audio Codec
FFMPEG-PHP Download URL: FFMPEG-PHP
Installation Steps:
It is a good practice to install all the external audio codec libraries first and then install the FFMPEG.
Installing LAME MP3 Encoder
- Untar the lame file by using tar zxvf lametarfile
- Assign 777 permission rights to the lame folder by typing chmod 777 lamefolder -R
- Traverse to the root of lame folder and type
./configure
make
make install
Installing AMR Codec
For installing the AMR codec there are two separate files that needs to be installed are AMR-WB and AMR-NB.
- Untar the AMR file by using tar zxvf tarfile
- Assign 777 permission rights to the amr folder by typing chmod 777 amrfolder -R
- Traverse to the root of amr folder and type
./configure
make
make install
Note on Installing AMR:
You might get errors installing AMR codec on Autoconf utility of linux. To resolve this problem will have to install the latest version of Autoconf utility from Download AutoConf
Installing Xvid Codec
- Untar the xvid file bu using tar zxvf tarfilename
- Assign 777 permission rights to the lame folder by typing chmod 777 xvidfolder -R
- Traverse to the root of xvid folder
- Goto Build/generic folder and type
./configure
make
make install
Installing GCC
- This is required only if the SVN for FFMPEG is not compatible with the existing version of GCC(3x) requires a new version for the same
- After the installation of GCC need to convert all the files of SVN to Unix compatible by using “dos2unix ffmpegfolder/* -R”.
Installing FFMPEG
- Download the ffmpeg from SVN
- Assign 777 permission rights to the ffmpeg folder by typing chmod 777 ffmepgfolder -R
- Traverse to the root of ffmpeg folder and type
./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared
make
make install
Installing FFMPEG-PHP
- Download the ffmpeg-php from Sourceforge
- Unpack the archive by using following command “tar -xjf ffmpeg-php.X.XX.tar.gz”
- Iterate inside the ffmpeg-php directory
- Run phpize (included with your php install) to build configuration files
./configure
make
make install
NOTE FOR FFMPEG-PHP:
If you are planning to install FFMPEG-PHP then will have to add –enable-shared parameter while configuring FFMPEG
You might get installation error while making the file related to html or texti files in ffmpeg\doc folder. The solution for this that worked for me is to just create a empty file by using touch command in the respective folders.
Note:
The following configure parameter will work with FFMPEG 0.49. But now the latest version does not have –enable-libogg parameter so if you are planning to installing the latest version then the configure parameter would be /configure –enable-libmp3lame –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared.
Note on Reinstalling FFMPEG:
If you are planning to reinstall the FFMPEG software the will have to perform following steps:
- ./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared
- make clean
- make
- make install
Lot of people are facing error on loading shared libraries libavdevice.so.52, solution to the same is:
export LD_LIBRARY_PATH=/usr/local/lib/
Still facing problem while installing leave a comment, will try my best to help you out.
Have created an Forum on this topic, that will help community to solve users problem quickly Installing FFMPEG on Linux



































Hi Hitesh,
I want to install vhook in ffmpeg. Is there any way to enable vhook capabilities in ffmpeg.
Also I want to install imlib2. Please can you help me, how can I do it.
Thanks
Ashish
Hey Hitesh,
I’m currently trying to install FFmpeg on my centos 5.3 server. When i run it to see if it’s working i get the error
“ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file, or some other library. ”
I don’t know anything about linux however so i have not been able to follow along with previous posts. If it’s not a lot to it, could you please tell me step by step, what commands i need to type through the terminal?
Thanks a lot!
Daniel
Hi, Hitesh.
I need your help with the installation of ffmpeg-php.
i have ffmpeg installed. that is the config.
FFmpeg version SVN-r19082, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –prefix=/home/ehrspain/executable –enable-gpl –enable-nonfree –enable-postproc –enable-avfilter –enable-avfilter-lavf –enable-pthreads –enable-x11grab –enable-bzlib –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libfaadbin –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libxvid –enable-zlib
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.30. 2 / 52.30. 2
libavformat 52.34. 0 / 52.34. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 0. 5. 0 / 0. 5. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Jun 4 2009 13:39:09, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
At least one output file must be specified
when i try to install ffmpeg-php.0.6.0 with the follow steps.
% phpize
% ./configure –with-ffmpeg=/home/ehrspain/executable
% make
% make test
the last command show me these errors.
/home/ehrspain/executable/bin/php: symbol lookup error: /home/ehrspain/executable/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so: undefined symbol: avcodec_build
make: [test] Error 127 (ignored)
My web is under dreamhost.com service. the ffmpeg under line command run good. but i need the ffmpeg-php.
any ideas ?
thanks for your help.
Jorge.
Dude need some help with ffmpeg-php
Everything installed well with ffmpeg, libmp3lame and stuff… now when i do the make for ffmpeg-php i get this error
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘_php_convert_frame’:
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:202: warning: implicit declaration of function ‘img_convert’
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘_php_crop_frame’:
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:260: warning: implicit declaration of function ‘img_copy’
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘_php_resample_frame’:
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: ‘ImgReSampleContext’ undeclared (first use in this function)
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: (Each undeclared identifier is reported only once
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: for each function it appears in.)
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: ‘img_resample_ctx’ undeclared (first use in this function)
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:308: warning: implicit declaration of function ‘img_resample_full_init’
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:321: warning: implicit declaration of function ‘img_resample’
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:326: warning: implicit declaration of function ‘img_resample_close’
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘zif_toGDImage’:
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:448: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame’:
/home/moiz/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:533: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
———————–
plz help me out
Sorry for the above post … i think i got it working. The latest build of ffmpeg-php had the PIX format fixed.
thanks anyway
Hi all,
I have tried to install amrweb (amrwb-7.0.0.3) and amrnb (amrnb-7.0.0.2) on Ubuntu. But i got this error : configure: error: You need patch utility to prepare sources.
I am trying to convert avi , mpg and wav files into flv but not getting voice (sound).
Please help me out to solve it asap.
Hitesh,
I am new for linux server, we need to install ffmpeg and other codec on it. in install perl module i found ffmpeg module which to be install. but i didn’t find other codec files which you said above. How can i install them through WHM only. server details cPanel 11.24.5-R37453 – WHM 11.24.2 – X 3.9
CENTOS 5.3 i686
The hostgator people asking $75 to install it.
Please help me..
I downloaded all the files as mentioned above in the article. I uploaded all of them to a folder on the same level as that of the public_html folder. All files were successfully untared. Then I followed each step as mentioned above. But I still get the error Unknown –enable-libamr-nb. Can any body tell me if the source files are to be placed in any particular folder? Im running all the commands as Root.
Hi Hitesh,
i have done with all the things it worked fine but the only problem is that the audio is getting so much of noise. even i used the parameter -absf noise and chnaged the parameters but with no success i appreciate if you pls let me know what would be the best configuration audio parameters for linux.
Best Regards’
Munish Dogra
Hi,
i have installed ffmpeg successfully.
# php -i | grep ffmpeg
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Nov 24 2009 18:42:08
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc52.20.0
ffmpeg libavformat version => Lavf52.31.0
ffmpeg swscaler version => SwS0.7.1
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0
also add the extention=\ffmpeg.so\ in php.ini file.
extension_dir = \/usr/lib/php/modules\
extension=\ffmpeg.so\
extension is loaded and i have checked ffmpeg entry in phpinfo.php file
when i used ffmpeg in my php script like below,
$audioffmpeg=’usr/bin/ffmpeg’;
$encode_cmd = \$audioffmpeg -i notify.wav test.mp3\;
exec($encode_cmd) or die (\ffmpeg did not work\);
it shows me \ffmpeg did not work\
in usr/bin directory there is a entry of ffmpeg so i have used ‘usr/bin/ffmpeg’ path. Also i have check in usr/local/bin but there is no any single file
i dont know it is path problem or other.
how would i check n set the exact path in php script?
how would i use ffmpeg in my php script?
thanks,
utsavi
Hello .@shital
You need to install patch !
Like this :
yum install patch
—-good luck ~~
I was trying to install ffmpeg-php on Fedora9, I’ve downloaded the ffpmeg-php-0.6.0 and used phpize and ./configure –enable-shared –prefix=/usr and both of them worked fine but when I tried to run make I got the following error:
“make: *** No targets specified and no makefile found. Stop.”
I tried the same procedure with ffmpeg-php-0.5.1 and ffmpeg-0.5.0 but failed.
Can anyone help with this.
Got this error loading shared libraries libavdevice.so.52 while using it with Apache.
How can i solve it as i created an application with web interface which converts the videos. If i convert it from command line it works like champ but if i try to convert from my browser then it gives error \loading shared libraries libavdevice.so.52L: cannot open shared object file: No such file or directory\
Any Idea.
Thanks In Advance
You can find prebuilt unofficial linux, mac, windows binaries here :
http://ivolo.mit.edu/post/FFMpeg-Unofficial-Builds-for-Windows-Linux-and-Mac.aspx
I have tries to install ffmpeg but it says -enable version3 is not supported.
libopencore_amrnb is version3 and –enable-version3 is not specified.
Thanks dude.. It helped lot to me.. Finally i got success with help of this article. hurrayy…