Transferred from: http://www.cnblogs.com/dwdxdy/p/3625766.html
Since FFmpeg is an open source project based on Linux, the source code is incompatible with the C + + compiler provided by the most common Visual Studio under Windows, so it cannot be compiled with msvc++ and requires a Linux-like build environment under Windows. This article mainly records the process of FFmpeg compilation under Windows.
1. Resource Preparation
Prepare the software tools and source code required for the compilation process.
(1). Mingw-msys Bundle http://sourceforge.net/projects/mingwbundle/
(2). Yasm http://yasm.tortall.net/Download.html
(3). SDL http://www.libsdl.org/download-1.2.php
(4). X264 http://www.videolan.org/developers/x264.html
(5). FFmpeg http://www.ffmpeg.org/download.html
2. Software Installation
(1). Mingw+msys Build Environment Installation
One approach is to install the MinGW, and then install the MinGW and Msys software through the network download method. After installation, and then through the cumbersome configuration, to build a compilation environment. Another mingw+msys system that is directly installed and configured properly. To reduce the complexity of the installation process, choose the second method to install the Mingw+msys compilation environment. After downloading the Mingw-msys bundle software, install the program directly, configure the installation path, follow the Software Default installation Wizard, you can install the software.
After the installation is complete, you need to configure Msys.bat to launch a terminal similar to the Linux environment. If the installation is complete, the installation target "C:\msys\1.0" is not msys.bat, you need to add Msys.bat file, reference: https://code.google.com/p/msysgit/source/browse/ Msys.bat, then add the command on the first line of Msys.bat.
Call "C:/Program Files (x86)/microsoft Visual Studio 9.0/vc/bin/vcvars32.bat"
(2). Install Yasm
Download the Yasm source package and extract it to the E:\ffmpeg1.2\yasm-1.2.0 directory.
Make the Yasm directory, and then click Execute:
./configure–-prefix=/usr/local/yasmmakemake Install
Then import the YASM environment variable with the following command.
Export path= "$PATH:/usr/local/yasm/bin"
(3). Installing the SDL
Download the SDL source package and extract it to the E:\ffmpeg1.2\SDL-1.12.15 directory
Go to the SDL directory and execute
./configure-–prefix=/usr/local/sdlmakemake Install
Import the SDL environment variables using the following command.
Export path= "$PATH:/usr/local/sdl/bin"
Export c_include_path= "$C _include_path:/usr/local/sdl/include/sdl"
Export ld_library_path= "$LD _library_path:/usr/local/sdl/lib"
(4). Install x264
Download X264 source code package, unzip to E:\ffmpeg1.2\x264
Go to the x264 and execute it sequentially
./configure --enable-shared–-disable-asm-–prefix=/usr/local/x264makemake Install
Import the x264 environment variable by using the following command.
Export path= "$PATH:/usr/local/x264/bin"
Export c_include_path= "$C _include_path:/usr/local/x264/include"
Export ld_library_path= "$LD _library_path:/usr/local/x264/lib"
(5). Install FFmpeg
Download FFmpeg source code package, unzip to E:\ffmpeg1.2\ffmpeg1.2
Go to the ffmpeg1.2 directory and execute it sequentially
./configure–-enable-shared-–disable-static–-enable-memalign-hack--enable-libx264--enable-gpl–-prefix=/usr/ Local/ffmpeg1.2makemake Install
After the installation is complete, go to the D:\msys\1.0\local\ffmpeg1.2 directory to view the installation results.
Attention:
If you need ffmpeg support for other video audio codecs, simply download the appropriate source code and follow these steps to install:
Configuration (./configure)---> Compile (make)---> install (make install)---> Import environment variable (export).
Also, when compiling the ffmpeg, turn on the corresponding codec configuration.
"FFmpeg" under Windows FFmpeg compilation