Compiling FFmpeg
Official FFmpeg : http://www.ffmpeg.org
Compiling FFmpeg on any platform proves to be quite a challenge,
due to its complexity and related libraries,
and its combination of applications,
its update rates.
Therefore, we only give a common suggestion and settings here.
If you want to compile FFmpeg by yourself,
you might spend some time to find out what configuration exact your need.
FFmpeg on Windows
A pre-compiled FFmpeg on Windows libraries are available at
http://ffmpeg.zeranoe.com/builds.
We suggest you use this version of built.
After your download, the following commands are recommented
to ensure the .lib files are actually useful for linking:
x64
LIB /machine:x64 /def:avcodec-56.def /OUT:avcodec.lib
LIB /machine:x64 /def:avdevice-56.def /OUT:avdevice.lib
LIB /machine:x64 /def:avfilter-5.def /OUT:avfilter.lib
LIB /machine:x64 /def:avformat-56.def /OUT:avformat.lib
LIB /machine:x64 /def:avutil-54.def /OUT:avutil.lib
LIB /machine:x64 /def:postproc-53.def /OUT:postproc.lib
LIB /machine:x64 /def:swresample-1.def /OUT:swresample.lib
LIB /machine:x64 /def:swscale-3.def /OUT:swscale.lib
|
After rebuild, copy files inside directory "include" into
CiosAudio/Platforms/Windows/FFmpeg/include
copy *.lib
CiosAudio/Platforms/Windows/FFmpeg/lib/x64
x86
LIB /machine:x86 /def:avcodec-56.def /OUT:avcodec.lib
LIB /machine:x86 /def:avdevice-56.def /OUT:avdevice.lib
LIB /machine:x86 /def:avfilter-5.def /OUT:avfilter.lib
LIB /machine:x86 /def:avformat-56.def /OUT:avformat.lib
LIB /machine:x86 /def:avutil-54.def /OUT:avutil.lib
LIB /machine:x86 /def:postproc-53.def /OUT:postproc.lib
LIB /machine:x86 /def:swresample-1.def /OUT:swresample.lib
LIB /machine:x86 /def:swscale-3.def /OUT:swscale.lib
|
After rebuild, copy files inside directory "include" into
CiosAudio/Platforms/Windows/FFmpeg/include
copy *.lib to
CiosAudio/Platforms/Windows/FFmpeg/lib/x86
FFmpeg on Mac OS X
On Mac OS X, we suggest you compile them all into static linked.
To compile:
export ARENA=/usr/local
./configure \
--cc=clang \
--prefix=$ARENA \
--extra-cflags="-I$ARENA/include" \
--extra-ldflags="-L$ARENA/lib" \
--disable-shared \
--enable-static \
--enable-gpl \
--enable-nonfree \
--enable-version3 \
--disable-ssse3 \
--disable-programs \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-network \
--disable-sdl \
--disable-indev=qtkit \
--disable-indev=x11grab_xcb \
--enable-hardcoded-tables \
--enable-runtime-cpudetect \
--enable-pthreads \
--enable-postproc \
--enable-filters \
--enable-mdct \
--enable-rdft \
--enable-fft \
--enable-bzlib \
--enable-zlib \
--enable-libtwolame \
--enable-libmp3lame \
--enable-libgsm \
--enable-libwavpack \
--enable-libvorbis \
--enable-libfaac
make
sudo make install
|
Because the environment on each machine are different,
if you short of some libraries when you compile an application,
normally it generates a lot of error messages.
You will have to find out by yourself,
in most cases, asking for help on someone else does not help much.
The libraries need to link with the following libraries:
- CaCore
- avcodec
- avdevice
- avfilter
- avformat
- avutil
- swresample
- swscale
- postproc
- iconv
- z
- bz2
- pthread
- twolame
- mp3lame
- gsm
- wavpack
- ogg
- vorbis
- vorbisenc
- vorbisfile
- faac
Frameworks:
- CoreAudio
- CoreServices
- AudioUnit
- AudioToolBox
- CoreFoundation
- CoreVideo
- VideoDecodeAcceleration
- Accelerate
Two LAME
Official Two LAME site :
http://www.twolame.org
To compile:
./configure --disable-shared --enable-static --prefix=/usr/local
make
sudo make install
|
LAME
Official LAME site :
http://lame.sourceforge.net
To compile:
./configure --disable-shared --enable-static --prefix=/usr/local
make
sudo make install
|
GSM
Official GSM site :
http://libgsm.sourcearchive.com
To compile:
make
sudo cp -f inc/gsm.h /usr/local/include
sudo cp -f lib/libgsm.a /usr/local/lib
|
Wav Pack
Official Wav Pack site :
http://www.wavpack.com
To compile:
./configure --disable-shared --enable-static --prefix=/usr/local
make
sudo make install
|
ogg
Official ogg site :
http://xiph.org/ogg
To compile:
./configure --disable-shared --enable-static --prefix=/usr/local
make
sudo make install
|
vorbis
Official vorbis site :
http://xiph.org/vorbis
To compile:
./configure --disable-shared --enable-static --prefix=/usr/local
make
sudo make install
|
FAAC
Official FAAC site :
http://www.audiocoding.com/faac.html
To compile:
./configure --disable-shared --enable-static --prefix=/usr/local
make
sudo make install
|
FFmpeg on Linux
Debian
Not ready.
Fedora
Not ready.
Ubuntu
Ubuntu 14.10
sudo apt-get remove ffmpeg
sudo apt-get update
sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libvpx-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev libx264-dev
cd
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion "4:SVN-r`LANG=C svn info | grep Revision | awk '{ print $NF }'`" --backup=no --deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay
|
Arch Linux
Not ready.
FFmpeg on FreeBSD
Not ready.
FFmpeg on Solaris
Not ready.
FFmpeg on iPhone OS
Not ready.
FFmpeg on Android
Before you compile Android platform, you will need to establish a basic environment.
Please refer to
Compilation for Android.
Two LAME
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export TWOLAMEVER=0.3.13
tar xvf $DEPOT/twolame-$TWOLAMEVER.tar.gz
cd twolame-$TWOLAMEVER
echo "Compile Two LAME $TWOLAMEVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
./configure \
--host=arm-linux \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo make install
|
LAME
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export LAMEVER=3.99.5
tar xvf $DEPOT/lame-$LAMEVER.tar.gz
cd lame-$LAMEVER
echo "Compile LAME $LAMEVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
./configure \
--host=arm-linux \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo make install
|
GSM
We use a modified version of GSM for Android.
The place to download is
GSM 1.0.13 For Android, original version download place is
GSM 1.0.13.
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export GSMVER=1.0.13
tar xvf $DEPOT/libgsm_$GSMVER.android.tar.gz
cd gsm-1.0-pl13
echo "Compile GSM $GSMVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
export GSM_INSTALL_ROOT=$ARENA
make
sudo cp -f inc/gsm.h $ARENA/include
sudo cp -f lib/libgsm.a $ARENA/lib
echo "Done"
|
iconv
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export ICONVVER=1.14
tar xvf $DEPOT/libiconv-$ICONVVER.tar.gz
cd libiconv-$ICONVVER
echo "Compile iconv $ICONVVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
export ACC=arm-linux
./configure \
--host=$ACC \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo cp -f include/iconv.h $ARENA/include
sudo cp -f lib/.libs/libiconv.a $ARENA/lib
sudo make install
|
Wav Pack
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export WAVPACKVER=4.70.0
tar xvf $DEPOT/wavpack-$WAVPACKVER.tar.bz2
cd wavpack-$WAVPACKVER
echo "Compile Wav Pack $WAVPACKVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
export CFLAGS="-I$ARENA/include"
export LDFLAGS="-L$ARENA/lib"
export ACC=arm-linux
./configure \
--host=$ACC \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo make install
|
ogg
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export OGGVER=1.3.1
tar xvf $DEPOT/libogg-$OGGVER.tar.gz
cd libogg-$OGGVER
echo "Compile OGG $TWOLAMEVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
export ACC=arm-linux
./configure \
--host=$ACC \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo make install
|
vorbis
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export VORBISVER=1.3.4
tar xvf $DEPOT/libvorbis-$VORBISVER.tar.gz
cd libvorbis-$VORBISVER
echo "Compile Vorbis $VORBISVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
export CFLAGS="-I$ARENA/include"
export LDFLAGS="-L$ARENA/lib"
export ACC=arm-linux
./configure \
--host=$ACC \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo make install
|
FAAC
Compilation:
#!/bin/sh
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export FAACVER=1.28
tar xvf $DEPOT/faac-$FAACVER.tar.gz
cd faac-$FAACVER
echo "Compile FAAC $FAACVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
export ACC=arm-linux
./configure \
--host=$ACC \
--disable-shared \
--enable-static \
--with-sysroot=$SYSROOT \
--prefix=$ARENA
make
sudo make install
|
FFmpeg
Compilation:
#!/bin/sh
# one step compilation for android armv7
export DEPOT=/CIOS/Qt/Android/Depot
export ARENA=/CIOS/Android/Arena
export SROOT=/CIOS/Qt/Android/Scripts/armv7
export BUILD=/home/Linkers/Android
cd $BUILD
export FFMPEGVER=2.5
tar xvf $DEPOT/ffmpeg-$FFMPEGVER.tar.bz2
cd ffmpeg-$FFMPEGVER
echo "Compile FFmpeg $FFMPEGVER"
export CC="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-gcc --sysroot=$ANDROID_SYS_ROOT/sysroot"
export CXX="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-g++ --sysroot=$ANDROID_SYS_ROOT/sysroot"
export AR="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ar"
export LD="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ld"
export NM="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-nm"
export RANLIB="$ANDROID_SYS_ROOT/bin/arm-linux-androideabi-ranlib"
export SYSROOT="$ANDROID_SYS_ROOT/sysroot"
export PATH="$ANDROID_SYS_ROOT/bin":$PATH
./configure \
--target-os=linux \
--prefix=$ARENA \
--sysinclude=$SYSROOT/usr/include \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=arm-linux-androideabi-gcc \
--cross-prefix=arm-linux-androideabi- \
--nm=$NM \
--ranlib=$RANLIB \
--sysroot=$SYSROOT \
--extra-cflags=" -O3 -Wall -mthumb -pipe -fpic -DANDROID -DNDEBUG -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -Wa,--noexecstack -fasm -Wno-psabi -fno-short-enums -fstrict-aliasing -Werror=strict-aliasing -finline-limit=300 -ffast-math -fmodulo-sched -fmodulo-sched-allow-regmoves -mfloat-abi=softfp -mfpu=vfp -march=armv7 -I$ARENA/include" \
--disable-shared \
--enable-static \
--extra-ldflags="-Wl,-rpath-link=$SYSROOT/usr/lib -L$SYSROOT/usr/lib -L$ARENA/lib -nostdlib -lc -lm -ldl -llog" \
--disable-everything \
--disable-symver \
--disable-doc \
--disable-ffplay \
--disable-ffmpeg \
--disable-ffprobe \
--disable-ffserver \
--disable-network \
--disable-iconv \
--enable-nonfree \
--enable-protocol=file \
--enable-libwavpack \
--enable-libtwolame \
--enable-libmp3lame \
--enable-libgsm \
--enable-libwavpack \
--enable-libfaac \
--enable-libvorbis \
--enable-zlib \
--enable-avformat \
--enable-avutil \
--enable-avcodec \
--enable-avfilter \
--enable-avdevice \
--enable-swresample \
--enable-swscale \
--enable-postproc \
--enable-demuxers \
--enable-muxers \
--enable-decoders \
--enable-encoders \
--enable-parsers \
--enable-asm
make
sudo make install
|