I want to make an Android app which can convert .OBJ files into .GLB files.
I've researched this a fair bit but I haven't yet found any library that I'm confident I can use in an Android app for .OBJ to .GLB conversion. I had initially thought that the Assimp library was going to be the best bet: http://cms.assimp.org/index.php. Having looked more closely, however .GLB seems only to be listed as an import format and not as an export format: https://github.com/assimp/assimp So that presumably that means I can use Assimp to convert from .GLB to another format but not into .GLB from another format.
I'd be most grateful for any suggestions on alternative strategies that might be worth investigating. There must surely be some solution to this, but I can't immediately see what it could be!
You can use the Assimp-lib build for your android version ( shall work for 4.1.0 with android-cmake as far as I know ). Then you can use the functionalities to import an obj-file and export it as an glb-file. To write files there you will need to use th android-filesystem.
A short explanation cqn be found in our wiki how to build assimp for android ( check this here ). Or you can try our special build script, which is located here.
If you are facing any issues just create an issue report.
Related
A third party created a unity project for me but they lost their project on their end. A guy had it on his laptop, never backed it up but he did send the integrated unity project for android. The only issue is that we need to change something inside it. So I have the android project, I just need the built unity's source code.
The same situation occurred with our IOS version, luckily Xcode had the Assembly-Csharp accessible and I could find the value I needed to change. The Android's Unity was built with il2cpp. I've managed to re-secure the assets using some tools I've found online. So I can potentially rebuild the project with new scripts. However this may take a rather large amount of time. So I found I can edit the source code through the hex code, but this seems limited/nigh impossible as I need to make a condition on this string instead of simply setting the value. If there is a way to do this with a hex editor on the lib2cpp.so file I would greatly appreciate even a lead. Alternatively I have found some things on hooking a string, but I am unsure of how to go about this and cannot find sources of where to start such a thing.
Any leads or information on how to edit a string on a condition in the unity source code through it's lib2cpp.so file or libunity.so file would be greatly appreciated!
I have a video(.mp4) file in my SDCard,I want to reduce a size of .mp4 file and upload this file to a server.
One way you can do this is to use ffmpeg.
There are several ways of using ffmpeg in an Android program:
use the native libraries directly from c using JNI
use a library which provides a wrapper around the 'ffmpeg' cmd line utility (also uses JNI in the wrapper library)
call ffmpeg cmd line via 'exec' from within you Android app
Of the three, I personally have used the wrapper approach in the past and found it worked well. IMHO, the documentation and examples available with the native libraries represented quite a steep learning curve.
Note, if you do use 'exec' there are some things it is worth being aware of - see bottom of this answer: https://stackoverflow.com/a/25002844/334402.
The wrapper does have limitations - at heart, the ffmpeg cmd line tool is not intended to be used this way and you have to keep that in mind, but it does work. There is an example project available on github which seems to have a reasonable user base - I did not use it myself but I did refer to it and found it useful, especially for an issue you will find if you need to call your ffmpeg wrapper more than once from the same activity or task:
https://github.com/jhotovy/android-ffmpeg
See this answer (and the questions and answers it is part if) for some more specifics on the 'calling ffmpeg two times' solution:
https://stackoverflow.com/a/28752190/334402
I would like to use the facedetection in opencv cpp to use it in an android app. I have compiled jni successfully. But I wonder how would i use the haarcascades. I can store in sdcard and read it from there. Is there any other way i can use the xml files directly from the project?
There is a c++ example called facedetect coming with the opencv superpack. I'm running OpenCV-2.3.1 myself and it's located in this folder: ../opencv-2.3.1/samples/c/
The sample uses haarcascades and this might be your best bet for facedetection. If you can use the Android NDK with proper JNI calls from a .cpp file then you shouldn't have any problems to use this sample.
I'm working on a similar thing myself but haven't tried it myself yet. Should be implementing the thing somewhere next week but can't guarantee it. Let me know if this works out for you
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.
I am looking into Renderscript capabilities and stuck with the A3D (Android 3d) file format. I can't find an easy way to convert a Collada file into an A3D format to store my blender model.
I was wondering if you guys have an idea I could try maybe?
Does anyone have a working code sample so that is can see what im doing wrong?
More info: http://developer.android.com/reference/android/renderscript/FileA3D.html
Edit: Not to be mistaken for the Asci3d file extention ( also *.a3d )
As of Ice Cream Sandwich (perhaps earlier) there is a tool in the Android source to convert between Collada and A3D.
The tool is called a3dconvert; you can browse the source online here (in the ICS branch): https://github.com/android/platform_development/tree/ics-mr1-release/tools/a3dconvert
Usage:
a3dconvert input_file a3d_output_file
Currently .obj and .dae (collada) input files are accepted.
This tool has been removed as of newer releases (Jelly Bean, it looks like). This probably because the graphics portion of Renderscript has been deprecated.
I'm not sure A3D is a good format but if you have to write a converter here is a description of both formats:
http://scorpion.tordivel.no/help/UsersGuide/General/ImageOperations/ImageFormats/ImageFormats_a3d.htm
http://en.wikipedia.org/wiki/COLLADA
And here is some sample code to read Collada:
http://sourceforge.net/projects/colladaloader/
If you're going from Blender to A3D, I would consider writing a Python script to go directly to A3D format from Blender. The A3D format seems rather simplistic and if you're only accessing the Mesh data, the Blender API isn't too hard to follow. Of course if you don't already know it, you'll have to pick up some Python syntax.
I knew nothing of Python when I first wanted to pull some information from Blender myself, and looking at existing .py scripts (like the OBJ export), the Blender API and learning some basic Python syntax I was able to write my first (rather simple) script in just a few hours or so.
http://colladablender.illusoft.com/cms/ is a project making a plugin for Blender to read Collada directly.
Also, Carrara could be used to convert your files to something Blender supports.