How can I get Vorbis libraries on Android? - android

OK, i've spent most of the day trying to do this, and I figure I've got to be missing something fairly obvious.
Vorbis files are apparently natively supported on the Android SDK. Is there any way to access these libraries as a developer.
Situation: I've got a project that uses the libvorbis and libogg libraries, to load an ogg file. The whole thing compiles and works fine on OSX, linux, iOS etc. and i was trying to port it to android.
Using the NDK to compile the project, i get the error:
fatal error: vorbis/codec.h: No such file or directory
compilation terminated.
(I assume it would carry on to say that it can't find vorbisfile.h)
Question 1: Can access the vorbis API in C on Android? Or indeed, is there any Vorbis API?
Without too much effort, i stumbled across Tremor and Tremolo - ARM vorbis libraries, but I can't find any information on how to get them to compile using the Android SDK.
Question 2: Can someone offer any help with this?
Let me know if i can provide any other information to help.

You might look at android/ffmpeg/x264 project as an example. x264 is not ogg/vorbis, but it is a clear example of linking ffmpeg with adjunct libs in android build and link scenario.
Note: this will take quite a bit of time to work thru.
If you understand the example of building with x264, then you should be able to swap in obb/vorbis libs in place of x264 and get it all to link on an android build.
This assumes you are good with the NDK and cross toolchains and with git projects and sub-modules (x264 , ogg, vorbis)

maybe you can use the vorbis-java-1.0.0-beta of Xiph.org, this is a java package, you can port it to Android.

Related

General questions about Android ndk

I've been working for a month with android ndk, so I am quite a newbie. Currently I am trying to integrate some code into a big project and have multiple problems both with NDK and gstreamer. Questions are stupid but I would be very grateful if someone helped me:
1) After I build and compile a project, do I still need all of those Android.mk files? Or can I just add .so libraries using System.loadlibrary("library")?
2) After I build my .so files, do I still need to declare all .a files as build-shared libraries and link them to the .so which needs them?
3) When I add native android support, do I need to create separate libsomename.so or choose the existing?
Maybe someone could also link me to the good article about building?
1)No, if its already compiled all you need is the so and loadLibrary call. However, if you want to update the library with your app its probably a good idea to keep them
2)No, once you have a .so file that's all you need
3)I'm not sure what you're asking there.

Mix two audio files using ffmpeg on android platform

I am trying to mix two sound files(1. a background music 2.a recording file or a mp3 file) into a single one in android platform.
I setup the Android NDK platform for my project and done with compiling the ffmpeg library and generated the required SO file, now i want to use the amerge function( http://ffmpeg.org/ffmpeg-filters.html#amerge )in android but i don't know how to implement this command in android,I am having not much idea on Android NDK level coding. So any help, any idea will be appreciated.
Note: If you require more info to answer or any doubt in understanding this question feel free to ask, i'll be happy to share more info.
If you are not familiar with FFMPEG, you can compile a binary 'ffmpeg' and use standard command line by Runtime.getRuntime().exec("...");

Running FFMPEG in Android [duplicate]

I am trying to compile ffmpeg for a android. I have found several posts on this theme but non of these seems to work. If tried to build ffmpeg like it is posted on [1]. Did anybody successfully compile ffmpeg using theses tutorial?
I am not sure how to realize step 4 to 5.
STEP4: Configuring ...
STEP5: cd to your NDK root dir, type make TARGET_ARCH=arm APP=ffmpeg-org
It seems to me that building an application like it is explained in the tutorial in step 5 need some previous steps. Unfortunately I have no app in the folder to make. I am using the current android ndk release 3 and checked out the actual ffmpeg releases from [3] and [4]. I am thankful for every advice.
[1] http://slworkthings.wordpress.com/
[2] http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android
[3] http://ffmpeg.org/download.html
After looking around the net. The only working solution I found is supplied by Bambuser which ported ffmpeg to use in their android application.
Code is here: http://bambuser.com/opensource
Basically you copy the .so files to your jni/lib directory, along with any .h files you might need, create a JNI wrapper through javah, and it works.
EDIT:
Since this post was written a few packaged ffmpeg projects for android surfaced, one of the easiest ones to compile and use is here: https://github.com/guardianproject/android-ffmpeg .
It takes the approach of statically compiling a binary (not a library) that is ran through shell command in run time. Search github for 'android ffmpeg' for forks and related projects.
Did not find a well packaged method based JNI implementation, though.
I found a guide on ffmpeg on android here:
http://rxwen.blogspot.com/2010/05/use-ffmpeg-to-setup-streaming-server-on.html
He explains in another post how he got to do native programming on android to install ffmpeg. Hope it helps.
I will provide a more updated list of sources which will explain how to build and, in some cases, even use FFMPEG on Android.
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
In NDK r3, when you use the make command, the NDK will simply use the name of the folder in the "apps" folder for the name of your project. This assumes that you have your FFmpeg source files and android.mk somewhere within NDK/apps/ffmpeg-org/jni/
In otherwords, ensure that your foldername is set to ffmpeg-org.
EDIT: You might find it worthwile to use NDK r4 which changes make to ndk-build. In this new NDK, you don't need to have your project set up in any particular way, as ndk-build simply searches your project for Android.mk files to tell it what to compile.

What's the difference between IMPORT-MODULE and PREBUILTS?

Currently I'm using ffmpeg to develop a media player on Android. I've compiled ffmpeg using ndk. And next I have to use the built module to code. So here comes the question: how to use the compiled ffmpeg?
Firstly I thought since I have to import the ffmpeg module, I have to read $(ndk)/docs/IMPORT-MODULE.html. But when it came to practice, things didn't work out.
After a time of struggling, I found there's docs called PREBUILTS.html, which was exactly what I want. So I built a new project, copy libffmpeg.so to $(newProject)/jni and write Android.mk step by step as the docs depicted. It hasn't worked fine yet, but I believe I've found the right way.
So here comes the question: What's the difference between IMPORT-MODULE and PREBUILTS? Does IMPORT-MODULE means that the imported module could work itself (could be distributed as binary), and PREBUILTS means it's only a dynamic library?

ffmpeg for a android (using tutorial: "ffmpeg and Android.mk")

I am trying to compile ffmpeg for a android. I have found several posts on this theme but non of these seems to work. If tried to build ffmpeg like it is posted on [1]. Did anybody successfully compile ffmpeg using theses tutorial?
I am not sure how to realize step 4 to 5.
STEP4: Configuring ...
STEP5: cd to your NDK root dir, type make TARGET_ARCH=arm APP=ffmpeg-org
It seems to me that building an application like it is explained in the tutorial in step 5 need some previous steps. Unfortunately I have no app in the folder to make. I am using the current android ndk release 3 and checked out the actual ffmpeg releases from [3] and [4]. I am thankful for every advice.
[1] http://slworkthings.wordpress.com/
[2] http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android
[3] http://ffmpeg.org/download.html
After looking around the net. The only working solution I found is supplied by Bambuser which ported ffmpeg to use in their android application.
Code is here: http://bambuser.com/opensource
Basically you copy the .so files to your jni/lib directory, along with any .h files you might need, create a JNI wrapper through javah, and it works.
EDIT:
Since this post was written a few packaged ffmpeg projects for android surfaced, one of the easiest ones to compile and use is here: https://github.com/guardianproject/android-ffmpeg .
It takes the approach of statically compiling a binary (not a library) that is ran through shell command in run time. Search github for 'android ffmpeg' for forks and related projects.
Did not find a well packaged method based JNI implementation, though.
I found a guide on ffmpeg on android here:
http://rxwen.blogspot.com/2010/05/use-ffmpeg-to-setup-streaming-server-on.html
He explains in another post how he got to do native programming on android to install ffmpeg. Hope it helps.
I will provide a more updated list of sources which will explain how to build and, in some cases, even use FFMPEG on Android.
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
In NDK r3, when you use the make command, the NDK will simply use the name of the folder in the "apps" folder for the name of your project. This assumes that you have your FFmpeg source files and android.mk somewhere within NDK/apps/ffmpeg-org/jni/
In otherwords, ensure that your foldername is set to ffmpeg-org.
EDIT: You might find it worthwile to use NDK r4 which changes make to ndk-build. In this new NDK, you don't need to have your project set up in any particular way, as ndk-build simply searches your project for Android.mk files to tell it what to compile.

Categories

Resources