Android NDK编译FFmpeg with Openssl

首先在下载这个github项目

https://github.com/davinctor/CompileFFmpegWithOpenSSL

前提:一定要单独编译成功ffmpeg和openssl否则很多问题无法得到有效解决。

不要使用build.sh,有很多问题。

先编译openssl,注意,最后openssl不会复制到对应目录,因为提示找不到文件。需要自己将libssl复制到最后规定的目录里。

改一下build_one

elif [ $TARGET == "arm64" ]
then
    ./Configure no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine android64-aarch64 --openssldir=$INSTALL_DIR --prefix=$INSTALL_DIR
elif [ $TARGET == "x86_64" ]
then
    ./Configure no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine android64 --openssldir=$INSTALL_DIR --prefix=$INSTALL_DIR
elif [ $TARGET == "x86" ]
then
	./Configure no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine android-x86 --openssldir=$INSTALL_DIR --prefix=$INSTALL_DIR

接着在build_ffmpeg里面,如果你编译的是最新版本的openssl,在ffmpeg的./configure中将找“SSL_library_init”改成“OPENSSL_init_ssl”。

加上prefix的选项。

--enable-gpl
--enable-nonfree
--enable-postpro

如果你编译的是最新的ffmpeg,在x86_64平台,部分定义是重复定义的,需要在./config中改成1才行。

你可能感兴趣的:(Android,NDK)