Use the compiled FFMPEG library in Android through JNI-use the FFMPEG library in Android (2)

Source: Internet
Author: User
Tags file copy

The overall call logic is:

1. Compile the FFMPEG Library

2. Use JNI to write C code, which must contain the corresponding FFMPEG header file

3. Write the corresponding Android. mk file, which specifies the C code to be compiled and the dynamic library to be linked.

4. Execute ndk-build to generate the corresponding JNI Library

5. Create the andorid Java program. The corresponding FFMPEG library of loadlibrary and the jni library just generated in the code

6. Declare native functions using static methods. These functions have been implemented in C language written by JNI.




The steps are as follows:

1 will be in the 32-bit Ubuntu
Libffmpeg compiled in 0.8.1 of the latest FFMPEG version for Android ndk R6 in 11.04. so file copy to/root/develop/android-ndk-r6/platforms/Android-8/arch-arm/usr/lib directory, if android2.3 is used, you also need to have a copy to the/root/develop/android-ndk-r6/platforms/Android-9/arch-arm/usr/lib directory.

2. Go to the samples directory of Android ndk R6 and modify it based on the simplest hello-JNI. Because we need to use the header file when calling the FFMPEG library method. Here we copy all the code from the previously compiled libffmpeg. So file to the/root/develop/android-ndk-r6/samples/directory and change the directory name to FFMPEG

3 modify hello-jni.c files

Help
12345678910111213141516171819202122232425262728293031323334353637

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.