# MediaCodecInfo.VideoCapabilities

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# VideoCapabilities

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/MediaCodecInfo.VideoCapabilities "View this page in Java")  

```
class VideoCapabilities
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                   ||
| ↳ | [android.media.MediaCodecInfo.VideoCapabilities](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#) |

A class that supports querying the video capabilities of a codec.

## Summary

|                                                                                                                         Nested classes                                                                                                                          ||
|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [PerformancePoint](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities.PerformancePoint) Video performance points are a set of standard performance points defined by number of pixels, pixel rate and frame rate. |

|                                                                                                                                                                                                                                                                                                                                                                                                                         Public methods                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                               | [areSizeAndRateSupported](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#areSizeAndRateSupported(kotlin.Int,%20kotlin.Int,%20kotlin.Double))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `frameRate:` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)`)` Returns whether a given video size (`width`and`height`) and`frameRate`combination is supported. |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)!\>?                                                                                                           | [getAchievableFrameRatesFor](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getAchievableFrameRatesFor(kotlin.Int,%20kotlin.Int))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns the range of achievable video frame rates for a video size.                                                                                                                                         |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                                                 | [getBitrateRange](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getBitrateRange())`()` Returns the range of supported bitrates in bits/second.                                                                                                                                                                                                                                                                                                                                                                                |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                       | [getHeightAlignment](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getHeightAlignment())`()` Returns the alignment requirement for video height (in pixels).                                                                                                                                                                                                                                                                                                                                                                  |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                                                 | [getSupportedFrameRates](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedFrameRates())`()` Returns the range of supported frame rates.                                                                                                                                                                                                                                                                                                                                                                              |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)!\>!                                                                                                           | [getSupportedFrameRatesFor](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedFrameRatesFor(kotlin.Int,%20kotlin.Int))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns the range of supported video frame rates for a video size.                                                                                                                                            |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                                                 | [getSupportedHeights](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedHeights())`()` Returns the range of supported video heights.                                                                                                                                                                                                                                                                                                                                                                                  |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                                                 | [getSupportedHeightsFor](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedHeightsFor(kotlin.Int))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns the range of supported video heights for a video width                                                                                                                                                                                                                                                            |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[MediaCodecInfo.VideoCapabilities.PerformancePoint](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities.PerformancePoint)!\>? | [getSupportedPerformancePoints](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedPerformancePoints())`()` Returns the supported performance points.                                                                                                                                                                                                                                                                                                                                                                  |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                                                 | [getSupportedWidths](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedWidths())`()` Returns the range of supported video widths.                                                                                                                                                                                                                                                                                                                                                                                     |
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                                                 | [getSupportedWidthsFor](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getSupportedWidthsFor(kotlin.Int))`(`height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns the range of supported video widths for a video height.                                                                                                                                                                                                                                                            |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                       | [getWidthAlignment](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#getWidthAlignment())`()` Returns the alignment requirement for video width (in pixels).                                                                                                                                                                                                                                                                                                                                                                     |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                               | [isSizeSupported](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.VideoCapabilities#isSizeSupported(kotlin.Int,%20kotlin.Int))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns whether a given video size (`width`and`height`) is supported.                                                                                                                                                             |

## Public methods

### areSizeAndRateSupported

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun areSizeAndRateSupported(
    width: Int, 
    height: Int, 
    frameRate: Double
): Boolean
```

Returns whether a given video size (`width`and`height`) and`frameRate`combination is supported.  

### getAchievableFrameRatesFor

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getAchievableFrameRatesFor(
    width: Int, 
    height: Int
): Range<Double!>?
```

Returns the range of achievable video frame rates for a video size. May return`null`, if the codec did not publish any measurement data.

This is a performance estimate provided by the device manufacturer based on statistical sampling of full-speed decoding and encoding measurements in various configurations of common video sizes supported by the codec. As such it should only be used to compare individual codecs on the device. The value is not suitable for comparing different devices or even different android releases for the same device.

*On[android.os.Build.VERSION_CODES#M](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#M:kotlin.Int)release*the returned range corresponds to the fastest frame rates achieved in the tested configurations. As such, it should not be used to gauge guaranteed or even average codec performance on the device.

*On[android.os.Build.VERSION_CODES#N](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int)release* the returned range corresponds closer to sustained performance*in tested configurations* . One can expect to achieve sustained performance higher than the lower limit more than 50% of the time, and higher than half of the lower limit at least 90% of the time*in tested configurations*. Conversely, one can expect performance lower than twice the upper limit at least 90% of the time.

Tested configurations use a single active codec. For use cases where multiple codecs are active, applications can expect lower and in most cases significantly lower performance.

The returned range value is interpolated from the nearest frame size(s) tested. Codec performance is severely impacted by other activity on the device as well as environmental factors (such as battery level, temperature or power source), and can vary significantly even in a steady environment.

Use this method in cases where only codec performance matters, e.g. to evaluate if a codec has any chance of meeting a performance target. Codecs are listed in[MediaCodecList](https://developer.android.com/reference/kotlin/android/media/MediaCodecList)in the preferred order as defined by the device manufacturer. As such, applications should use the first suitable codec in the list to achieve the best balance between power use and performance.

|                                                  Parameters                                                  ||
|----------|----------------------------------------------------------------------------------------------------|
| `width`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the width of the video  |
| `height` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the height of the video |

|                                Exceptions                                 ||
|--------------------------------------|-------------------------------------|
| `java.lang.IllegalArgumentException` | if the video size is not supported. |

### getBitrateRange

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getBitrateRange(): Range<Int!>!
```

Returns the range of supported bitrates in bits/second.  

### getHeightAlignment

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getHeightAlignment(): Int
```

Returns the alignment requirement for video height (in pixels). This is a power-of-2 value that video height must be a multiple of.  

### getSupportedFrameRates

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedFrameRates(): Range<Int!>!
```

Returns the range of supported frame rates.

This is not a performance indicator. Rather, it expresses the limits specified in the coding standard, based on the complexities of encoding material for later playback at a certain frame rate, or the decoding of such material in non-realtime.  

### getSupportedFrameRatesFor

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedFrameRatesFor(
    width: Int, 
    height: Int
): Range<Double!>!
```

Returns the range of supported video frame rates for a video size.

This is not a performance indicator. Rather, it expresses the limits specified in the coding standard, based on the complexities of encoding material of a given size for later playback at a certain frame rate, or the decoding of such material in non-realtime.

|                                                  Parameters                                                  ||
|----------|----------------------------------------------------------------------------------------------------|
| `width`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the width of the video  |
| `height` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the height of the video |

### getSupportedHeights

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedHeights(): Range<Int!>!
```

Returns the range of supported video heights.

32-bit processes will not support resolutions larger than 4096x4096 due to the limited address space.  

### getSupportedHeightsFor

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedHeightsFor(width: Int): Range<Int!>!
```

Returns the range of supported video heights for a video width

|                                                 Parameters                                                 ||
|---------|---------------------------------------------------------------------------------------------------|
| `width` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the width of the video |

### getSupportedPerformancePoints

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedPerformancePoints(): MutableList<MediaCodecInfo.VideoCapabilities.PerformancePoint!>?
```

Returns the supported performance points. May return`null`if the codec did not publish any performance point information (e.g. the vendor codecs have not been updated to the latest android release). May return an empty list if the codec published that if does not guarantee any performance points.

This is a performance guarantee provided by the device manufacturer for hardware codecs based on hardware capabilities of the device.

The returned list is sorted first by decreasing number of pixels, then by decreasing width, and finally by decreasing frame rate. Performance points assume a single active codec. For use cases where multiple codecs are active, should use that highest pixel count, and add the frame rates of each individual codec.

32-bit processes will not support resolutions larger than 4096x4096 due to the limited address space, but performance points will be presented as is. In other words, even though a component publishes a performance point for a resolution higher than 4096x4096, it does not mean that the resolution is supported for 32-bit processes.  

### getSupportedWidths

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedWidths(): Range<Int!>!
```

Returns the range of supported video widths.

32-bit processes will not support resolutions larger than 4096x4096 due to the limited address space.  

### getSupportedWidthsFor

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedWidthsFor(height: Int): Range<Int!>!
```

Returns the range of supported video widths for a video height.

|                                                  Parameters                                                  ||
|----------|----------------------------------------------------------------------------------------------------|
| `height` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the height of the video |

### getWidthAlignment

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getWidthAlignment(): Int
```

Returns the alignment requirement for video width (in pixels). This is a power-of-2 value that video width must be a multiple of.  

### isSizeSupported

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isSizeSupported(
    width: Int, 
    height: Int
): Boolean
```

Returns whether a given video size (`width`and`height`) is supported.