Installing FFMPEG 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
Still facing problem while installing leave a comment, will try my best to help you out.
Similar Posts
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.
Comments
I couldn’t understand some parts of this article ing FFMPEG on Linux | Techie Zone, but I guess I just need to check some more resources regarding this, because it sounds interesting.
[...] was simply ignoring writing this articles after writing articles on Installing FFMPEG on Linux. But i couldn’t resist on writing this article. Anyways this article will guide you on how [...]
hi
i want to use ffmpeg to convert .flv to .amr
i installed both libamr-nb and libamr-wb
and installed ffmpeg with
“./configure –enable-libamr-nb –enable-libamr-wb”
but then ffmpeg command gives me following error..
“ffmpeg: error while loading shared libraries: libamrnb.so.3: cannot open shared object file: No such file or directory”
what’s going on.?
please help.
nahian
hi hitesh.
thanx for helping..
i used following commands for installing libamr-nb and libamr-wb
./configure
make clean
make
make install
and for installing ffmpeg
./configure –enable-libamr-wb –enable-libamr-nb –enable-shared
make clean
make
make install
now for ffmpeg command i find this message
“ffmpeg: error while loading shared libraries: libavformat.so.51: cannot open shared object file: No such file or directory”
again i tried with this.
./configure –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-gpl –enable-shared
but same thing happened
but using “locate libavformat.so.51″ command i find following ..
/usr/local/lib/libavformat.so.51.17.0
/usr/local/lib/libavformat.so.51
i’m using (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
Hi Hitesh,
Thanks for publishing useful article.
However after installing ffmpeg and run at the terminal window in Linux I have got the error as follows
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
Best Regards’
Munish Dogra
I’m trying to install on a unix system/apache webserver. Can you point me to the steps I need to take for this.
Hi I m facing problem to install .so file, I want to install ffmpeg but I can’t install .so file, Anyboby could help me
Monti
I’ve been trying to get the extension ogghandler to work on an installation of mediawiki. It requires ffmpeg and I thought that I installed it correctly but I keep getting the error:
Error creating thumbnail: /home/usr/bin/ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
that file is located there and but I can’t seem to get around this one. Any ideas?
Hi,
Has anyone tried installing FFMpeg on windows and integrate it with visual studio.
I trying to run both the encoder and decoder which is in the output_eaxmaple.c file.
It will be great if someone has already done this.
Hello,
all steps work until I reach ffmpeg-php installation.
I use openSUSE 10.3 and newest ffmpeg version and ffmpeg-php 0.5.0
After configure and make I do make test and there comes all those errors:
“PHP Warning: PHP Startup: Unable to load dynamic library ‘modules/ctype.so’ - modules/ctype.so: cannot open shared object file: No such file or directory in Unknown on line 0″
And this error for each build-in mod. And all
Number of tests : 31 19
Tests skipped : 12 ( 38.7%) ——–
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 19 ( 61.3%) (100.0%)
Tests passed : 0 ( 0.0%) ( 0.0%)
So I guess there is a problem with my php-configuration, right?
Hello ,
I want to convert any audio or video file into flv. T have ffmpeg.exe which is running on windows. I want to run on linux so what i do? Is there any other file like windows from there i can convert .flv file? Please suggest
Hi,
I followed the given steps in this article. But I get the following error ./home/dev3/public_html/vasanthi/ffmpeg/libavcodec/libavcodec.so: undefined reference to `GP3Decoder_Interface_Decode’
/home/dev3/public_html/vasanthi/ffmpeg/libavcodec/libavcodec.so: undefined reference to `VADxEncoder_Interface_init’
/home/dev3/public_html/vasanthi/ffmpeg/libavcodec/libavcodec.so: undefined reference to `GP3VADxEncoder_Interface_Encode’
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1
How to solve this . Help pls
Thanks
For those who got an error like “error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory”, you can do the next:
cd /etc/ld.so.conf.d
add another file: custom-libs.conf
inside, put :
/usr/local/lib
save,
then do ldconfig
I’m getting an error trying to convert a video with the mp4a audio codec. Has anybody got a solution? This is the error:
…..
Stream #0.1(eng): Audio: mp4a / 0×6134706D, 44100 Hz, stereo
…..
Unsupported codec (id=86018) for input stream #0.1
Well, I’ve solved the problem. I had to install the faad library, but it has some other dependencies like libid3-dev, which we must install before installing the faad library.
while using the ffmpeg command I get the following errors
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
I used this command
./configure –prefix=$HOME –enable-libamr-wb
But got this error:
libamr is nonfree and –enable-nonfree is not specified.
So I used this one:
./configure –prefix=$HOME –enable-libamr-wb –enable-nonfree
and got this error:
ERROR: libamrwb not found
I have already installed the AMR, and it located at /home/username/lib, I think error happened because it can not find the lib directory under my user root. Are there any way to tell ./configure the place for the AMR library?
Thanks very much.
Note to above comment, I am using web hosting and no way to update /etc/ld.so.conf.d, so anyone ever used ffmpeg in web hosting server?
Hi I have a question about installation. I installed all the files in usr/local when i tried the last part from the ffmpeg dir.. i get this error
Unknown option “–enable-libmp3lame”.
See ./configure –help for available options.
then i tried just ./configure -enable-shared
i get this
bash: ./configure: No such file or directory
keep in mind i am running the commands from the ffmpeg dir.
so from teh ffmpeg dir i just ran the ./configure
make
make install
i got so many warnings and deprecated warning. in the end i got
install -d “/usr/local/bin”
install -c -m 755 ffmpeg ffserver “/usr/local/bin”
so my dir structure looks like this
usr/local
usr/local/ffmpeg
usr/local/lame-3.97
usr/local/amrnb-7.0.0.0
usr/local/amrwb-7.0.0.2
all the file that i untared are on the same level should they have all been under the ffmpeg. how would i run a test scrip to convert any video format to .flv?
Thanks any help would be much appreciated.
Neveo
Follow this instruction, you can install succesfully
http://www.netbrix.net/archives/20
Good luck
Hi Hitesh,
I have tried installing ffmpeg on Linux.
1.downloaded svn checkout version
2.unzipping it using tar -xjf command
3.Do ./configure –enable-shared
4.Make install
5.make
I got the .so libraries in /usr/lib/local folder
but when i am linking the above librraies and running the code i am getting the segmentation fault error in av_open_input_stream.
I think that there is error in ffmpeg installation.
Please guide me how should i be able to install the ffmpeg correctly.
Regards,
Mayank
HI
all the above were installed easily
Thanx for this wounderful guide but I have some problems in installing FFMPEG-PHP I got that install after that no further commaands runs like ./configure
Kindly guide me
Thanx and regards,
SAF
Hi,
Hitesh
Please help me. I want to convert 3gp file into flv using ffmpeg. The syntax is
ffmpeg -i upload/video/song/test.3gp -y -ab 56 -ar 22050 -ac 2 -qscale 9 -t 900 -r 15 -s 320*240 upload/video/song/test.flv
this convert the 3gp file into flv but flv size is 0kb.
So please guide me and send the correct command to convert the 3gp into flv
Thanks in advance
When i try to execute the comand make for ffmpeg-php i get this:
checking for egrep… grep -E
checking for a sed that does not truncate output… /bin/sed
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ANSI C… none needed
checking whether gcc and cc understand -c and -o together… yes
checking if compiler supports -R… no
checking if compiler supports -Wl,-rpath,… yes
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
checking for PHP prefix… /usr/local
checking for PHP includes… -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory… /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix… /usr/local/include/php
checking for re2c… re2c
checking for re2c version… 0.13.3 (ok)
checking for gawk… gawk
checking for ffmpeg support… yes, shared
checking for ffmpeg headers… …found in /usr/local/include/ffmpeg
checking for ffmpeg libavcodec.so… …found in /usr/local/lib
checking for ld used by gcc… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for /usr/bin/ld option to reload object files… -r
checking for BSD-compatible nm… /usr/bin/nm -B
checking whether ln -s works… yes
checking how to recognise dependent libraries… pass_all
checking how to run the C preprocessor… gcc -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking dlfcn.h usability… yes
checking dlfcn.h presence… yes
checking for dlfcn.h… yes
checking for g++… g++
checking whether we are using the GNU C++ compiler… yes
checking whether g++ accepts -g… yes
checking how to run the C++ preprocessor… g++ -E
checking the maximum length of command line arguments… 32768
checking command to parse /usr/bin/nm -B output from gcc object… ok
checking for objdir… .libs
checking for ar… ar
checking for ranlib… ranlib
checking for strip… strip
checking if gcc static flag works… yes
checking if gcc supports -fno-rtti -fno-exceptions… no
checking for gcc option to produce PIC… -fPIC
checking if gcc PIC flag -fPIC works… yes
checking if gcc supports -c -o file.o… yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries… yes
checking whether -lc should be explicitly linked in… no
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… no
creating libtool
appending configuration tag “CXX” to libtool
checking for ld used by g++… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries… yes
checking for g++ option to produce PIC… -fPIC
checking if g++ PIC flag -fPIC works… yes
checking if g++ supports -c -o file.o… yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries… yes
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
root@angie [/usr/local/src/ffmpeg-php-0.5.0]# make
/bin/sh /usr/local/src/ffmpeg-php-0.5.0/libtool –mode=compile gcc -I. -I/usr/local/src/ffmpeg-php-0.5.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.5.0/include -I/usr/local/src/ffmpeg-php-0.5.0/main -I/usr/local/src/ffmpeg-php-0.5.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c -o ffmpeg_frame.lo
gcc -I. -I/usr/local/src/ffmpeg-php-0.5.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.5.0/include -I/usr/local/src/ffmpeg-php-0.5.0/main -I/usr/local/src/ffmpeg-php-0.5.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c: In function `_php_convert_frame’:
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:162: warning: implicit declaration of function `img_convert’
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c: In function `_php_crop_frame’:
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:215: warning: implicit declaration of function `img_copy’
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c: In function `_php_resample_frame’:
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: `ImgReSampleContext’ undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: (Each undeclared identifier is reported only once
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: for each function it appears in.)
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: `img_resample_ctx’ undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:263: warning: implicit declaration of function `img_resample_full_init’
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:276: warning: implicit declaration of function `img_resample’
/usr/local/src/ffmpeg-php-0.5.0/ffmpeg_frame.c:281: warning: implicit declaration of function `img_resample_close’
make: *** [ffmpeg_frame.lo] Error 1
Cant continue, please help
Hi I am getting the following error:
./configure –enable-libmp3lame –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared –enable-nonfree
Unable to create and execute files in /tmp. Set the TMPDIR environment
variable to another directory and make sure that /tmp is not mounted
noexec.
Sanity test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file “config.err” produced by configure as this will help
solving the problem.
Please help me


Hi
Could you please explain and give me good suggestions on ffmpeg on windows based operating systems?
Thank you.
Regards.