参考:
http://www.ffmpeg.org/platform.html
windows系统下使用微软VC++或Intel C++编译器编译ffmpeg
4.2 Microsoft Visual C++ or Intel C++ Compiler for Windows
FFmpeg can be built with MSVC 2012 or earlier using a C99-to-C89 conversion utility and wrapper, or with MSVC 2013 and ICL natively.
使用MVC2013和Intel ICL编译器可以直接编译ffmpeg
编译前的准备工作:
You will need the following prerequisites:
C99-to-C89 Converter & Wrapper (if using MSVC 2012 or earlier)
msinttypes (if using MSVC 2012 or earlier)
MSYS2
YASM (Also available via MSYS2’s package manager.)
对于使用MVC2013和Intel ICL编译器,需要安装 MSYS2、YASM
为了准备编译,需要再使用MVC2013和Intel ICL编译器的命令行中运行脚本 msys_shell.bat来准备环境
To set up a proper environment in MSYS2, you need to run msys_shell.bat from the Visual Studio or Intel Compiler command prompt.
另外将汇编器yasm.exe 放在环境变量PATH指向的目录下,使得MVC2013和Intel ICL编译器能够找到
Place yasm.exe somewhere in your PATH. If using MSVC 2012 or earlier, place c99wrap.exe and c99conv.exe somewhere in your PATH as well.
Next, make sure any other headers and libs you want to use, such as zlib, are located in a spot that the compiler can see. Do so by modifying the LIB and INCLUDE environment variables to include the Windows-style paths to these directories. Alternatively, you can try and use the --extra-cflags/--extra-ldflags configure options. If using MSVC 2012 or earlier, place inttypes.h somewhere the compiler can see too.
Finally, run:
For MSVC:
./configure --toolchain=msvc
For ICL:
./configure --toolchain=icl
make
make install
If you wish to compile shared libraries, add --enable-shared to your configure options. Note that due to the way MSVC and ICL handle DLL imports and exports, you cannot compile static and shared libraries at the same time, and enabling shared libraries will automatically disable the static ones.
Notes:
It is possible that coreutils’ link.exe conflicts with MSVC’s linker. You can find out by running which link to see which link.exe you are using. If it is located at /bin/link.exe, then you have the wrong one in your PATH. Either move or remove that copy, or make sure MSVC’s link.exe takes precedence in your PATH over coreutils’.
If you wish to build with zlib support, you will have to grab a compatible zlib binary from somewhere, with an MSVC import lib, or if you wish to link statically, you can follow the instructions below to build a compatible zlib.lib with MSVC. Regardless of which method you use, you must still follow step 3, or compilation will fail.
Grab the zlib sources.
Edit win32/Makefile.msc so that it uses -MT instead of -MD, since this is how FFmpeg is built as well.
Edit zconf.h and remove its inclusion of unistd.h. This gets erroneously included when building FFmpeg.
Run nmake -f win32/Makefile.msc.
Move zlib.lib, zconf.h, and zlib.h to somewhere MSVC can see.
FFmpeg has been tested with the following on i686 and x86_64:
Visual Studio 2010 Pro and Express
Visual Studio 2012 Pro and Express
Visual Studio 2013 Pro and Express
Intel Composer XE 2013
Intel Composer XE 2013 SP1
Anything else is not officially supported.