1
|
# Building FFmpeg on Windows
|
2
|
|
3
|
The script ffmpeg_build.sh allows compiling FFmpeg on Windows for the following targets :
|
4
|
|
5
|
- Win32 using VS2010
|
6
|
- Android arm/arm64/x86/x86_64/mips/mips64 using GCC.
|
7
|
|
8
|
## Prerequisites
|
9
|
|
10
|
- MSYS : http://www.mingw.org or MSYS2 (https://msys2.github.io/)
|
11
|
- FFmpeg sources : get the sources of a release from https://github.com/FFmpeg/ (tested with 2.8.4)
|
12
|
- YASM : http://yasm.tortall.net/Download.html (use a "Win32 .exe" release) (note : needs VC2010 redistributable)
|
13
|
|
14
|
Rename the YASM executable to yasm.exe and put in in your PATH.
|
15
|
|
16
|
To speed up the build, you can specify the number of parallel `make` jobs at line 37 in the script `ffmpeg_build.sh` :
|
17
|
add `-j <number of jobs>` to the first `make` instruction.
|
18
|
Note that this might not work with MSYS 1 (the one supplied with MinGW32).
|
19
|
|
20
|
The script allows to build both release and debug versions of the library.
|
21
|
|
22
|
## Building for Win32 with VS2013
|
23
|
|
24
|
### Prerequisites
|
25
|
|
26
|
- C99-to-C89 : https://github.com/libav/c99-to-c89/releases
|
27
|
Needed because VS only supports C99 from version 2013 onwards.
|
28
|
- msinttypes : https://code.google.com/p/msinttypes/
|
29
|
For inttypes.h and possibly stdint.h if your VS doesn't already have it.
|
30
|
|
31
|
Unzip C99-to-C89 and msinttypes to the same folder.
|
32
|
Add this folder to your PATH and INCLUDE variables (create INCLUDE if needed).
|
33
|
|
34
|
### Build
|
35
|
|
36
|
Launch a Visual Studio shell (there should be a shortcut in your start menu).
|
37
|
This opens a cmd window with pre-configured env variables that MSVC needs.
|
38
|
From this shell, launch an MSYS shell (msys.bat).
|
39
|
You can now close the initial VS shell.
|
40
|
|
41
|
In the MSYS shell, make sure cl and link point to VS executables (`which cl`, `which link`).
|
42
|
If it isn't the case : `export PATH="<path to your VS install>/VC/BIN":$PATH`
|
43
|
Also check `which make` and if needed in msys2 use pacman commands to sync make.
|
44
|
You can now build FFmpeg (use absolute paths to specify directories) :
|
45
|
`./ffmpeg_build.sh win32 <debug/release> <ffmpeg sources dir> <build destination dir>`
|
46
|
|
47
|
If the build fails because of mutliple int type declarations, remove stdint.h from the folder where you unpacked msinttypes.
|
48
|
|
49
|
*Note* : You can't link a debug Scol build with a release FFmpeg build, and vice versa.
|
50
|
|
51
|
|
52
|
## Building for Android
|
53
|
|
54
|
### Prerequisites
|
55
|
|
56
|
- Android NDK (tested with 10e)
|
57
|
|
58
|
### Build
|
59
|
|
60
|
In an MSYS shell, build FFmpeg with the desired options (use absolute paths to specify directories) :
|
61
|
`./ffmpeg_build.sh android <debug/release> <ffmpeg sources dir> <build destination dir> <ANDROID_NDK_PATH> <ANDROID_TARGET_API> <ANDROID_TARGET_ABI> <GCC_VERSION>`
|