ffmpeg在android平台上的移植

來源:互聯網
上載者:User


1:
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
git checkout 5e99df019a850e9ffa96d73e72b8a47a93a61de8

2:
export ANDROID_NDK=/home/shilingkai/android_app_dev/android-ndk-r9
export TOOLCHAIN=/tmp/ffmpeg
export SYSROOT=$TOOLCHAIN/sysroot/
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir=$TOOLCHAIN

3:
export PATH=$TOOLCHAIN/bin:$PATH
export CC=arm-linux-androideabi-gcc
export LD=arm-linux-androideabi-ld
export AR=arm-linux-androideabi-ar

CFLAGS=-O3 -Wall -mthumb -pipe -fpic -fasm
-finline-limit=300 -ffast-math
-fstrict-aliasing -Werror=strict-aliasing
-fmodulo-sched -fmodulo-sched-allow-regmoves
-Wno-psabi -Wa,--noexecstack
-D__ARM_ARCH_5__ -D__ARM_ARCH_5E__
-D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__
-DANDROID -DNDEBUG

EXTRA_CFLAGS=-march=armv7-a -mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad
EXTRA_LDFLAGS=-Wl,--fix-cortex-a8

FFMPEG_FLAGS=--prefix=/tmp/ffmpeg/build
--target-os=linux
--arch=arm
--enable-cross-compile
--cross-prefix=arm-linux-androideabi-
--enable-shared
--disable-symver
--disable-doc
--disable-ffplay
--disable-ffmpeg
--disable-ffprobe
--disable-ffserver
--disable-avdevice
--disable-avfilter
--disable-encoders
--disable-muxers
--disable-filters
--disable-devices
--disable-everything
--enable-protocols
--enable-parsers
--enable-demuxers
--disable-demuxer=sbg
--enable-decoders
--enable-bsfs
--enable-network
--enable-swscale
--enable-asm
--enable-version3

./configure $FFMPEG_FLAGS --extra-cflags=$CFLAGS $EXTRA_CFLAGS --extra-ldflags=$EXTRA_LDFLAGS

make clean
make -j4
make install

rm libavcodec/inverse.o
$CC -lm -lz -shared --sysroot=$SYSROOT -Wl,--no-undefined -Wl,-z,noexecstack $EXTRA_LDFLAGS libavutil/*.o libavutil/arm/*.o libavcodec/*.o libavcodec/arm/*.o libavformat/*.o libswresample/*.o libswscale/*.o -o libffmpeg.so

arm-linux-androideabi-strip --strip-unneeded libffmpeg.so

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.