VideoCapabilities


public interface VideoCapabilities


VideoCapabilities is used to query video recording capabilities on the device.

Take Recorder as an example, the supported DynamicRanges can be queried with the following code:

  VideoCapabilities videoCapabilities = Recorder.getVideoCapabilities(cameraInfo);
  Set<DynamicRange> supportedDynamicRanges = videoCapabilities.getSupportedDynamicRanges();

The query result can be used to check if high dynamic range (HDR) recording is supported, and to get the supported qualities of the target DynamicRange:

  List<Quality> supportedQualities = videoCapabilities.getSupportedQualities(dynamicRange);

Summary

Public methods

abstract @NonNull Set<DynamicRange>

Gets all dynamic ranges supported by both the camera and video output.

abstract @NonNull List<Quality>

Gets all supported qualities for the input dynamic range.

abstract boolean
isQualitySupported(
    @NonNull Quality quality,
    @NonNull DynamicRange dynamicRange
)

Checks if the quality is supported for the input dynamic range.

default boolean

Returns if video stabilization is supported on the device.

Public methods

getSupportedDynamicRanges

Added in 1.3.0
abstract @NonNull Set<DynamicRangegetSupportedDynamicRanges()

Gets all dynamic ranges supported by both the camera and video output.

Only DynamicRanges with specified values both in DynamicRange.BitDepth and DynamicRange.DynamicRangeEncoding will be present in the returned set. DynamicRanges such as HDR_UNSPECIFIED_10_BIT will not be included, but they can be used in other methods, such as checking for quality support with isQualitySupported.

Returns
@NonNull Set<DynamicRange>

a set of supported dynamic ranges.

getSupportedQualities

Added in 1.3.0
abstract @NonNull List<QualitygetSupportedQualities(@NonNull DynamicRange dynamicRange)

Gets all supported qualities for the input dynamic range.

The returned list is sorted by quality size from largest to smallest. For the qualities in the returned list, with the same input dynamicRange, isQualitySupported will return true.

When the dynamicRange is not fully specified, e.g. HDR_UNSPECIFIED_10_BIT, the returned list is the union of the qualities supported by the matching fully specified dynamic ranges. This does not mean that all returned qualities are available for every matching dynamic range. Therefore, it is not recommended to rely on any one particular quality to work if mixing use cases with other dynamic ranges.

Note: Constants HIGHEST and LOWEST are not included in the returned list, but their corresponding qualities are included. For example: when the returned list consists of UHD, FHD and HD, HIGHEST corresponds to UHD, which is the highest quality, and LOWEST corresponds to HD.

Parameters
@NonNull DynamicRange dynamicRange

the dynamicRange.

Returns
@NonNull List<Quality>

a list of supported qualities sorted by size from large to small.

isQualitySupported

Added in 1.3.0
abstract boolean isQualitySupported(
    @NonNull Quality quality,
    @NonNull DynamicRange dynamicRange
)

Checks if the quality is supported for the input dynamic range.

Calling this method with one of the qualities contained in the returned list of getSupportedQualities will return true.

Possible values for quality include LOWEST, HIGHEST, SD, HD, FHD and UHD.

If this method is called with LOWEST or HIGHEST, it will return true except the case that none of the qualities can be supported.

When the dynamicRange is not fully specified, e.g. HDR_UNSPECIFIED_10_BIT, true will be returned if there is any matching fully specified dynamic range supporting the quality, otherwise false will be returned.

Parameters
@NonNull Quality quality

one of the quality constants.

@NonNull DynamicRange dynamicRange

the dynamicRange.

Returns
boolean

true if the quality is supported; false otherwise.

isStabilizationSupported

Added in 1.4.0
default boolean isStabilizationSupported()

Returns if video stabilization is supported on the device. Video stabilization can be turned on via setVideoStabilizationEnabled.

Not all recording sizes or frame rates may be supported for stabilization by a device that reports stabilization support. It is guaranteed that an output targeting a MediaRecorder or MediaCodec will be stabilized if the recording resolution is less than or equal to 1920 x 1080 (width less than or equal to 1920, height less than or equal to 1080), and the recording frame rate is less than or equal to 30fps. At other sizes, the video stabilization will not take effect.

Returns
boolean

true if CONTROL_VIDEO_STABILIZATION_MODE_ON is supported, otherwise false.