FFmpeg編譯
編譯pthreads-w32-2-8-0-release.tar.gz為動態庫
tar zxfv pthreads-w32-2-8-0-release.tar.gz
patch -p0 < pthreads-w32-2-8-0.diff
cd pthreads-w32-2-8-0-release
make clean GC
cp pthreadGC2.dll /mingw/lib
cp pthreadGC2.dll /mingw/bin
cp pthreadGC2.dll /mingw/lib/pthread.dll
cp pthread.h sched.h /mingw/include
編譯為靜態庫:
tar zxfv pthreads-w32-2-8-0-release.tar.gz
patch -p0 < pthreads-w32-2-8-0.diff
cd pthreads-w32-2-8-0-release
make clean GC-static
cp libpthreadGC2.a /mingw/lib
cp pthread.h sched.h /mingw/include
static編譯:
cd /d/ffmpeg
./configure --enable-memalign-hack --extra-cflags="-fno-common"
make
make install
shared 編譯:
cd /d/ffmpeg
./configure --enable-shared --disable-static --enable-memalign-hack --extra-cflags="-fno-common"
make
make install
PATH=$PATH:/usr/local/lib
目前的目錄會自動出現一個ffmpeg的目錄,耐心等它下載完。我下的大小差不多32MB
./configure --prefix=/usr --enable-gpl --enable-shared --enable-libmp3lame --enable-libxvid --enable-libfaad --enable-libfaadbin --enable-swscale --enable-pthreads
--enable-swscale一定要,後面編譯mediastreamer2要用到
清理:
make distclean
或者make clean
MSVC編譯需要的lib庫
strmbasd.lib winmm.lib strmiids.lib
libavutil.lib libavcodec.lib libavformat.lib
可能還需要libswscale.lib
avutil-49.lib avformat-52.lib avcodec-52.lib
If you need it, you must also add libavdevice.a.
If your build has enabled the software scaler, you must also add libswscale.a.
Additionally, for static libraries, you must add libgcc.a, which belongs to MinGW. It must be the same library as the gcc version used to compile FFmpeg.
If you get an unresolved symbol to _snprint, you must also link to libmingwex.a, found in the MinGW lib folder.
If you get an unresolved symbol to _strcasecmp, you must also link to libcoldname.a, found in the MinGW lib folder.
Obviously, if you used any external library, you must also link to them (e.g. libxvidcore.a, libz.a).
static pthreads-w32 libraries must also be linked to wsock32.lib (from MSVC).
static x264 libraries must also be linked to pthreads-w32 (which in their turn need wsock32.lib).
If avisynth was enabled, you must also link to vfw32.lib.
If you get an unresolved symbol to *_lc_codepage, you must either use a non-DLL runtime library (in C/C++->Code Generation->Runtime Library), or also link to libmsvcrt.a, found in the MinGW lib folder, which is probably an incredibly stupid idea (I should investigate further).
Additional Dependencies
libavcodec.a libavformat.a libavutil.a libswscale.a libz.a libdts.a libfaac.a
libfaad.a libgsm.a libmp3lame.a libnut.a libogg.a libtheora.a libvorbis.a
libvorbisenc.a libx264.a libxvidcore.a libpthreadGC2.a libgcc.a libmingwex.a
wsock32.lib vfw32.lib