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
FFmpeg编译口令
最新推荐文章于 2023-11-09 08:33:28 发布