How to install ffmpeg for android studio? - java

Hi I'm trying to do a project in video processing. I want to demux and mux the videos from an mp4 container. I did it with MediaMuxer and all but now whenever i search everyone is recommending ffmpeg will be much easier. So I want to try this library. But for the life of me I can't figure out how to use this library. I want to integrate it with my current android studio project written in java. Some examples are given on how to install it in linux and some and are android ndk. Can anyone please guide me how to use this library. How to use and everything. I have read almost all the tutorials and still i'm not clear. Please. Any help would be appreciated.

Finally i found the answer.
For those who are on the same boat and haven't figured it out,
First include this line into your build.grade module file:
implementation 'com.arthenica:mobile-ffmpeg-full:4.3.1'
Then import these methods:
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.FFprobe;
and after this, when you are trying to execute the codes, use the commands without 'ffmpeg' on them. Reply if you still have doubts.

Related

How to import only one package from google play services lib

like in the title :
I'm developing in eclipse an android application, and I don't want to import all the Libraries of google play services_lib.
Is there a way to import only one package that I need?, and is it legal to do like that?
(because I read that those libraries are not modifiable).
First thing please use Android studio.
Yes using these libraries individually is absolutely legal.
Here you can find them all. (Individual)

Eclipse Programs to Android Studio

Is there any way I can call .java files from eclipse to programs in android studio and have that code be run from android studio? I cannot have the code directly copied into android studio as it brings up multiple issues. So I am wondering if there is some way I can call the .java from Eclipse, get the result from the method within that Eclipse program, and pass that result to android studio.
Any help would be greatly appreciated!
Very simply, no you can't "just call" code from another IDE.
You could export the Eclipse code to a JAR, import as a library into Android Studio, then try to work around that, but that sounds like a lot of work.
In regards to your previous questions, plus your comment.
it was working in eclipse, but when I literally copy and paste that exact same code into android studio, I am getting network issues when I run it.
Android has a UI Thread that does not like to handle Network requests like your bare single-threaded Eclipse project.
You need a separate thread. Without any libraries, there is AsyncTask, and the Android documentation covers this.
Though, you may find OkHttp to be better documented, useful, and less confusing than AsyncTasks. Volley is another, though works fine, is not very well documented.
See more discussion at Comparison of Android networking libraries: OkHTTP, Retrofit, and Volley
No, This is not possible way to do. Android studio and eclipse are different Applications and you cannot pass the Result to each other.
You can import the project or copy the files for a new Project.

How to build and use ffmpeg within android

I am prototyping a fairly simple camera app to test out using MediaRecorder to create a custom camera activity with one snag, I want to set the aspect ratio of recorded videos to a 1x1. Through much research I have found that this is only possible by using a library like FFMPEG to crop each frame of the video to the size I desire.
I have read many tutorials and articles on different ways to build FFMPEG into Android, but most of them are either outdated and use older versions of both the Android NDK and FFMPEG, or more recent ones just do not work when followed. I tried following the popular http://www.roman10.net/how-to-build-ffmpeg-for-android/‎ and a few other similar ones that all lead to an error about a missing pkg-config file because FFMPEG is generally meant to be installed on linux or another OS apparently. I found some information about building FFMPEG in android by using a make-standalone-toolchain.sh file here http://software.intel.com/en-us/android/blogs/2013/12/06/building-ffmpeg-for-android-on-x86 and can't make heads or tails as to how to go about using this method.
This now leads into my question: What is the best/proven way currently to build and use FFMPEG within android applications? If the standalone toolchain method is the way to go, is there any material better than the one listed that is easier to follow? I would even be open to a reliable template application with the FFMPEG Libraries ready to go (if this is possible); although, I would much rather know how to build this into android for future use.
Thank you in advance for any advice or suggestions on this issue.
I have successfully build ffmpeg libraries using
https://code.google.com/p/dolphin-player/
You have to be on Ubuntu to build that.
This is the guide I liked the most: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
If you need more options, you can take a look at these, which are equally good:
https://github.com/guardianproject/android-ffmpeg
https://github.com/halfninja/android-ffmpeg-x264
https://vec.io/posts/how-to-build-ffmpeg-with-android-ndk
EDIT: I updated the first link with a more recent article (it uses NDK r9).

PushPlugin source issue in Android -- attempting PhoneGap push notifications

I'm trying to plug the PushPlugin plugin (http://goo.gl/xn8z4) in to my Android PhoneGap application.
I'm getting stuck at this point here http://goo.gl/b03fs. I'm 80-93% confident that I have the Java source in the right place.
Java's trying to import org.apache.cordova.example.R but can't seem to find it. I'm suspicious that as soon as it starts importing it, I'm golden.
I'm working with the Cordova 2.2 jar/classes.
Here's where I'm seeing the package import failure: http://goo.gl/U3VlI
This is where the code is trying to talk to the object from the package that's failing to load http://goo.gl/LJbLb
It feels like this is a simple solution, but again, my skull appears to be excessively thick this afternoon.
Thanks for taking a look.
Boy, how I wish I had attempted this earlier: the solution to this one was to update the Cordova(PhoneGap) library to v 2.3.
There's a bloody spot on my head and nearby wall that I hope this post can help someone else sidestep.

CaptureFromFile in OpenCV on Android in Java

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.

Categories