Reprint please specify: from Ericking,thanks
Never thought of compiling a library so pit dad, again remind you Baidu things can only refer to, want to save time or to the official online to see Docum. No nonsense, start the detailed process:
---"1. Build the GCC build environment under win (because win under vs does not support FFmpeg's compile and build, the official web site also said that)
---"2. Download latest FFmpeg source (attached to the official website), find a way to make the compiled file into a DLL, which is the core of WIN programming debugging
(Here is a VC under the VS Bash file called Vcvars32.bat, note whether your system is 32 or x64, this bash can complete the build DLSL)
--"3.compile and build (here to set the path, complete the first step, At the same time learn to analyze Config.log This file, found himself in the end is GCC did not match, or some decoding library does not, or is the problem of common.h, of course, common.h problem is in make times problems, and GCC did not match well, in the config will be reported: GCC is unable to the create an executable file. If GCC is a cross-compiler, use the--enable-cross-compile option. This is the first step that is not fixed). Finally, an important trick is to lightweighting your own FFmpeg development library. is to make an install after making. This step is mainly to complete the include file and DLL optimization, from the make results have been generated good dll,lib and so on.
OK, with the general concept, the following is the detailed steps (here is the reference network information, but there are important differences, please note):
1. GCC built on Win:
ready to compile the environment MinGW:http://sourceforge.net/projects/mingw/files/, click Download Mingw-get-setup.exe, use the default installation, the path to \ C MinGW; Install MinGW, select the necessary gcc, msys and other options in the manager. As for the ADA and Frotan options, it is best not to choose, installation time-consuming, this compilation environment is basic, the bottom is the configuration of the relevant compilation tools.
2. To the official website to download the latest FFmpeg source:http://ffmpeg.zeranoe.com/builds/source/ffmpeg/, for security purposes, please use 7-zip this decompression software to extract, if you have to right-click Decompression, I have no opinion , there are some decompression after the file problems, damage some ffmpeg files, but this risk has some probability problems exist, here can only give you a little blessing of violence.
Next, (note: This step can be done, or do not do) download the latest yasm:http://yasm.tortall.net/download.html
Select the Yasm.exe that corresponds to your system (my system is the Win32.exe of the Win7 32-bit selection);
The download of the Yasm*.exe renamed to Yasm.exe (x64 also changed to this, but in addition to System32, please put into the SysWOW64) into the C-drive under the/windows/system32/directory, so that the environment variable is omitted.
PS: If in the back of the Configure FFmpeg times GCC path is not the problem (specifically to see log, to determine precisely this problem), then please do this:
Open the properties of the computer--"Environment variables--" to the system-level environment variable path add 2 variables, C:\MinGW\msys\1.0; C:\MinGW\msys\1.0\bin
Next, go to the MinGW installation directory: C:\MinGW\msys\1.0 find the Msys.bat file, Notepad open the editor (here is recommended safe notepad++ to edit, because the win TXT editor Bash,save when the problem may occur), Add one line to the front:
Call "C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\bin\vcvars32.bat"
The purpose of this is to link vs to generate the library file under window. The path above is corresponding to the VS path you installed, my environment is VS2012. Note: This line must be at the very beginning of this file (putting it to the top that does not work except for the REM start is because win MinGW does not run the following configuration by default after encountering Echo). If your OS is a x64 bit, you also need to modify the _windowsnt of the file, immediately following the line to add:
REM Hopefully a temporary workaround for getting MSYS Shell to run on x64
REM (WoW64 cmd prompt sets Processor_architecture to x86)
If not "x%processor_architecture%" = = "x64" goto _notx64
Set Comspec=%windir%/syswow64/cmd.exe
%comspec%/C%0%1%2%3%4%5%6%7%8%9
Goto EOF
: _notx64
Note: Here the third sentence, to see whether their CPU core is AMD or Intel, if the latter, it is OK, if it is AMD will "x64" to "xAMD64", this is not to guide GCC to use the correct CPU. I just press Baidu results, no crossing network, led to GCC has been the path is not correct, since the pit of the baby are tears Ah!
Ok, the above all finished, entered the compile:
3.Compile and Build:
Enter C:\MinGW\msys\1.0, double-click Msys.bat start Msys, this time into the familiar Linux environment, this environment allows linux-like bash operation, and then into the download FFmpeg directory
Execute in the FFmpeg directory:
1.static Lib:
./configure--disable-shared--enable-static--enable-decoder=h264--enable-memalign-hack
2.dynamic Lib:
./configure--enable-shared--enable-decoder=h264--enable-memalign-hack
(PS: Last clean before each config, command: Make Distclean, if you want to compile ffmpegpaly, also need to download the DSL, extract the corresponding bin,lib,include content, copy to the specified msys/1.0 /bin,lib,include, at the same time to sdl-config under the bin with notepad++ to modify his prefix = c:/mingw,config, GCC will automatically open SDL)
(Waiting for config ... )
It is worth noting here that the--enable-memalign-hack option is the ffmpeg must be specified on the successful compilation of Windows, the parameter settings have a certain order, it is possible to cause the subsequent make failed, here are a few commands, you do not need to tense, as long as there is the last item , the other later use to re-config is no problem.
Of course, configure parameters can be set according to the needs of their own, execution./configure--help view parameter details.
Make
Started production of Lib,dll, etc...
Make install (best to do this step, the rare automatic packaging ... )
OK, in the C:\MinGW\msys\1.0 Bin,include and Lib directory generated the latest. lib and. dll library files, not online many said in the local, or find you ah .... , you can then call the Library under the window platform and develop the FFmpeg application.
Thanks from Ericking,enjoy it. The last PS, respect the copyright, not just I wrote this, more ffmpeg open-source GPL agreement. Because their stigma has been or is now still full of some of China's famous internet companies, haha ...