|
# Building FFmpeg on Windows
|
|
|
|
The script ffmpeg_build.sh allows compiling FFmpeg on Windows for the following targets :
|
|
|
|
- Win32 using VS2010
|
|
- Android arm/arm64/x86/x86_64/mips/mips64 using GCC.
|
|
|
|
## Prerequisites
|
|
|
|
- MSYS : http://www.mingw.org or MSYS2 (https://msys2.github.io/)
|
|
- FFmpeg sources : get the sources of a release from https://github.com/FFmpeg/ (tested with 2.8.4)
|
|
- YASM : http://yasm.tortall.net/Download.html (use a "Win32 .exe" release) (note : needs VC2010 redistributable)
|
|
|
|
Rename the YASM executable to yasm.exe and put in in your PATH.
|
|
|
|
To speed up the build, you can specify the number of parallel `make` jobs at line 37 in the script `ffmpeg_build.sh` :
|
|
add `-j <number of jobs>` to the first `make` instruction.
|
|
Note that this might not work with MSYS 1 (the one supplied with MinGW32).
|
|
|
|
The script allows to build both release and debug versions of the library.
|
|
|
|
## Building for Win32 with VS2013
|
|
|
|
### Prerequisites
|
|
|
|
- C99-to-C89 : https://github.com/libav/c99-to-c89/releases
|
|
Needed because VS only supports C99 from version 2013 onwards.
|
|
- msinttypes : https://code.google.com/p/msinttypes/
|
|
For inttypes.h and possibly stdint.h if your VS doesn't already have it.
|
|
|
|
Unzip C99-to-C89 and msinttypes to the same folder.
|
|
Add this folder to your PATH and INCLUDE variables (create INCLUDE if needed).
|
|
|
|
### Build
|
|
|
|
Launch a Visual Studio shell (there should be a shortcut in your start menu).
|
|
This opens a cmd window with pre-configured env variables that MSVC needs.
|
|
From this shell, launch an MSYS shell (msys.bat).
|
|
You can now close the initial VS shell.
|
|
|
|
In the MSYS shell, make sure cl and link point to VS executables (`which cl`, `which link`).
|
|
If it isn't the case : `export PATH="<path to your VS install>/VC/BIN":$PATH`
|
|
Also check `which make` and if needed in msys2 use pacman commands to sync make.
|
|
You can now build FFmpeg (use absolute paths to specify directories) :
|
|
`./ffmpeg_build.sh win32 <debug/release> <ffmpeg sources dir> <build destination dir>`
|
|
|
|
If the build fails because of mutliple int type declarations, remove stdint.h from the folder where you unpacked msinttypes.
|
|
|
|
*Note* : You can't link a debug Scol build with a release FFmpeg build, and vice versa.
|
|
|
|
|
|
## Building for Android
|
|
|
|
### Prerequisites
|
|
|
|
- Android NDK (tested with 10e)
|
|
|
|
### Build
|
|
|
|
In an MSYS shell, build FFmpeg with the desired options (use absolute paths to specify directories) :
|
|
`./ffmpeg_build.sh android <debug/release> <ffmpeg sources dir> <build destination dir> <ANDROID_NDK_PATH> <ANDROID_TARGET_API> <ANDROID_TARGET_ABI> <GCC_VERSION>`
|