Some Android Projects might require high or low level media processing. This article rounds up a few useful libraries, like FFmpeg, MP4Parser, Intel Media for Mobile, etc. All the libraries have both pros and cons. You need to carefully consider, according to your initial target API-s, devices, and specification, which one you’ll use . I won’t go into too much detail, the article’s main purpose is to help you decide which lib fits best for a given issue. The selected library or libraries can have great effect on the size of your final application, and will also affect the code complexity and amounts of future maintenance.
As far as I know, this library is used most often for video processing. There are tons of articles, forum threads and SO posts about this and that’s why most developers use it. It can take care of almost any kind of video processing tasks and it can be compiled on almost any platform. And here comes the painful part: you need to compile it for your project. It’s a modular library, it can be extended or shrank, according to your needs. The usage of the library depends on the output of the compilation. On one hand, you can make a standard unix executable shell program. It can then be loaded from the device memory and executed with the Java process. In this case you have to pass all the needed command line arguments for the process. On the other hand, you can compile it as a Shared Library. Then it can be used in a wrapper class, using the Java JNI and the Android NDK. In this case you don’t have to generate command line arguments. But to handle all the input and output data, you will have to write the code for the wrapper class in C or C++.
This library is good for almost any kind of video processing task (concatenate, cut, loop, mux, demux) and it can even apply effects such as fading, distortion, zoom, Picture-in-picture, etc. You have to keep a good balance between included features and compiled binary size or else you will end up with large APKs.
This is a very compact library with decent encoding and decoding capabilities, as it was developed and is maintained by Intel. It’s sufficient out of the box, but the samples only provide primitive use cases. Plus, you might have to write complex scripts for the OpenGL platform if you want to use the lib for complex video processing. Its API is similar to the built in Android MediaPlayer and the MediaCodec API, however, the Intel INDE can be used from API level 16.
Concatenating, cutting and transcoding media. It can also be used for capturing and streaming videos and you can apply effects using OpenGL.
It’s a small library for managing basic video processing tasks on similar media files. It’s not capable of transcoding files, though it’s fast, because it doesn’t encode. Basically, it will only separate the data streams in the video container, then you can do your modifications on these streams.
Cutting and concatenating media, recorded with the camera of the device with fixed recording configurations for compatibility. The MP4Parser can be paired with Ringdroid for user friendly audio editing.
Same as FFmpeg, but more complex. In my opinion this library is far too complex for everyday applications, most of the issues that usually appear during development can be covered with other libraries mentioned in this article.
This is the built in Android API for processing video. However, it has some serious limitations if you want to target a wide scale of APIs. The most useful part is the MediaMuxer class, but you need at least an API level 18 to use this class. (Currently using a minimum API level 16 is recommended.) Therefore, you will lose a decent percentage of the currently working devices if you decide to use this API. Its usage is similar to the MediaPlayer API, but modifications are possible using a Surface in your app and then can you modify its content through the openGL ES API.
Manipulating media files which are compatible with the device by default. You can apply effects using OpenGL. If you pair it with the MP4Parser library you will get a powerful tool for media processing, but you’ll have to ensure the media compatibility using this library in case you want to manage the output with the MP4Parser.
Unlike the libraries previously mentioned, this one only processes audio input, video files can also be used, but only the audio track will be imported. It is compatible with the most common audio formats like AAC, MP3, WAV, OGG. The library also includes some CustomViews for the editor user interface.
Using its built in CustomViews, you can create userfriendly UI for audio editing and it can be paired with other media processing libraries.
As you perhaps expect, I am not going to tell you which library is best. There is no fix-all kind of solution: you should always take your specification into account, combined with this article I hope I could ease your choice.
Wanari is a custom software development company, filled with software developers of all kinds: iOS, Android, Backend, and Frontend engineers. We love new technologies and hope could help you by sharing. Follow us for more content!