How to compile and install external libs of FFMPEG?
It is a boring task to compile and install the external libs of FFMPEG, but to enjoy many good videos/audios, I have to travel over mountains and waters. If you have same feeling, let’s go! Furthermore, the article discusses the latest version when writing it. If new version is available, please use them. However, the methods should be coherent.
[Install NASM compiler]
1. Download nasm-2.06rc1.tar.bz2
2. Extract it in your appropriate folder
$ tar xvjf ./nasm-2.06rc1.tar.bz2 |
3. Configure it
$ cd ./nasm-2.06rc1 $ ./configure --prefix=/mingw |
4. Compile it
$ make |
5. Install it
$ make install |
[Install Mp3lame]
1. Download lame-398-2.tar.gz
2. Extract it in your appropriate folder
$ tar xvzf ./lame-398-2.tar.gz |
3. Configure it for shared lib. There are some errors when trying my best to setup static lib, so I select the shared mode. I think that the new version will issue the patch to fix it. Of course, if users unset --enable-nasm by sacrifice the performance, the static lib can be generated.
a) shared lib
$ cd ./lame-398-2 $ ./configure --prefix=/mingw --enable-shared --disable-static --enable-nasm |
b) static lib
$ ./configure --prefix=/mingw --disable-shared --enable-static |
4. Compile the source codes
$ make |
5. Install lib
$ make install |
[Install YASM]
1. Download yasm-0.7.2.tar.gz
2. Extract it into appropriate folder
$ tar xvzf ./yasm-0.7.2.tar.gz |
3. Configure it
$ cd ./yasm-0.7.2 $ ./configure --prefix=/mingw |
4. Compile it
$ make |
5. Install it
$ make install |
[Install XVID]
1. Download it by CVS tool
$ cvs -d:pserver:anonymous@cvs.xvid.org:/xvid login |
2. Configure it. The current XVID only can be compiled in light of shared mode!
$ cd ./xvidcore/build/generic $ ./configure --prefix=/mingw |
3. Compile it
$ make |
4. Install it
$ make install $ cp /mingw/lib/xvidcore.dll /mingw/bin |
[Install X264]
1. Download it by git tool
$ git clone git://git.videolan.org/x264.git |
2. Configure it
$ cd ./x264 $ ./configure –prefix=/mingw |
3. Compile it
$ make |
4. Install it
$ make install |
[Install FAAC]
1. Download faac-1.26.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./faac-1.26.tar.gz |
3. Configure it
$ cd ./faac $ ./bootstrap $ ./configure –prefix=/mingw –disable-shared –enable-static |
4. Compile it
$ make |
5. Install it
$ make install |
[Install FAAD2]
1. Download faad2-2.6.1.tar.gz
2. Download faad2-2.6.1.patch
3. Extract it into your appropriate folder
$ tar xvzf ./faad2-2.6.1.tar.gz $ patch –p0 < ./faad2-2.6.1.patch |
4. Configure it
$ cd ./faad2 $ ./bootstrap $ ./configure --prefix=/mingw --enable-static --disable-shared |
5. Compile it
$ make LDFLAGS="-no-undefined" |
6. Install it
$ make install |
[Install OGG]
OGG lib is essential element for VORBIS lib.
1. Download libogg-1.1.3.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./libogg-1.1.3.tar.gz |
3. Configure it
$ cd ./libogg-1.1.3 $ ./configure –prefix=/mingw –disable-shared –enable-static |
4. Compile it
$ make |
5. Install it
4 make install |
[Install VORBIS]
1. Download vorbis-tools-1.2.0.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./vorbis-tools-1.2.0.tar.gz |
3. Configure it
$ cd libvorbis-1.2.0 $ ./configure –prefix=/mingw –disable-shared –enable-static |
4. Compile it
$ make |
5. Install it
$ make install |
[Install SDL]
1. Download it by SVN tool
$ svn checkout http://svn.libsdl.org/trunk/SDL |
2. Configure it
$ cd ./SDL $ ./autogen.sh $ ./configure –prefix=/mingw –disable-shared –enable-static –enable-sse2 –enable-ssemath |
3. Compile it
$ make |
4. Install it
$ make install |
[Install THEORA]
1. Download libtheora-1.0beta3.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./libtheora-1.0beta3 |
3. Configure it
$ cd ./libtheora-1.0beta3 $ ./configure –prefix=/mingw –disable-shared –enable-static |
4. Compile it
$ make |
5. Install it
$ make install |
[Install SPEEX]
1. Download speex-1.2rc1.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./speex-1.2rc1.tar.gz |
3. Configure it
$ cd ./speex-1.2rc1 $ ./configure –prefix=/mingw –disable-shared –enable-static –enable-sse |
4. Compile it
$ make |
5. Install it
$ make install |
[Install GSM]
Please refer FFmpeg Understanding(5. How to install GSM lib for FFMPEG?)
Install OIL
1. Download liboil-0.3.16.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./liboil-0.3.16.tar.gz |
3. Configure it
$ cd ./liboil-0.3.16 $ ./configure --prefix=/mingw --disable-shared --enable-static |
4. Compile it
$ make |
5. Install it
$ make install |
Install schroedinger
1. Download glib_2.18.3-1_win32.zip and pkg-config-0.23-2.zip
2. Extract pkg-config.exe into /mingw/bin in the pkg-config-0.23-2.zip
3. Extract libglib-2.0-0.dll into /mingw/bin in the glib_2.18.3-1_win32.zip
4. Download schroedinger-1.0.7.tar.gz
5. Extract it into your appropriate folder
$ tar xvzf ./schroedinger-1.0.7.tar.gz |
6. Configure it
$ cd ./schroedinger-1.0.7 $ ./configure --prefix=/mingw --disable-shared --enable-static --enable-encoder --with-thread=win32 && make |
7. Compile it
$ make |
8. Install it
$ make install |
Install openjpeg
1. Download openjpeg_v1_3.tar.gz
2. Extract it into your appropriate folder
$ tar xvzf ./openjpeg_v1_3.tar.gz |
3. Configure it
$ vim ./Makefile 14 PREFIX = /mingw
48 #OpenJPEG: $(STATICLIB) $(SHAREDLIB) 49 OpenJPEG: $(STATICLIB)
57 #$(SHAREDLIB): $(MODULES) 58 # $(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
62 # install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' 63 install -m 644 $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' 64 ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)' 65 # install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' 66 # ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)' 67 # install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)' 68 install -m 644 libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)' 69 # -ldconfig
72 # rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME) 73 rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) |
4. Compile it
$ make CFLAGS="-DWIN32 -DOPJ_STATIC $CFLAGS" |
5. Install it
$ make install |
Install libnut
1. Download source code.
svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut
|
2. Modify demuxer.c, and red color marks the changes.
Original source code | Source code modified |
static off_t stream_seek(void * priv, long long pos, int whence) { fseek(priv, pos, whence); return ftello(priv); } | static off_t stream_seek(void * priv, long long pos, int whence) { fseek(priv, pos, whence); return ftell(priv); } |
3. Modify config.mk, and red color marks the changes.
Original Configuration | Configuration modified |
PREFIX = /usr/local prefix = $(DESTDIR)$(PREFIX)
#CFLAGS += -DDEBUG
CFLAGS += -Os -fomit-frame-pointer -g -Wall
CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CC = cc RANLIB = ranlib AR = ar | PREFIX = /mingw prefix = $(DESTDIR)$(PREFIX)
#CFLAGS += -DDEBUG
CFLAGS += -O3 -fomit-frame-pointer -Wall
CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CC = gcc RANLIB = ranlib AR = ar |
4. Compile it
$ make |
5. Install it
$ make install |
Install opencore-amr
Please refer to How to compile opencore-amr in the MINGW .
[How to use above external lib by FFMPEG?]
$ cd ./ffmpeg $ make uninstall $ make distclean $ ./configure --prefix=/mingw --enable-memalign-hack --enable-shared --disable-static --enable-w32threads --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-gpl --enable-avfilter --enable-postproc --enable-avfilter-lavf --enable-swscale --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libfaac --enable-libfaad --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 $ make $ make install |
[Summarization]
1. The general way to acquire external libs are:
a) Use tool to check them out, for example, cvs, svn, wget, git, and so on.
b) Download source-codes released, and extract them into appropriate folder.
2. The fixed mode to configure, compile and install. They have been shown in the above contents, such as:
$ ./xxxx.sh #if it exists $ ./configure –prefix=/mingw … $ make $ make install |
3. Try you best to make static lib if there are too many shared files in your project. The basic method is add ‘--disable-shared’ and ‘--enable-static’ option in the command of configure .
4. Prepare the dependent libs before installing it. You can use ‘./configure –h’ to probe the relationships among them.
5. http://downloads.xiph.org/releases/ is a good place to find libs.
[Appendix: the other useful libs]
1. A52 decoder:
cvs -d:pserver:anonymous@liba52.cvs.sourceforge.net:/cvsroot/liba52 login
cvs -z3 -d:pserver:anonymous@liba52.cvs.sourceforge.net:/cvsroot/liba52 co -P .
2. DTS decoder:
cvs -d:pserver:anonymous@dts.cvs.sourceforge.net:/cvsroot/dts login
cvs -z3 -d:pserver:anonymous@dts.cvs.sourceforge.net:/cvsroot/dts co -P .
3. flvtools
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
4. armnb
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.4.tar.bz2
5. libiconv
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
6. zlib:
7. freetype2
http://sourceforge.net/project/showfiles.php?group_id=3157
8. libregif
http://armory.nicewarrior.org/projects/libregif/
9. libpng
http://www.libpng.org/pub/png/
http://sourceforge.net/project/showfiles.php?group_id=5624
10. live555
http://www.live555.com/liveMedia/
[History]
1. 01/23/2009 --- draft
2. 04/19/2009 --- fix some errors
3. 04/25/2009 --- Add libnuts, schreodinger, openjpeg
4. 08/01/2009 --- Add opencore-amr