Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android hardware accelerated video decoder for H264 stream

I am developing an Android hardware accelerated video decoder for decoding real time H264 Annex B stream. After a bit research, it seems I need to get my hands dirty to do this. I came over several keywords like OMXCodec, Android's OS stagefright and ffmpeg's stagefright, MediaCodec API, GStreamer. Also I came to know that - there is no way for hardware agnostic implementation to support all vendor's hardware. At this stage, all these are making too much confusing to me as I didn't find any straight-forward resources to go forward any one of them. My requirements are -

  1. Android Hardware Accelerated Video Decoder
  2. Supports at least for Qualcomm's Snapdragon, Samsung's Exynos and Tegra
  3. Implementation must be in native C/C++ layer (not Java layer)
  4. Support from Android 4.1.x Jellybean will suffice
  5. No need to implement later phases like - rendering as these are already working. Just need to decode input buffer and produce decoded output buffer to proceed to existing pipeline.

I tried to get some hints from Android's stagefright's AwesomePlayer.cpp, SimplePlayer.cpp and ffmpeg stagefright's command line executables code. But nothing is making much sense to me to choose and proceed any of this stuff.

How can I approach? Is there any helpful resources to get clear intuition?

Thanks in advance!

like image 286
Kaidul Avatar asked Sep 26 '22 20:09

Kaidul


1 Answers

I have implemented such a system recently using the MediaCodec API. Unfortunately this API is not exposed in the NDK so it is only accessible from the Java layer.

The best resource I found was this set of guides:

http://bigflake.com/mediacodec/

Since you have a hard requirement to implement this in the NDK then I guess you need to write a thin Java library which does the interaction with the MediaCodec API and then call through to it via the JNI from your C++ layer.

If you go down the FFMPEG route be mindful of its license, it is quite restrictive for distributed software.

Good luck!

like image 128
Dean Wild Avatar answered Oct 20 '22 11:10

Dean Wild