Tuesday, November 8, 2011

GStreamer on Android, The NDK way


Long story short; thanks to my employer, Collabora, I have been working on getting GStreamer built and installed as a native support library under Android using the NDK. We had this working and announced for last GSTConf at Prague but there were a few details to iron out to get our work in shape for external testing.

The idea behind this adventure is showing the world you can benefit from this marvelous, swissknife-like media framework under the green droid's platform utilizing a least intrusive path.
We worked a few months ago on having GStreamer built as part of Android itself and while I do believe that approach should benefit system integrators rolling out their own customized Android version, it has the drawback of requiring both patching and building the entire Android OS and having administrative (root) access to your device. This is arguably not a problem for the most adventurous among you but we figured out providing a way to benefit from all the goods in GStreamer without forcing you to perform any major hacks was worth trying. So we did.

To be really honest, most of this work wouldn't have been possible (or at least really, like _REALLY_ harder) without the help of Collabora's own Derek Foreman's Androgenizer. You will need this tool if you want to try building our NDK bundle. And if you are working on porting some other complex project to Android; You need it too! so go check it out.

Right now you can get instructions on how to build GStreamer using the NDK and install it on your device at our freedesktop wikipage. Here is a quick run down of what is currently workig:

  • Building most of gstreamer, -base, -good, -bad, -ugly & -openmax. The first 5 entirely from upstream!
  • Building of our set of support libraries for this bundle (glib, x264, ogg, libmad, faad, libid3tag)
  • Building gstaudioflingersink from gst-android. We are still working on gstsurfaceflingersink to adapt it to some late API changes in Gingerbread
  • APK generation and Installation. Mind you this is not a real Android GUI application, just the set of GStreamer libraries and executables for you to build upon
  • Execution of gst- binaries on the device using run-as

Suported Android versions:

  • Gingerbread and Honeycomb

Test devices:

  • Samsung Galaxy Tab 10.1
  • Google Nexus S

This is still a work in progress but as I trust the community to be a great vehicle for driving innovation forward and have the luxury of working for a Company that supports this very same principle, I decided to have this aired so I can benefit from both your testing and feedback.

If you give this process a try and feel like supporting our work, please consider subscribing to our mailing list and sharing your experience!

8 comments:

Sarav said...

Great Job Reynaldo. Without your support, I wouldn't have been able to integrate Gstreamer in Gingerbread!

reynaldo said...

@Sarav: Glad to be of some help!

Joone Hur (허준회) said...

Does GST on Android offer any interface for Android applications?

reynaldo said...

@joone We haven't come up with java bindings for it yet. That is something we would like to tackle soon. In the meantime, you should be able to build a native application on top of the gst NDK bundle we are providing.

Anonymous said...

I am trying to compile GStreamer for android following your freedesktop wikipage. Problem is that it does not have build.xml, which makes it fail. How could I solve this?

Marc Jem said...

I cannot see any instruction on the wiki page you mention

Pedro Simão said...

Hello,
Isn't it possible to just have an .APK gstreamer file and install it?
It seems so hard to me to go through all this developer process.
Can't someone provide an . APK file?
Thanks

reynaldo said...

Process has been improved on and worked around quite a bit since I wrote this entry. Please refer to https://coaxion.net/blog/2013/10/gstreamer-1-0-examples-for-ios-android-and-in-general/ for community up to date instructions and usage samples.