android - Windows 中的 Android 版 FFMPEG 无法成功编译

标签 android bash shell android-ndk ffmpeg

我正在尝试在 Windows 8.1 中为 android 编译 FFMPEG,但我在 build_android.sh 的第 32 行出现错误

./build_android.sh: 第 32 行:语法错误:文件意外结束

当我在cygwin中执行命令时

chmod +x build_android.sh

./build_android.sh

如果您知道在 Windows 中为 android 编译 ffmpeg 的步骤以及如何在 android 中使用 ffmpeg,请回复我。

我在引用 . http://www.packtpub.com/sites/default/files/downloads/Developing_Multimedia_Applications_with_NDK.pdf ,

https://trac.ffmpeg.org/wiki/CompilationGuide/Android

http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9

build_android.sh

#!/bin/bash
NDK=E:/android-ndk-r9d
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/windows
function build_one { ./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--disable-doc \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--enable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install }
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one

最佳答案

改变

make instal }

make install
}

make install; }

因为这样,您将 } 作为 make 的第二个参数,并且您的函数 build_one 没有关闭 }

编辑

你能试试这个吗?

NDK=E:/android-ndk-r9d
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/windows
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--disable-doc \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--enable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install

关于android - Windows 中的 Android 版 FFMPEG 无法成功编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25133216/

相关文章:

java - 'org.apache.http.HttpEntity' 已弃用。如何解决android studio中的这个错误?

Android 7.0 ble扫描无结果

linux - cp:找不到命令

bash - 如何创建带参数的 bash 别名?

android - 用 "hasTextColor"测试 Espresso

android - 有没有推荐的 android adt 模板?

c - 重定向已杀死的可执行文件的标准输出

linux - 在 linux shell 中运行 MongoDB 命令的错误替换

linux - shell脚本中的递归

javascript - Node.js 中的 execSync 无法正确运行 shell 命令