Which video encoders are guaranteed to be supporte

2019-08-31 16:22发布

问题:

Testing video encoding with the MediaCodec API in several devices, I noticed all of them have encoders for h264, h263, and MPEG-4.

Are any of these guaranteed to be supported by all devices which have at least Jelly Bean, even if the actual encoding done by MediaCodec is done by software instead of hardware?

回答1:

The Android Compatibility Definition Document (CDD) defines a set of mandatory features. Google "Android <version> CDD" to find the appropriate one.

For example, if you open the 4.3 CDD, and flip down to section 5.1 ("Media Codecs"), you can find a table of codecs. Section 5.2 ("Video Encoding") has some additional details.



回答2:

Not sure if there is a list of guaranteed codecs but you can list those supported by particular device:

 int numCodecs = MediaCodecList.getCodecCount();
 for (int i = 0; i < numCodecs; i++) {
     MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
     [...]
 }

More information in the docs: https://developer.android.com/reference/android/media/MediaCodecInfo.html