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
Related
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!
I need to merge images to video as an overlay and export it. I have found ways to create video from images using javacv but didn't find any jar or library which do add images as an overlay to existing video, some of the links suggest to use FFMPEG and JNI to achieve this but sadly i don't have any knowledge of JNI. They use avfoundation framework in IOS to achieve the same.
The above image is replica of my requirements, if any one can guide me in right direction and provide me some useful stuff to start with would be appreciated.
What i have achieved so far is:
1) Compiled FFMPEG.
2) Generated .so files
3) Compiled and able to run Hello Jni project.
What i am searching for is:
1) Splitting video into frames.
2) Merging my overlay images with video frames
3) Recreating the video with audio.
and i know JNI is the only way to achieve this so searched a lot but didn't find any good JNI stuff to start with. I am not asking for the whole code but if some one can point me out with some good tutorial or blog would be great help.
Thanks!!
The way to accomplish this is like you said - incorporate a video codec and use it to re-compose the video.
Decode the original video
Draw your overlay over the original video frames
Encode the frames again.
Using FFMPEG with JNI is the obvious solution, but if you find any other codec library that can accomplish the same with pure Java, it will work too.
No knowledge of JNI? That's about time to learn it =)
References for learning:
NDK docs on your file system: http://developer.android.com/tools/sdk/ndk/index.html#Docs
JNI - http://192.9.162.55/docs/books/jni/html/jniTOC.html
FFMPEG for Android - there are many tutorials out there and many source trees that contain a ready build environment.
You can either follow them or just do it on your own - provided that you understand the NDK environment and can read makefiles.
This is an example: http://vec.io/posts/how-to-build-ffmpeg-with-android-ndk
Using FFMpeg to encode\decode frames - sadly, no good up-to-date tutorials here, there is the API documentation: http://ffmpeg.org/doxygen/trunk/index.html
Blending bitmaps - use Android's Canvas infrastructure, or just manually copy pixels over each other and blend according to alpha values.
Warning - this is a complex library to build and you'd better experiment with easier NDK projects before attempting this one.
Maybe I'm being a bit slow, but I can't find the equivalent of CaptureFromFile for grabbing video frames one by one from a file in OpenCV in Java on Android.
Can anyone put me out of my misery please and show me where to look?
Many thanks
Barry
OpenCV does not support video reading/writing on Android yet.
Take a look at solution in here. Also, it seems like Open CV is available thrue Android NDK, here you may find how to use it. In addition, you may take a look at Processing, which i believe supports Open CV and able to export code as apk.
I've been trying to use an ffmpeg binary with command line access for a while now and getting nowhere (Using runtime.exec)
It looks like the only way I'll be able to get it to work is using a wrapper in C to access the built ffmpeg libraries using JNI...
Main problem: I haven't coded C for more than one and a half decades now and wouldn't know where to begin...
I just need 3 operations, I need to add audio to a video file, I need to concatenate two video files and if possible I need to rotate a clip by 90 degrees (but I could do without this)...
Does anyone have any example code that could work for me, or some good places to start (I've already exhausted much of the first pages of various google results to no avail)...
Any help would be greatly appreciated!
There are many open source projects available, But for simplicity, You can start from here
I believe this is what you are looking for:
https://github.com/hoary/JavaAV
Multiple platforms supported so your code will be more portable.
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/