How to add ffmpeg to my android project and use them? - android

I am developing an Android project/app for video compression and that's how I came to know about ffmpeg. I'm using Ubuntu 11.04 OS and Eclipse IDE(ADT-bundle).
I came across many topics dealing with ffmpeg at StackOverflow but i can't clearly figure out where I can get the ffmpeg jar file and how to add it and use in my project.
Any advice from you will be of great help.
If ffmpeg is so tough to handle for a beginner in Android like me, then is there any other way to compress a video in android?

If you're targetting Android 15 or greater version, try MediaCodec class.
May be this helps You.It's java porting of ffmpeg. Though it uses JNI internally,it provides java functions that hides the mess!!

Related

How to include/use latest version of Opus codec in Android NDK

A complete novice question here. I am pretty familiar with programming in C/C++ on Linux environments. However, I have no experience whatsoever with Android environment, let alone when it comes to making an application with C for Android platforms.
I need to use opus codec in my application but it is not present in the default libraries of Android NDK. How can I add it?
Some sources on internet talk about Android.mk files. I am using the most recent version of Android Studio and there is no .mk files, only Cmake files.
According to this, it's as easy as
implementation "com.vcpkg.ndk.support:opus:1.3.1"
There are tons of tutorials and examples of how to integrate native code in an Android app. Generally this requires a Java (or Kotlin) wrapper and some JNI code on the C side. Consider also consuming the opus codec via ffmpeg (e.g. mobile-ffmpeg library).

Using OpenCV4Android or running openCV Python-based code?

I'm developing an Android app and I have to use the openCV library.
I was wondering if the openCV python sdk is equivalent to the openCV4Android? I already have some openCV code written in Python - everything that can be done using Python can also be accomplished with Java for Android?
Thanks.
Although I used OpenCV Java SDK for both Android and Java projects, I am not sure whether it supports all functionalities of python library. You can check which parts of the library is included in Java SDK from the documentation
If something is included but not have detailed description, you can check out c++/python equivalent for explanations.
OpenCVForAndroid usually only has the modules in the OpenCVMain repository:
https://github.com/opencv/opencv
If you want more than this, for example the OpenCV extra modules below, then you generally have to build from source. OpenCV extra modules
https://github.com/opencv/opencv_contrib
It is worth noting also that at the time of writing most of the official openCV Android documentation is based on using the Eclipse IDE, while most official Android documentation uses the newer Android Studio.
There are also two main ways to use OpenCV on Android - one is to use the Java SDK as you have noted and the other is to build your OpenCV functionality in c++ using the Android native NDE. The former is generally easier if the Java SDK covers the functionality you need.
I think it is fair to say that getting the latest release of OpenCV with the extra modules compiled and working with Android Studio is not trivial at this time - if you look on Stackoverflow you will see quite a few questions and discussions around this topic, for example look at this question and answers:
Reg. Adding OpenCV to Native C code through CMake on Android Studio
I'm planning to take a photo using the smartphone camera, then make some image processing. In case the Java SDK does not cover the functionality I need, a solution could also be sending the image to a remote server, do the processing (using Python) and send the processed image back to the application. Am I missing something? (of course I increase latency)

Can't use ffmpeg 3.2 in Android project

Tried almost everything, spent almost 4-5 days trying and still counting.
The reason I want to compile recent version of ffmpeg is because https://github.com/WritingMinds/ffmpeg-android-java doesn't work for video rotation. For this also I tried multiple answers, different versions of answer (transpose=1, transpose=dir=cclock, etc)
Somewhere it was mentioned that rotate command wont work with previous versions of ffmpeg, so after a lot of trials, I started working on compilation of new ffmpeg. But all the tutorials for ffmpeg belong to earlier versions (of Android NDk, ffmpeg) which wont work with ffmpeg 3.2 and NDK r13b (I also tried with NDK downloaded by studio itself but no luck). In case it worked for you, please help.
After a lot of frustrating experience I am writing this. Please help with a workflow or a clear direction. Thanks
Wasnt able to tag ffmpeg3.2 because of reputation.

How to use latest FFMPEG in Android Studio project?

I have a simple task to make a video from multiple images and an audio file, After searching a lot found that its possible with FFMPEG, Unfortunately there are no updated tutorials for FFMPEG, there are few but outdated and most of them are not working.
As I have compiled FFMPEG for Android using NDK android-ndk-r10e and ffmpeg-2.8.6 on my MAC with Android Studio following the tutorial http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
It makes the .so files as
Now I can't understand what should I do to integrate this in my Android project, I have also checked,
How to use Ffmpeg in android studio?
how to use ffmpeg in android?
FFmpeg on Android
and mainly this,
http://www.roman10.net/how-to-build-android-applications-based-on-ffmpeg-by-an-example/
https://github.com/roman10/android-ffmpeg-tutorial
But its not working and having errors with no way to resolve this. Can anyone please mention some steps that should be followed to use FFMPEG .so files as in image attached.
There's a very easy solution for this, There's a precompiled library for android, as below https://github.com/WritingMinds/ffmpeg-android-java
Simply include this as a gradle project in your code and add few methods as per their documentation and you are done with FFMPEG commands in android.
This library is not very updated and have some missing features but still its good to use for many simple tasks.

How do I build ffmpeg including x264 library for android?

Lots of question and answer available on the ffmpeg and android. But I did not get thing that directly address ffmpeg building with x264 library.
Actually I want to make a movie from some still images in android.
Still do not get any solution to resolve this problem. Some of the forum told that it can be do using ffmpeg. If I build ffmpeg after downloading from "http://bambuser.com/opensource", it works fine to decode a video file. But it does not get any codec while it try to encode still image into movie.
That's why I try to use x264 as encoding library with ffmpeg. While I try to build it with ffmpeg it returns error.
Could you please provide any detail step by step guide line to build ffmpeg with x264 library in windows or mac for android?
If any one knows anything other that can be used to make movie from still images in android please tell me the way. Your help will be highly appreciated.
Thank you in advance for your kind response.
I made a tutorial on how to build ffmpeg and x264 for android:
http://db.tt/TjMqIF3u
You can also download the zip file containing the files you need to make an application on android and also an executable of lastest ffmpeg to run on android.
PS: you might need Cygwin to compile ffmpeg in Windows.

Categories

Resources