Compile librtmp for Android and librtmpandroid
Librtmp is a powerful open-source rtmp library. A recent Android project involves technologies such as rtmp. It was used before when ffmepg was used, at that time, it was just as a module that compiled librtmp into ffmpeg as a third-party library (ffmpeg itself also supports rtmp ).
Preparations for porting librtmp to Android:
1. Prepare the NDK and configure the environment variables.
2. Of course, the installation package of librtmp is ready.
git clone git://git.ffmpeg.org/rtmpdump
The next step is to propose some ndk compilation tools, which are suitable for compiling environments on the android platform, such as arm-linux-androideabi-gcc.
/home/android-ndk-r10e/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.8 --platform=android-14 --install-dir=/home/lide/work/lide/lide
Set Environment Variables
vim /etc/profileexport PATH=/home/lide/work/lide/lide/bin:$PATH
source /etc/profile
Download polarssl-1.2.14 (mbed TLS (formerly known as PolarSSL) is best to download this version, otherwise the following will report an error when compiling librtmp. Https://tls.mbed.org/bottom right has Latest updates has this version
Before compilation#define POLARSSL_HAVEGE_COtherwise, it will appear during librtmp compilation.undefined reference toHavege_random ''error, because polarssl disables the havege module by default.
make CC=arm-linux-androideabi-gcc APPS=make install DESTDIR=/home/lide/work/lide/lide/sysroot
Compile (librtmp is a dynamic library)
make SYS=android CROSS_COMPILE=arm-linux-androideabi- INC="-I/home/lide/work/lide/lide/sysroot/include" CRYPTO=POLARSSL
To use the static library of librtmp, use
make SYS=android CROSS_COMPILE=arm-linux-androideabi- INC="-I/home/lide/work/lide/lide/sysroot/include" CRYPTO=POLARSSL SHARED=
Now, you have obtained the library of librtmp for android, and you can use it for development in android. In the next section, we will first introduce the use of android jni to start a journey to android C ~~~~
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.