Android APIs
public static final class

MediaCodecInfo.VideoCapabilities

extends Object
java.lang.Object
   ↳ android.media.MediaCodecInfo.VideoCapabilities

Class Overview

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

Summary

Public Methods
boolean areSizeAndRateSupported(int width, int height, double frameRate)
Returns whether a given video size (width and height) and frameRate combination is supported.
Range<Double> getAchievableFrameRatesFor(int width, int height)
Returns the range of achievable video frame rates for a video size.
Range<Integer> getBitrateRange()
Returns the range of supported bitrates in bits/second.
int getHeightAlignment()
Returns the alignment requirement for video height (in pixels).
Range<Integer> getSupportedFrameRates()
Returns the range of supported frame rates.
Range<Double> getSupportedFrameRatesFor(int width, int height)
Returns the range of supported video frame rates for a video size.
Range<Integer> getSupportedHeights()
Returns the range of supported video heights.
Range<Integer> getSupportedHeightsFor(int width)
Returns the range of supported video heights for a video width
Range<Integer> getSupportedWidths()
Returns the range of supported video widths.
Range<Integer> getSupportedWidthsFor(int height)
Returns the range of supported video widths for a video height.
int getWidthAlignment()
Returns the alignment requirement for video width (in pixels).
boolean isSizeSupported(int width, int height)
Returns whether a given video size (width and height) is supported.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean areSizeAndRateSupported (int width, int height, double frameRate)

Added in API level 21

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

public Range<Double> getAchievableFrameRatesFor (int width, int height)

Added in API level 23

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 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.

The returned range corresponds to the fastest frame rates achieved in the tested configurations. It is interpolated from the nearest frame size(s) tested. Codec performance is severely impacted by other activity on the device, and can vary significantly.

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 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 the width of the video
height the height of the video
Throws
IllegalArgumentException if the video size is not supported.

public Range<Integer> getBitrateRange ()

Added in API level 21

Returns the range of supported bitrates in bits/second.

public int getHeightAlignment ()

Added in API level 21

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

public Range<Integer> getSupportedFrameRates ()

Added in API level 21

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.

public Range<Double> getSupportedFrameRatesFor (int width, int height)

Added in API level 21

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 the width of the video
height the height of the video

public Range<Integer> getSupportedHeights ()

Added in API level 21

Returns the range of supported video heights.

public Range<Integer> getSupportedHeightsFor (int width)

Added in API level 21

Returns the range of supported video heights for a video width

Parameters
width the width of the video

public Range<Integer> getSupportedWidths ()

Added in API level 21

Returns the range of supported video widths.

public Range<Integer> getSupportedWidthsFor (int height)

Added in API level 21

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

Parameters
height the height of the video

public int getWidthAlignment ()

Added in API level 21

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

public boolean isSizeSupported (int width, int height)

Added in API level 21

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