Skip to content
WangBin edited this page Feb 14, 2017 · 50 revisions

Supports mingw gcc, msvc(>=2013) for desktop and store, android, ios, meego, sailfish os etc. Just run

export FFSRC=/path/to/ffmpeg # if no ffmpeg source fold under this dir
./avbuild.sh                 # build for host platform

You can pass arguments to the script, ./avbuild.sh $TARGET_OS $TARGET_ARCH.

For example

./avbuild.sh android armv7     # android armv7
./avbuild.sh ios arm64

You may have to set some vars in config-${TARGET_OS}.sh.

After building, the result headers and libs you need are in sdk-${TARGET_OS}-${TARGET_ARCH}

Host Build

./avbuild.sh

Windows

MinGW Cross Build

Install mingw-w64 compiler on linux or macOS, run ./avbuild.sh mingw64 x86 or ./avbuild.sh mingw64 x86_64

Windows Desktop(MinGW/VC), Store, Phone

MSYS2 is required. Environment var MSYS2_DIR must be set, for example C:\msys64. Click a shortcut in tools dir. Follow the guide in the new shell window.

You can also start a vs prompt, go to msys' bin dir and run sh --login -i and ./avbuild.sh vc to build for desktop

Android

Environment var ANDROID_NDK is required

./avbuild.sh android [armv5|armv7|x86]                         # gcc
android_toolchain=clang ./avbuild.sh android [armv5|armv7|x86] # clang

iOS

To build for 1 architecture, run

export FFSRC=/path/to/ffmpeg # if no ffmpeg source fold under this dir
./avbuild.sh ios armv7 # or arm64, i386, x86, x86_64 etc.

The result libraries are in sdk-ios-armv7.

To build s universal library supports all architectures (default are armv7, arm64, i386, x86_64), run

export FFSRC=/path/to/ffmpeg # if no ffmpeg source fold under this dir
./ios.sh

The result libraries are in sdk-ios

Bitcode is enabled for devices by default. To disable bitcode, run BITCODE=0 ./avbuild.sh ... or BITCODE=0 ./ios.sh instead

Use ./avbuild.sh ios4.0 armv7 to set minimal supported iOS version (4.0 here)

Raspberry Pi Cross Build

Download toolchains and sysroot

The default gcc is arm-linux-gnueabihf-gcc, sysroot is gcc sysroot. Set PATH to include gcc dir export PATH=$GCC_BIN_DIR:$PATH. Run ./avbuild.sh rpi or CROSS_PREFIX=your_prefix SYSROOT=your_sysroot ./avbuild.sh rpi.

Lite Build

Copy config-lite.sh to config.sh. Only frequently used features are enabled. Encoding is disabled except hardware accelerated encoders.

Prebuilt FFmpeg