Swap-IOS-Android Swap-IOS-Android - 1 year ago 90
Android Question

How to reduce mp4 size by using FFMPEG lib into android

I am new to NDK so i read tutorial and i successfully build the FFMPEG lib than i copied it into my jni folder create Android.mk and Application.mk file and execute ndk-build command so now i got libavcodec.so into my lib folder..( i didnt copy ffmpeg header files into my jni folder .. is it necessary to add header file or should i add complete ffmpeg lib into jni... stack-overflow comments say that you just have to add header files)

I know that if i want to convert my camera video into small size than i have to compress it by using avcodac.so so i compile it but important this is How can i use that.

There is confusion in my mind to use that so file..
1) Should i need to use System.load("libavcodec.so") method to load So file IF yes after loading so files how can i access the native methods of C/C++?

2) Or should i need to create my java class and my c class which both communicate with each other and that c class communicate with avcodec class of ffmpeg??

Or should need to implement both and one more important thing IF i have to create my c class than in Android.mk i have to add it into source file line???

And please can anybody tell me what are the method and steps available to compress video file size in FFMPEG?

Any help is appreciated and this my question will also helpful to other fresher.
Thank you

Answer Source

1) Yes, you need to call System.load("libavcodec.so"). You can access the methods via JNI.

2) You need to create JNI methods which are implemented in C and call ffmpeg.

JNI tutorial for Android: http://code.google.com/p/awesomeguy/wiki/JNITutorial

ffmpeg tutorial: http://dranger.com/ffmpeg/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download