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
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/
JavaCV comes with Java wrappers and precompiled binaries for FFmpeg.
Moreover, the RecordActivity.java sample seems to do exactly what you are looking for!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With