{"id":985,"date":"2023-03-12T00:19:33","date_gmt":"2023-03-11T16:19:33","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=985"},"modified":"2023-04-29T13:23:21","modified_gmt":"2023-04-29T05:23:21","slug":"android-ndk-ffmpeg-compilation-configuration","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/12\/android-ndk-ffmpeg-compilation-configuration\/","title":{"rendered":"Android NDK FFMpeg\u7f16\u8bd1\u914d\u7f6e"},"content":{"rendered":"<pre><code class=\"language-bash\">#!\/bin\/bash\n\n# Global Value\nexport ANDROID_NDK_HOME=\/data\/ndk\/android-ndk-r12b\nexport PLATFORM_VERSION=android-9\n\nfunction build_ffmpeg\n{\n    echo &quot;Start build FFmpeg $ARCH&quot;\n    .\/configure --target-os=linux \\\n    --prefix=$PREFIX \\\n    --arch=$ARCH \\\n    --enable-shared \\\n    --enable-gpl \\\n    --enable-version3 \\\n    --enable-nonfree \\\n    --enable-postproc \\\n    --disable-static \\\n    --disable-yasm \\\n    --disable-ffmpeg \\\n    --disable-ffplay \\\n    --disable-ffprobe \\\n    --disable-ffserver \\\n    --disable-doc \\\n    --enable-cross-compile \\\n    --cross-prefix=$CROSS_COMPILE \\\n    --sysroot=$PLATFORM \\\n    --extra-cflags=&quot;-fpic&quot;\n    make clean\n    make\n    make install\n\n    echo &quot;Build Finished $ARCH&quot;\n}\n\n# arm\nARCH=arm\nCPU=arm\nPREFIX=$(pwd)\/android\/$CPU\nTOOLCHAIN=$ANDROID_NDK_HOME\/toolchains\/arm-linux-androideabi-4.9\/prebuilt\/linux-x86_64\nCROSS_COMPILE=$TOOLCHAIN\/bin\/arm-linux-androideabi-\nPLATFORM=$ANDROID_NDK_HOME\/platforms\/$PLATFORM_VERSION\/arch-$ARCH\nbuild_ffmpeg\n\n# x86\nARCH=x86\nCPU=x86\nPREFIX=$(pwd)\/android\/$CPU\nTOOLCHAIN=$ANDROID_NDK_HOME\/toolchains\/x86-4.9\/prebuilt\/linux-x86_64\nCROSS_COMPILE=$TOOLCHAIN\/bin\/i686-linux-android-\nPLATFORM=$ANDROID_NDK_HOME\/platforms\/$PLATFORM_VERSION\/arch-$ARCH\nbuild_ffmpeg<\/code><\/pre>\n<p><!-- more --><\/p>\n<pre><code class=\"language-bash\">#!\/bin\/bash\nexport NDK=\/usr\/ndk\/android-ndk-r10e\nexport SYSROOT=$NDK\/platforms\/android-9\/arch-arm\/\nexport TOOLCHAIN=$NDK\/toolchains\/arm-linux-androideabi-4.8\/prebuilt\/linux-x86_64\nexport CPU=arm\nexport PREFIX=$(pwd)\/android\/$CPU\nexport ADDI_CFLAGS=&quot;-marm&quot;\n\n.\/configure --target-os=linux \\\n--prefix=$PREFIX --arch=arm \\\n--disable-doc \\\n--enable-shared \\\n--disable-static \\\n--disable-yasm \\\n--disable-symver \\\n--enable-gpl \\\n--disable-ffmpeg \\\n--disable-ffplay \\\n--disable-ffprobe \\\n--disable-ffserver \\\n--disable-doc \\\n--disable-symver \\\n--cross-prefix=$TOOLCHAIN\/bin\/arm-linux-androideabi- \\\n--enable-cross-compile \\\n--sysroot=$SYSROOT \\\n--extra-cflags=&quot;-Os -fpic $ADDI_CFLAGS&quot; \\\n--extra-ldflags=&quot;$ADDI_LDFLAGS&quot; \\\n$ADDITIONAL_CONFIGURE_FLAG\nmake clean\nmake\nmake install<\/code><\/pre>\n<pre><code class=\"language-bash\">#!\/bin\/bash\n\n#\u5168\u5c40\u53d8\u91cf\uff0c\u591a\u4e2ashell\u811a\u672c\u90fd\u53ef\u4ee5\u4f7f\u7528\nexport ANDROID_NDK_HOME=\/usr\/ndk\/android-ndk-r10e\nexport PLATFORM_VERSION=android-9\n\nfunction build_ffmpeg\n{\n    echo &quot;start build ffmpeg $ARCH&quot;\n    .\/configure --target-os=linux \\\n    --prefix=$PREFIX \\\n    --arch=$ARCH \\\n    --enable-shared \\\n    --disable-static \\\n    --disable-yasm \\\n    --disable-ffmpeg \\\n    --disable-ffplay \\\n    --disable-ffprobe \\\n    --disable-ffserver \\\n    --disable-doc \\\n    --enable-cross-compile \\\n    --cross-prefix=$CROSS_COMPILE \\\n    --sysroot=$PLATFORM \\\n    --extra-cflags=&quot;-fpic&quot;\n    make clean\n    make\n    make install\n\n    echo &quot;build finished $ARCH&quot;\n}\n\n#exec 1&gt;jason_build_stdout.txt\n#exec 2&gt;jason_build_stdout.txt\n#arm\nARCH=arm\nCPU=arm\nPREFIX=$(pwd)\/android\/$CPU\nTOOLCHAIN=$ANDROID_NDK_HOME\/toolchains\/arm-linux-androideabi-4.9\/prebuilt\/linux-x86_64\nCROSS_COMPILE=$TOOLCHAIN\/bin\/arm-linux-androideabi-\nPLATFORM=$ANDROID_NKD_HOME\/platforms\/$PLATFORM_VERSION\/arch-$ARCH\nbuild_ffmpeg\n\n#x86\nARCH=x86\nCPU=x86\nPREFIX=$(pwd)\/android\/$CPU\nTOOLCHAIN=$ANDROID_NDK_HOME\/toolchains\/x86-4.9\/prebuilt\/linux-x86_64\nCROSS_COMPILE=$TOOLCHAIN\/bin\/i686-linux-android-\nPLATFORM=$ANDROID_NKD_HOME\/platforms\/$PLATFORM_VERSION\/arch-$ARCH\nbuild_ffmpeg<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash # Global Value export ANDROID_NDK_HOME=\/dat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[271],"class_list":["post-985","post","type-post","status-publish","format-standard","hentry","category-android-ndk","tag-ffmpeg"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=985"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/985\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}