Most visited

Recently visited

Added in API level 21

MediaCodecInfo.VideoCapabilities

public static final class MediaCodecInfo.VideoCapabilities
extends Object

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


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.

Inherited methods

From class java.lang.Object

Public methods

areSizeAndRateSupported

Added in API level 21
boolean areSizeAndRateSupported (int width, 
                int height, 
                double frameRate)

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

Parameters
width int
height int
frameRate double
Returns
boolean

getAchievableFrameRatesFor

Added in API level 23
Range<Double> getAchievableFrameRatesFor (int width, 
                int height)

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 M 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 N 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 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: the width of the video
height int: the height of the video
Returns
Range<Double>
Throws
IllegalArgumentException if the video size is not supported.

getBitrateRange

Added in API level 21
Range<Integer> getBitrateRange ()

Returns the range of supported bitrates in bits/second.

Returns
Range<Integer>

getHeightAlignment

Added in API level 21
int getHeightAlignment ()

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

Returns
int

getSupportedFrameRates

Added in API level 21
Range<Integer> getSupportedFrameRates ()

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.

Returns
Range<Integer>

getSupportedFrameRatesFor

Added in API level 21
Range<Double> getSupportedFrameRatesFor (int width, 
                int height)

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: the width of the video
height int: the height of the video
Returns
Range<Double>

getSupportedHeights

Added in API level 21
Range<Integer> getSupportedHeights ()

Returns the range of supported video heights.

Returns
Range<Integer>

getSupportedHeightsFor

Added in API level 21
Range<Integer> getSupportedHeightsFor (int width)

Returns the range of supported video heights for a video width

Parameters
width int: the width of the video
Returns
Range<Integer>

getSupportedWidths

Added in API level 21
Range<Integer> getSupportedWidths ()

Returns the range of supported video widths.

Returns
Range<Integer>

getSupportedWidthsFor

Added in API level 21
Range<Integer> getSupportedWidthsFor (int height)

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

Parameters
height int: the height of the video
Returns
Range<Integer>

getWidthAlignment

Added in API level 21
int getWidthAlignment ()

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

Returns
int

isSizeSupported

Added in API level 21
boolean isSizeSupported (int width, 
                int height)

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

Parameters
width int
height int
Returns
boolean

Hooray!