Open sourcing Bitmp4

Cuong Le
1 min readOct 27, 2018

One of the challenge is to reserve image quality when exporting a live message. Due to gif limitation, we planned to adopt APNG, WEBP. However, they are not widely used in most popular messenger apps. The team ended up going with mp4 format.

Motivation

With an existing infrastructure, we already have an Encoder, whose method addFrame(bitmap) gets called every 33ms, converts a list of bitmaps to a gif backed by a native gif encoder engine. To support video, we only need to add a video encoder engine. Unfortunately, we weren’t able to find a turnkey solution. During our search we got acquainted with some libraries we’d like to tell you about them.

Jcodec

The library seems fine. However, it is purely Java. When it comes to performance, you’ll mostly have to deal with JNI and C++ code.

FFmpeg

FFmpeg is well known for processing for video and audio. Looking at its API, it requires a list image files at encoding time. We can’t really rely on ffmpeg because our application generate bitmaps every 33ms.

Grafika

This is not a library but a playground with Android media API. It’s quite hard to understand without Android graphic knowledge. We decided to invest time to get insight from this example. Eventually, we managed to get it worked.

Conclusion

We hope that open-sourcing Bitmp4 will provide a useful library for other engineers working on mobile applications. We look forward to seeing what the community will create, and over the coming months.

Check out our source https://github.com/dbof10/Bitmp4

--

--