Import FFMPEG Library to Android - android

First, I'm new in this Import thing
I've compiled latest version of ffmpeg with NDK r14b,
and managed to get some Library after compiling(like libavutil.so,libavcodec.so,libavfilter.so,etc)
Click here for pic
but im a bit confused importing it to my android project.
First, I want to make an Audio editing app that can merge several mp3 file at specific time, and adjust volume (Increase or Decrease its sound) mp3 file.
I've read about ffmpeg recently, since most people recommended to use this Library.
For merging :
-https://superuser.com/questions/1092291/merge-many-audio-files-with-specific-positions/1092346#1092346
For adjust volume :
-Decode MP3, then increase the audio volume, and then encode the new audio
What i want to ask is:
-from guardian's ffmpeg project and WritingMinds ffmpeg lib (can't post the link since i got not enough rep and this 2 are often mentioned in stackoverflow), does this 2 Libraries have what i needed? I'm a bit confused in this thing. An explanation would be a help.
-from http://ffmpeg-android.blogspot.co.id/ i cant run the ndk-build command at the last part. How should i use it?
Thank you in advance!

Related

JavaCv and FFMpeg

I was given a task to merge an Image and Audio to make a video file out of them in android. I successfully finished the task by using javacv ffmpeg but after so much of compression my app size is still around 15mb. After analysing the apk, I've found that libavcodec.so is occupying 64% of the size. Since my app relies on that, I can't exclude the file.
So my question is "Is it feasible to complete this task with very less apk size? Like around < 5Mb?"
Yes you can. If you really want to use javacv than you can remove unnecessary parts from the sources and recompile them. More info in JavaCPP repo
As the easiest solluton of this problem you can just remove some unused .so files.
Finally, ffmpeg is not necessary here and you can find another solution. For example you can use an online service (I've found transloadit and it is free for small apps) or write your own native or java code. It is not easy but possible

How to read an AVI file in OpenCV for Android

I need to read an AVI file in Android and process its frames. I know its C++ way but not the android one! Can someone help me and give a start point. I'm using opencv 2.4.5.
You can try to compile OpenCV with FFMPEG for Android.
Video IO is not officially supported but if I remember correctly this patch worked: http://code.opencv.org/issues/2546 At least you can use it as a good starting point.
You can use javacv, it has ffmpeg and opencv wrappers with examples.
I don't think that it is implemented yet (at least it wasn't six months ago). You might want to split you video into frames and open those frames instead of the video file (have a look at this thread).
i'm not sure if it's useful , but take a look at this:
http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Macintosh-API11.pdf

Need encoding from images to video on Android

We need an Android app that can encode a folder of images to a video. I have been looking for solutions a while now, but cannot find anything good. The Android API does not support it. We are trying ffmpeg, but cannot get it to work. We need a working solution, using ffmpeg is not mandatory. A full Android Java solution is also a possibility, since this would work on all Android devices, possibly at the cost of some performance.
The app also needs to be able to add an audio track to the movie if the user chooses to do this.
Any help would be appreciated.
Kind regards,
AƤron
From the FFmpeg FAQ entry "How do I encode single pictures into movies?":
First, rename your pictures to follow a numerical sequence. For example, img1.jpg, img2.jpg, img3.jpg,... Then you may run:
ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
Adding an audio track should just involve add another input (e.g., -i audio.mp3), but could also require explicit -maping with older versions.

How do I actually use ffmpeg on Android?

I have a very basic question regarding Android and ffmpeg. I obtained ffmpeg from http://bambuser.com/opensource and was able to compile it for ARM.
The results are the binaries (ffmpeg) as well as several libsomething.so files.
My question is: Is this enough to decode videos? How do I actually use ffmpeg then?
To load the library I have:
static {
System.load("/data/data/com.package/lib/libavcodec.so");
}
It loads fine. But what then?
More explanation: I saw other projects where people had their ffmpeg source in a JNI directory in the project. They also created some Android.mk files and some C code along with it. Would I need this as well? Why would I create the .so files first and then copy the ffmpeg source code again?
I know the NDK and how it should work but I've never seen an example of how one would actually call ffmpeg functions using it, because people seem to be hiding their implementations (which is sort of understandable) but not even giving useful pointers or examples.
Let's just say I wanted to decode a video file. Which kind of native methods would I need to implement? How do I run the project? Which data types need to be passed? etc. There are certainly a few people here who have at least done that, I know this from searching for hours and hours.
For your first question;
Just building is not enough for the proper use of the ffmpeg libraries. You should also wrap those so files in the right order because these so files NEED other libraries in the link time. You can display header information of the so file, by using.
objdump -x libavcodec.so | grep NEEDED
So you need to wrap these so files through Android.mk. You may check this link.
The second one;
You only need the header files from the ffmpeg project. The implementation will linked from the so libraries. Thats perhaps because, developers didn't bother to filter header files.
And the last one;
your thoughts seems right for the time being, most of the current developers are struggling to use ffmpeg but they lack of documentation and sample codes.

How to make an Android app that can edit MP3 files?

I want to make an app that downloads a specific MP3 file, allow the user to crop/trim it and re-upload it back to our server. How can I trim MP3 files inside my app ? Do I need to achieve this in C and then port it/use NDK ? If MP3 is tough, I can switch over to other easy formats too.
Will be great if anyone can show me the right path.
I think of all the alternatives, using something like LAME and compiling for the NDK is your best option. Be warned that there are patent restrictions on the MP3 format (most of which I don't understand), and you may run into problems if you distribute your app. YMMV
I didn't test it on Android yet, but there is a pure Java MP3 decoder / player I wrote a while ago. Maybe you can use parts of it. The code is based on JLayer from JavaZoom (also LGPL).
This library helps to trim MP3,AAC/MP4,WAV,3GPP/AMR...
http://code.google.com/p/ringdroid/

Categories

Resources