Added in API level 16

CodecCapabilities


class CodecCapabilities
kotlin.Any
   ↳ android.media.MediaCodecInfo.CodecCapabilities

Encapsulates the capabilities of a given codec component. For example, what profile/level combinations it supports and what colorspaces it is capable of providing the decoded data in, as well as some codec-type specific capability flags.

You can get an instance for a given MediaCodecInfo object with getCapabilitiesForType(), passing a MIME type.

Summary

Constants
static Int

static Int

static Int

static Int

static Int

16 bits per pixel RGB color format, with 5-bit red & blue and 6-bit green component.

static Int

static Int

static Int

static Int

static Int

static Int

static Int

static Int

24 bits per pixel RGB color format, with 8-bit red, green & blue components.

static Int

static Int

static Int

32 bits per pixel RGBA color format, with 10-bit red, green, blue, and 2-bit alpha components.

static Int

32 bits per pixel RGBA color format, with 8-bit red, green, blue, and alpha components.

static Int

static Int

static Int

64 bits per pixel RGBA color format, with 16-bit signed floating point red, green, blue, and alpha components.

static Int

static Int

static Int

static Int

16 bits per pixel, little-endian Y color format.

static Int

static Int

static Int

32 bits per pixel, little-endian Y color format.

static Int

static Int

8 bits per pixel Y color format.

static Int

static Int

Flexible 32 bits per pixel RGBA color format with 8-bit red, green, blue, and alpha components.

static Int

Flexible 24 bits per pixel RGB color format with 8-bit red, green and blue components.

static Int

SMIA 10-bit Bayer format.

static Int

SMIA 8-bit Bayer format.

static Int

SMIA 8-bit compressed Bayer format.

static Int

static Int

static Int

static Int

static Int

static Int

Flexible 12 bits per pixel, subsampled YUV color format with 8-bit chroma and luma components.

static Int

static Int

static Int

static Int

static Int

Flexible 16 bits per pixel, subsampled YUV color format with 8-bit chroma and luma components.

static Int

static Int

static Int

static Int

static Int

Flexible 24 bits per pixel YUV color format with 8-bit chroma and luma components.

static Int

static Int

P010 is 10-bit-per component 4:2:0 YCbCr semiplanar format.

static Int

static Int

static String

video decoder only: codec supports seamless resolution changes.

static String

video decoder only: codec supports detaching the output surface when in Surface mode.

static String

video decoder only: codec supports dynamically changing color aspects.

static String

If true, the timestamp of each output buffer is derived from the timestamp of the input buffer that produced the output.

static String

video encoder only: codec supports exporting encoding statistics.

static String

decoder onlyIf true, the codec supports partial (including multiple) access units per input buffer.

static String

video encoder only: codec supports HDR editing.

static String

video encoder only: codec supports HLG editing.

static String

video encoder only: codec supports intra refresh.

static String

decoder only: codec supports low latency decoding.

static String

If true, the codec supports multiple access units (for decoding, or to output for encoders).

static String

video decoder only: codec supports queuing partial frames.

static String

video encoder only: codec supports quantization parameter bounds.

static String

video encoder only: codec supports region of interest encoding.

static String

video decoder only: codec supports secure decryption.

static String

video or audio decoder only: codec supports tunneled playback.

Public constructors

Public methods
static MediaCodecInfo.CodecCapabilities!
createFromProfileLevel(mime: String!, profile: Int, level: Int)

Retrieve the codec capabilities for a certain mime type, profile and level.

MediaCodecInfo.AudioCapabilities!

Returns the audio capabilities or null if this is not an audio codec.

MediaFormat!

Returns a MediaFormat object with default values for configurations that have defaults.

MediaCodecInfo.EncoderCapabilities!

Returns the encoding capabilities or null if this is not an encoder.

Int

Returns the max number of the supported concurrent codec instances.

String!

Returns the mime type for which this codec-capability object was created.

MediaCodecInfo.VideoCapabilities!

Returns the video capabilities or null if this is not a video codec.

Boolean

Query codec feature requirements.

Boolean

Query codec feature capabilities.

Boolean

Query whether codec supports a given MediaFormat.

Properties
IntArray!

The color format for the media.

Array<MediaCodecInfo.CodecProfileLevel!>!

Constants

COLOR_Format12bitRGB444

Added in API level 16
Deprecated in API level 23
static val COLOR_Format12bitRGB444: Int

Deprecated: Use COLOR_Format24bitBGR888.

Value: 3

COLOR_Format16bitARGB1555

Added in API level 16
Deprecated in API level 23
static val COLOR_Format16bitARGB1555: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 5

COLOR_Format16bitARGB4444

Added in API level 16
Deprecated in API level 23
static val COLOR_Format16bitARGB4444: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 4

COLOR_Format16bitBGR565

Added in API level 16
Deprecated in API level 23
static val COLOR_Format16bitBGR565: Int

Deprecated: Use COLOR_Format16bitRGB565.

Value: 7

COLOR_Format16bitRGB565

Added in API level 16
static val COLOR_Format16bitRGB565: Int

16 bits per pixel RGB color format, with 5-bit red & blue and 6-bit green component.

Using 16-bit little-endian representation, colors stored as Red 15:11, Green 10:5, Blue 4:0.

byte                   byte
   <--------- i --------> | <------ i + 1 ------>
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |     BLUE     |      GREEN      |     RED      |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
   0           4  5     7   0     2  3           7
  bit
  
This format corresponds to android.graphics.PixelFormat#RGB_565 and android.graphics.ImageFormat#RGB_565.
Value: 6

COLOR_Format18BitBGR666

Added in API level 16
Deprecated in API level 23
static val COLOR_Format18BitBGR666: Int

Deprecated: Use COLOR_Format24bitBGR888.

Value: 41

COLOR_Format18bitARGB1665

Added in API level 16
Deprecated in API level 23
static val COLOR_Format18bitARGB1665: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 9

COLOR_Format18bitRGB666

Added in API level 16
Deprecated in API level 23
static val COLOR_Format18bitRGB666: Int

Deprecated: Use COLOR_Format24bitBGR888.

Value: 8

COLOR_Format19bitARGB1666

Added in API level 16
Deprecated in API level 23
static val COLOR_Format19bitARGB1666: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 10

COLOR_Format24BitABGR6666

Added in API level 16
Deprecated in API level 23
static val COLOR_Format24BitABGR6666: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 43

COLOR_Format24BitARGB6666

Added in API level 16
Deprecated in API level 23
static val COLOR_Format24BitARGB6666: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 42

COLOR_Format24bitARGB1887

Added in API level 16
Deprecated in API level 23
static val COLOR_Format24bitARGB1887: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 13

COLOR_Format24bitBGR888

Added in API level 16
static val COLOR_Format24bitBGR888: Int

24 bits per pixel RGB color format, with 8-bit red, green & blue components.

Using 24-bit little-endian representation, colors stored as Red 7:0, Green 15:8, Blue 23:16.

byte              byte             byte
   <------ i -----> | <---- i+1 ----> | <---- i+2 ----->
  +-----------------+-----------------+-----------------+
  |       RED       |      GREEN      |       BLUE      |
  +-----------------+-----------------+-----------------+
  
This format corresponds to android.graphics.PixelFormat#RGB_888, and can also be represented as a flexible format by COLOR_FormatRGBFlexible.
Value: 12

COLOR_Format24bitRGB888

Added in API level 16
Deprecated in API level 23
static val COLOR_Format24bitRGB888: Int

Deprecated: Use COLOR_Format24bitBGR888 or COLOR_FormatRGBFlexible.

Value: 11

COLOR_Format25bitARGB1888

Added in API level 16
Deprecated in API level 23
static val COLOR_Format25bitARGB1888: Int

Deprecated: Use COLOR_Format32bitABGR8888.

Value: 14

COLOR_Format32bitABGR2101010

Added in API level 33
static val COLOR_Format32bitABGR2101010: Int

32 bits per pixel RGBA color format, with 10-bit red, green, blue, and 2-bit alpha components.

Using 32-bit little-endian representation, colors stored as Red 9:0, Green 19:10, Blue 29:20, and Alpha 31:30.

byte              byte             byte              byte
   <------ i -----> | <---- i+1 ----> | <---- i+2 ----> | <---- i+3 ----->
  +-----------------+---+-------------+-------+---------+-----------+-----+
  |       RED           |      GREEN          |       BLUE          |ALPHA|
  +-----------------+---+-------------+-------+---------+-----------+-----+
   0               7 0 1 2           7 0     3 4       7 0         5 6   7
  
This corresponds to android.graphics.PixelFormat#RGBA_1010102.
Value: 2130750114

COLOR_Format32bitABGR8888

Added in API level 23
static val COLOR_Format32bitABGR8888: Int

32 bits per pixel RGBA color format, with 8-bit red, green, blue, and alpha components.

Using 32-bit little-endian representation, colors stored as Red 7:0, Green 15:8, Blue 23:16, and Alpha 31:24.

byte              byte             byte              byte
   <------ i -----> | <---- i+1 ----> | <---- i+2 ----> | <---- i+3 ----->
  +-----------------+-----------------+-----------------+-----------------+
  |       RED       |      GREEN      |       BLUE      |      ALPHA      |
  +-----------------+-----------------+-----------------+-----------------+
  
This corresponds to android.graphics.PixelFormat#RGBA_8888.
Value: 2130747392

COLOR_Format32bitARGB8888

Added in API level 16
Deprecated in API level 23
static val COLOR_Format32bitARGB8888: Int

Deprecated: Use COLOR_Format32bitABGR8888 Or COLOR_FormatRGBAFlexible.

Value: 16

COLOR_Format32bitBGRA8888

Added in API level 16
Deprecated in API level 23
static val COLOR_Format32bitBGRA8888: Int

Deprecated: Use COLOR_Format32bitABGR8888 Or COLOR_FormatRGBAFlexible.

Value: 15

COLOR_Format64bitABGRFloat

Added in API level 33
static val COLOR_Format64bitABGRFloat: Int

64 bits per pixel RGBA color format, with 16-bit signed floating point red, green, blue, and alpha components.

byte              byte             byte              byte
   <-- i -->|<- i+1 ->|<- i+2 ->|<- i+3 ->|<- i+4 ->|<- i+5 ->|<- i+6 ->|<- i+7 ->
  +---------+---------+-------------------+---------+---------+---------+---------+
  |        RED        |       GREEN       |       BLUE        |       ALPHA       |
  +---------+---------+-------------------+---------+---------+---------+---------+
   0       7 0       7 0       7 0       7 0       7 0       7 0       7 0       7
  
This corresponds to android.graphics.PixelFormat#RGBA_F16.
Value: 2130710294

COLOR_Format8bitRGB332

Added in API level 16
Deprecated in API level 23
static val COLOR_Format8bitRGB332: Int

Deprecated: Use COLOR_Format24bitBGR888.

Value: 2

COLOR_FormatCbYCrY

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatCbYCrY: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 27

COLOR_FormatCrYCbY

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatCrYCbY: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 28

COLOR_FormatL16

Added in API level 16
static val COLOR_FormatL16: Int

16 bits per pixel, little-endian Y color format.

byte                   byte
   <--------- i --------> | <------ i + 1 ------>
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |                       Y                       |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
   0                    7   0                    7
  bit
  
Value: 36

COLOR_FormatL2

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatL2: Int

Deprecated: Use COLOR_FormatL8.

Value: 33

COLOR_FormatL24

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatL24: Int

Deprecated: Use COLOR_FormatL16.

Value: 37

COLOR_FormatL32

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatL32: Int

Deprecated: Use COLOR_FormatL16.

32 bits per pixel, little-endian Y color format.

byte              byte             byte              byte
   <------ i -----> | <---- i+1 ----> | <---- i+2 ----> | <---- i+3 ----->
  +-----------------+-----------------+-----------------+-----------------+
  |                                   Y                                   |
  +-----------------+-----------------+-----------------+-----------------+
   0               7 0               7 0               7 0               7
  bit
  
Value: 38

COLOR_FormatL4

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatL4: Int

Deprecated: Use COLOR_FormatL8.

Value: 34

COLOR_FormatL8

Added in API level 16
static val COLOR_FormatL8: Int

8 bits per pixel Y color format.

Each byte contains a single pixel. This format corresponds to android.graphics.PixelFormat#L_8.

Value: 35

COLOR_FormatMonochrome

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatMonochrome: Int

Deprecated: Use COLOR_Format24bitBGR888.

Value: 1

COLOR_FormatRGBAFlexible

Added in API level 23
static val COLOR_FormatRGBAFlexible: Int

Flexible 32 bits per pixel RGBA color format with 8-bit red, green, blue, and alpha components.

Use this format with Image. This format corresponds to android.graphics.ImageFormat#FLEX_RGBA_8888, and can represent COLOR_Format32bitBGRA8888, COLOR_Format32bitABGR8888 and COLOR_Format32bitARGB8888 formats.

Value: 2134288520

COLOR_FormatRGBFlexible

Added in API level 23
static val COLOR_FormatRGBFlexible: Int

Flexible 24 bits per pixel RGB color format with 8-bit red, green and blue components.

Use this format with Image. This format corresponds to android.graphics.ImageFormat#FLEX_RGB_888, and can represent COLOR_Format24bitBGR888 and COLOR_Format24bitRGB888 formats.

Value: 2134292616

COLOR_FormatRawBayer10bit

Added in API level 16
static val COLOR_FormatRawBayer10bit: Int

SMIA 10-bit Bayer format.

Value: 31

COLOR_FormatRawBayer8bit

Added in API level 16
static val COLOR_FormatRawBayer8bit: Int

SMIA 8-bit Bayer format. Each byte represents the top 8-bits of a 10-bit signal.

Value: 30

COLOR_FormatRawBayer8bitcompressed

Added in API level 16
static val COLOR_FormatRawBayer8bitcompressed: Int

SMIA 8-bit compressed Bayer format. Each byte represents a sample from the 10-bit signal that is compressed into 8-bits using DPCM/PCM compression, as defined by the SMIA Functional Specification.

Value: 32

COLOR_FormatSurface

Added in API level 18
static val COLOR_FormatSurface: Int
Value: 2130708361

COLOR_FormatYCbYCr

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYCbYCr: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 25

COLOR_FormatYCrYCb

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYCrYCb: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 26

COLOR_FormatYUV411PackedPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV411PackedPlanar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 18

COLOR_FormatYUV411Planar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV411Planar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 17

COLOR_FormatYUV420Flexible

Added in API level 21
static val COLOR_FormatYUV420Flexible: Int

Flexible 12 bits per pixel, subsampled YUV color format with 8-bit chroma and luma components.

Chroma planes are subsampled by 2 both horizontally and vertically. Use this format with Image. This format corresponds to android.graphics.ImageFormat#YUV_420_888, and can represent the COLOR_FormatYUV411Planar, COLOR_FormatYUV411PackedPlanar, COLOR_FormatYUV420Planar, COLOR_FormatYUV420PackedPlanar, COLOR_FormatYUV420SemiPlanar and COLOR_FormatYUV420PackedSemiPlanar formats.

Value: 2135033992

COLOR_FormatYUV420PackedPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV420PackedPlanar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 20

COLOR_FormatYUV420PackedSemiPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV420PackedSemiPlanar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 39

COLOR_FormatYUV420Planar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV420Planar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 19

COLOR_FormatYUV420SemiPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV420SemiPlanar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 21

COLOR_FormatYUV422Flexible

Added in API level 23
static val COLOR_FormatYUV422Flexible: Int

Flexible 16 bits per pixel, subsampled YUV color format with 8-bit chroma and luma components.

Chroma planes are horizontally subsampled by 2. Use this format with Image. This format corresponds to android.graphics.ImageFormat#YUV_422_888, and can represent the COLOR_FormatYCbYCr, COLOR_FormatYCrYCb, COLOR_FormatCbYCrY, COLOR_FormatCrYCbY, COLOR_FormatYUV422Planar, COLOR_FormatYUV422PackedPlanar, COLOR_FormatYUV422SemiPlanar and COLOR_FormatYUV422PackedSemiPlanar formats.

Value: 2135042184

COLOR_FormatYUV422PackedPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV422PackedPlanar: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 23

COLOR_FormatYUV422PackedSemiPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV422PackedSemiPlanar: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 40

COLOR_FormatYUV422Planar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV422Planar: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 22

COLOR_FormatYUV422SemiPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV422SemiPlanar: Int

Deprecated: Use COLOR_FormatYUV422Flexible.

Value: 24

COLOR_FormatYUV444Flexible

Added in API level 23
static val COLOR_FormatYUV444Flexible: Int

Flexible 24 bits per pixel YUV color format with 8-bit chroma and luma components.

Chroma planes are not subsampled. Use this format with Image. This format corresponds to android.graphics.ImageFormat#YUV_444_888, and can represent the COLOR_FormatYUV444Interleaved format.

Value: 2135181448

COLOR_FormatYUV444Interleaved

Added in API level 16
Deprecated in API level 23
static val COLOR_FormatYUV444Interleaved: Int

Deprecated: Use COLOR_FormatYUV444Flexible.

Value: 29

COLOR_FormatYUVP010

Added in API level 33
static val COLOR_FormatYUVP010: Int

P010 is 10-bit-per component 4:2:0 YCbCr semiplanar format.

This format uses 24 allocated bits per pixel with 15 bits of data per pixel. Chroma planes are subsampled by 2 both horizontally and vertically. Each chroma and luma component has 16 allocated bits in little-endian configuration with 10 MSB of actual data.

byte                   byte
   <--------- i --------> | <------ i + 1 ------>
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |     UNUSED      |      Y/Cb/Cr                |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
   0               5 6   7 0                    7
  bit
  
Use this format with Image. This format corresponds to android.graphics.ImageFormat#YCBCR_P010.

Value: 54

COLOR_QCOM_FormatYUV420SemiPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_QCOM_FormatYUV420SemiPlanar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 2141391872

COLOR_TI_FormatYUV420PackedSemiPlanar

Added in API level 16
Deprecated in API level 23
static val COLOR_TI_FormatYUV420PackedSemiPlanar: Int

Deprecated: Use COLOR_FormatYUV420Flexible.

Value: 2130706688

FEATURE_AdaptivePlayback

Added in API level 19
static val FEATURE_AdaptivePlayback: String

video decoder only: codec supports seamless resolution changes.

Value: "adaptive-playback"

FEATURE_DetachedSurface

Added in API level 35
static val FEATURE_DetachedSurface: String

video decoder only: codec supports detaching the output surface when in Surface mode.

If true, the codec can be configured in Surface mode without an actual surface (in detached surface mode).

Value: "detached-surface"

FEATURE_DynamicColorAspects

Added in API level 35
static val FEATURE_DynamicColorAspects: String

video decoder only: codec supports dynamically changing color aspects.

If true, the codec can propagate color aspect changes during decoding. This is only meaningful at session boundaries, e.g. upon processing Picture Parameter Sets prior to a new IDR. The color aspects may come from the bitstream, or may be provided using MediaCodec#setParameters calls.

If the codec supports both 8-bit and 10-bit profiles, this feature means that the codec can dynamically switch between 8 and 10-bit profiles, but this is restricted to Surface mode only.

If the device supports HDR transfer functions, switching between SDR and HDR transfer is also supported. Together with the previous clause this means that switching between SDR and HDR sessions are supported in Surface mode, as SDR is typically encoded at 8-bit and HDR at 10-bit.

Value: "dynamic-color-aspects"

FEATURE_DynamicTimestamp

Added in API level 29
static val FEATURE_DynamicTimestamp: String

If true, the timestamp of each output buffer is derived from the timestamp of the input buffer that produced the output. If false, the timestamp of each output buffer is derived from the timestamp of the first input buffer.

Value: "dynamic-timestamp"

FEATURE_EncodingStatistics

Added in API level 33
static val FEATURE_EncodingStatistics: String

video encoder only: codec supports exporting encoding statistics. Encoders with this feature can provide the App clients with the encoding statistics information about the frame. The scope of encoding statistics is controlled by MediaFormat#KEY_VIDEO_ENCODING_STATISTICS_LEVEL.

Value: "encoding-statistics"

FEATURE_FrameParsing

Added in API level 29
static val FEATURE_FrameParsing: String

decoder onlyIf true, the codec supports partial (including multiple) access units per input buffer.

Value: "frame-parsing"

FEATURE_HdrEditing

Added in API level 33
static val FEATURE_HdrEditing: String

video encoder only: codec supports HDR editing.

HDR editing support means that the codec accepts 10-bit HDR input surface, and it is capable of generating any HDR metadata required from both YUV and RGB input when the metadata is not present. This feature is only meaningful when using an HDR capable profile (and 10-bit HDR input).

This feature implies that the codec is capable of encoding at least one HDR format, and that it supports RGBA_1010102 as well as P010, and optionally RGBA_FP16 input formats, and that the encoder can generate HDR metadata for all supported HDR input formats.

Value: "hdr-editing"

FEATURE_HlgEditing

Added in API level 35
static val FEATURE_HlgEditing: String

video encoder only: codec supports HLG editing.

HLG editing support means that the codec accepts 10-bit HDR input surface in both YUV and RGB pixel format. This feature is only meaningful when using a 10-bit (HLG) profile and 10-bit input.

This feature implies that the codec is capable of encoding 10-bit format, and that it supports RGBA_1010102 as well as P010, and optionally RGBA_FP16 input formats.

The difference between this feature and is that HLG does not require the generation of HDR metadata and does not use an explicit HDR profile.

Value: "hlg-editing"

FEATURE_IntraRefresh

Added in API level 24
static val FEATURE_IntraRefresh: String

video encoder only: codec supports intra refresh.

Value: "intra-refresh"

FEATURE_LowLatency

Added in API level 30
static val FEATURE_LowLatency: String

decoder only: codec supports low latency decoding. If supported, clients can enable the low latency mode for the decoder. When the mode is enabled, the decoder doesn't hold input and output data more than required by the codec standards.

Value: "low-latency"

FEATURE_MultipleFrames

Added in API level 29
static val FEATURE_MultipleFrames: String

If true, the codec supports multiple access units (for decoding, or to output for encoders). If false, the codec only supports single access units. Producing multiple access units for output is an optional feature.

Value: "multiple-frames"

FEATURE_PartialFrame

Added in API level 26
static val FEATURE_PartialFrame: String

video decoder only: codec supports queuing partial frames.

Value: "partial-frame"

FEATURE_QpBounds

Added in API level 31
static val FEATURE_QpBounds: String

video encoder only: codec supports quantization parameter bounds.

Value: "qp-bounds"

FEATURE_Roi

Added in API level 35
static val FEATURE_Roi: String

video encoder only: codec supports region of interest encoding.

RoI encoding support means the codec accepts information that specifies the relative importance of different portions of each video frame. This allows the encoder to separate a video frame into critical and non-critical regions, and use more bits (better quality) to represent the critical regions and de-prioritize non-critical regions. In other words, the encoder chooses a negative qp bias for the critical portions and a zero or positive qp bias for the non-critical portions.

At a basic level, if the encoder decides to encode each frame with a uniform quantization value 'qpFrame' and a 'qpBias' is chosen/suggested for an LCU of the frame, then the actual qp of the LCU will be 'qpFrame + qpBias', although this value can be clamped basing on the min-max configured qp bounds for the current encoding session.

In a shot, if a group of LCUs pan out quickly they can be marked as non-critical thereby enabling the encoder to reserve fewer bits during their encoding. Contrarily, LCUs that remain in shot for a prolonged duration can be encoded at better quality in one frame thereby setting-up an excellent long-term reference for all future frames.

Note that by offsetting the quantization of each LCU, the overall bit allocation will differ from the originally estimated bit allocation, and the encoder will adjust the frame quantization for subsequent frames to meet the bitrate target. An effective selection of critical regions can set-up a golden reference and this can compensate for the bit burden that was introduced due to encoding RoI's at better quality. On the other hand, an ineffective choice of critical regions might increase the quality of certain parts of the image but this can hamper quality in subsequent frames.

Value: "region-of-interest"

FEATURE_SecurePlayback

Added in API level 21
static val FEATURE_SecurePlayback: String

video decoder only: codec supports secure decryption.

Value: "secure-playback"

FEATURE_TunneledPlayback

Added in API level 21
static val FEATURE_TunneledPlayback: String

video or audio decoder only: codec supports tunneled playback.

Value: "tunneled-playback"

Public constructors

CodecCapabilities

Added in API level 16
CodecCapabilities()

Public methods

createFromProfileLevel

Added in API level 21
static fun createFromProfileLevel(
    mime: String!,
    profile: Int,
    level: Int
): MediaCodecInfo.CodecCapabilities!

Retrieve the codec capabilities for a certain mime type, profile and level. If the type, or profile-level combination is not understood by the framework, it returns null.

In android.os.Build.VERSION_CODES#M, calling this method without calling any method of the MediaCodecList class beforehand results in a NullPointerException.

getAudioCapabilities

Added in API level 21
fun getAudioCapabilities(): MediaCodecInfo.AudioCapabilities!

Returns the audio capabilities or null if this is not an audio codec.

getDefaultFormat

Added in API level 21
fun getDefaultFormat(): MediaFormat!

Returns a MediaFormat object with default values for configurations that have defaults.

getEncoderCapabilities

Added in API level 21
fun getEncoderCapabilities(): MediaCodecInfo.EncoderCapabilities!

Returns the encoding capabilities or null if this is not an encoder.

getMaxSupportedInstances

Added in API level 23
fun getMaxSupportedInstances(): Int

Returns the max number of the supported concurrent codec instances.

This is a hint for an upper bound. Applications should not expect to successfully operate more instances than the returned value, but the actual number of concurrently operable instances may be less as it depends on the available resources at time of use.

getMimeType

Added in API level 21
fun getMimeType(): String!

Returns the mime type for which this codec-capability object was created.

getVideoCapabilities

Added in API level 21
fun getVideoCapabilities(): MediaCodecInfo.VideoCapabilities!

Returns the video capabilities or null if this is not a video codec.

isFeatureRequired

Added in API level 21
fun isFeatureRequired(name: String!): Boolean

Query codec feature requirements.

These features are required to be used by the codec, and as such, they are always turned on.

isFeatureSupported

Added in API level 19
fun isFeatureSupported(name: String!): Boolean

Query codec feature capabilities.

These features are supported to be used by the codec. These include optional features that can be turned on, as well as features that are always on.

isFormatSupported

Added in API level 21
fun isFormatSupported(format: MediaFormat!): Boolean

Query whether codec supports a given MediaFormat.

Note: On android.os.Build.VERSION_CODES#LOLLIPOP, format must not contain a frame rate. Use format.setString(MediaFormat.KEY_FRAME_RATE, null) to clear any existing frame rate setting in the format.

The following table summarizes the format keys considered by this method. This is especially important to consider when targeting a higher SDK version than the minimum SDK version, as this method will disregard some keys on devices below the target SDK version.

OS Version(s) MediaFormat keys considered for
Audio Codecs Video Codecs Encoders
android.os.Build.VERSION_CODES#LOLLIPOP MediaFormat#KEY_MIME*,
MediaFormat#KEY_SAMPLE_RATE,
MediaFormat#KEY_CHANNEL_COUNT,
MediaFormat#KEY_MIME*,
CodecCapabilities#FEATURE_AdaptivePlaybackD,
CodecCapabilities#FEATURE_SecurePlaybackD,
CodecCapabilities#FEATURE_TunneledPlaybackD,
MediaFormat#KEY_WIDTH,
MediaFormat#KEY_HEIGHT,
no KEY_FRAME_RATE
as to the left, plus
MediaFormat#KEY_BITRATE_MODE,
MediaFormat#KEY_PROFILE (and/or MediaFormat#KEY_AAC_PROFILE~),
MediaFormat#KEY_COMPLEXITY (and/or MediaFormat#KEY_FLAC_COMPRESSION_LEVEL~)
android.os.Build.VERSION_CODES#LOLLIPOP_MR1 as above, plus
MediaFormat#KEY_FRAME_RATE
android.os.Build.VERSION_CODES#M
android.os.Build.VERSION_CODES#N as above, plus
MediaFormat#KEY_PROFILE,
MediaFormat#KEY_BIT_RATE
as above, plus
MediaFormat#KEY_PROFILE,
MediaFormat#KEY_LEVEL+,
MediaFormat#KEY_BIT_RATE,
CodecCapabilities#FEATURE_IntraRefreshE
android.os.Build.VERSION_CODES#N_MR1
android.os.Build.VERSION_CODES#O as above, plus
CodecCapabilities#FEATURE_PartialFrameD
android.os.Build.VERSION_CODES#O_MR1
android.os.Build.VERSION_CODES#P
android.os.Build.VERSION_CODES#Q as above, plus
CodecCapabilities#FEATURE_FrameParsingD,
CodecCapabilities#FEATURE_MultipleFrames,
CodecCapabilities#FEATURE_DynamicTimestamp
android.os.Build.VERSION_CODES#R as above, plus
CodecCapabilities#FEATURE_LowLatencyD

Notes:
*: must be specified; otherwise, method returns false.
+: method does not verify that the format parameters are supported by the specified level.
D: decoders only
E: encoders only
~: if both keys are provided values must match

Parameters
format MediaFormat!: media format with optional feature directives.
Return
Boolean whether the codec capabilities support the given format and feature requests.
Exceptions
java.lang.IllegalArgumentException if format is not a valid media format.

Properties

colorFormats

Added in API level 16
var colorFormats: IntArray!

The color format for the media. This is one of the color constants defined in this class.

profileLevels

Added in API level 16
var profileLevels: Array<MediaCodecInfo.CodecProfileLevel!>!