官方编译指南:https://trac.ffmpeg.org/wiki/CompilationGuide
【一】 window篇
#!/bin/bash
cd /home/osho-1989/Desktop/ffmpeg-3.3.4
make clean
export PREFIX=D:/build_ffmpeg
build_one(){
./configure --prefix=$PREFIX \
-–disable-debug \
-–disable-shared \
-–enable-shared \
-–enable-gpl \
-–enable-memalign-hack \
--enable-small \
--disable-ffprobe --disable-ffplay --disable-ffmpeg --disable-ffserver --disable-debug \
-–extra-cflags =-D:/thirdLib/include \
-–extra-ldflags =D:/thirdLib/lib
}
build_one
make
make install
cd ..
配置参考:http://blog.csdn.net/subfate/article/details/51501846
【2】Android篇
编译脚本:
编译前 最好sudo -s 或 sudo -i,然后执行脚本
#!/bin/bash
cd /home/osho-1989/Desktop/ffmpeg-3.3.4
make clean
export NDK=/home/osho-1989/Desktop/android-ndk-r9d
export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt
export PLATFORM=$NDK/platforms/android-8/arch-arm
export PREFIX=/home/osho-1989/Desktop/android_ffmpeg
build_one(){
./configure --target-os=linux --prefix=$PREFIX \
--enable-cross-compile \
--enable-runtime-cpudetect \
--enable-neon \
--enable-asm \
--enable-jni \
--enable-mediacodec \
--enable-decoder=h264_mediacodec \
--enable-hwaccel=h264_mediacodec \
--arch=arm \
--cc=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi- \
--disable-stripping \
--nm=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--enable-gpl --enable-static --disable-shared --enable-small \
--disable-ffprobe --disable-ffplay --disable-ffmpeg --disable-ffserver --disable-debug \
--extra-cflags="-fPIC -DANDROID -mfpu=neon -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a"
}
build_one
make
make install
$PREBUILT/linux-x86/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib -soname libffmpeg.so -shared -nostdlib -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libswresample/libswresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a libpostproc/libpostproc.a libavdevice/libavdevice.a -lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker $PREBUILT/linux-x86_64/lib/gcc/arm-linux-androideabi/4.8/libgcc.a
cd ..
【3】IOS篇