CameraFormat

interface CameraFormat extends HybridObject

Represents a single format a Camera Device can capture in. A format specifies supported capture resolutions, frame rates, dynamic ranges, features, and pixel formats.

Video

Each CameraFormat specifies its native videoResolution, which is the resolution for video recordings (CameraVideoOutput) and frames streamed via a CameraFrameOutput.

The supportedFpsRanges array specifies all frame rate ranges for video, with maxFps being a convenient getter for the maximum supported frame rate range.

Lastly, the nativePixelFormat specifies the PixelFormat this CameraFormat uses for video frames. When a CameraFrameOutput is created with pixelFormat = 'native', it chooses this format.

Preview

Preview, which is a subclass of video, is also driven by video specifications. The Preview View's resolution is either the format's videoResolution, or the View's pixel size, whichever is smaller.

Similarly, the selected FPS (supportedFpsRanges) also drives the Preview's frame rate, capped to the screen's refresh rate.

Photo

A CameraFormat also lists its supportedPhotoResolutions, with the maximum of those being photoResolution - the default for a CameraPhotoOutput.

The isHighestPhotoFormat property is a convenience getter to find out if this CameraFormat is the format with the highest maximum photo resolution, on the CameraDevice.

Depth

Each CameraFormat lists its supported depthDataFormats, which are CameraFormats on their own to be used with a CameraDepthFrameOutput.

Properties

autoFocusSystem

readonly autoFocusSystem: AutoFocusSystem

The autofocus system used by this format.


depthDataFormats

readonly depthDataFormats: CameraFormat[]

Depth formats that can be paired with this format for depth delivery in a CameraDepthFrameOutput.


fieldOfView

readonly fieldOfView: number

The horizontal field of view, in degrees.


fieldOfViewDistortionCorrected

readonly fieldOfViewDistortionCorrected: number

The distortion-corrected horizontal field of view, in degrees.


isHighestPhotoFormat

readonly isHighestPhotoFormat: boolean

Whether this format has the highest available photo resolution on the current CameraDevice.


isVideoBinned

readonly isVideoBinned: boolean

Whether this format uses video binning.

Binning combines sensor pixels to improve low-light sensitivity.


maxExposureDuration

readonly maxExposureDuration: number

The maximum exposure duration supported by this format, in seconds.


maxFps

readonly maxFps: number

The highest supported frame rate out of supportedFpsRanges for this format, in FPS.


maxISO

readonly maxISO: number

The maximum ISO value supported by this format.


maxZoomFactor

readonly maxZoomFactor: number

The highest zoom factor supported by this format.


mediaType

readonly mediaType: MediaType

The media type of this format. Typical values are 'video' or 'depth'.


minExposureDuration

readonly minExposureDuration: number

The minimum exposure duration supported by this format, in seconds.


minISO

readonly minISO: number

The minimum ISO value supported by this format.


nativePixelFormat

readonly nativePixelFormat: PixelFormat

Get the CameraFormat's native PixelFormat.

Choosing to record or stream in any other format (e.g. in a CameraFrameOutput) might involve conversion overhead, so it is most efficient to stream in this format here.


photoResolution

readonly photoResolution: Size

The highest photo resolution out of supportedPhotoResolutions available in this CameraFormat.

This is the default resolution used by a CameraPhotoOutput.


recommendedExposureRange?

iOS
readonly optional recommendedExposureRange: Range

A system-recommended exposure-bias range, if available.


recommendedZoomRange?

iOS
readonly optional recommendedZoomRange: Range

A system-recommended zoom range for best image quality, if available.


secondaryNativeResolutionZoomFactors

iOS
readonly secondaryNativeResolutionZoomFactors: number[]

Zoom factors where the camera can switch to another native sensor resolution without upscaling.


supportedColorSpaces

readonly supportedColorSpaces: ColorSpace[]

All color spaces supported by this format.


supportedFpsRanges

readonly supportedFpsRanges: Range[]

All frame-rate ranges supported by this format, in FPS.


supportedPhotoContainerFormats

readonly supportedPhotoContainerFormats: PhotoContainerFormat[]

Get a list of all PhotoContainerFormats this CameraFormat supports.

Typically, this always contains at least 'jpeg'. If this list also contains 'dng', you may select this format to capture RAW photos.


supportedPhotoResolutions

readonly supportedPhotoResolutions: Size[]

All photo resolutions supported by this format.

The highest available photo resolution is exposed under photoResolution.


supportedZoomRangesForDepthDataDelivery

iOS
readonly supportedZoomRangesForDepthDataDelivery: Range[]

Zoom ranges where depth data delivery is supported.


supportsAutoFps

readonly supportsAutoFps: boolean

Whether this format supports automatic frame-rate adjustment.

Automatic FPS allows the Camera to throttle its frame rate in low light conditions to allow for better exposed images.


supportsMultiCam

readonly supportsMultiCam: boolean

Gets whether this CameraFormat supports being used in a multi-cam CameraSession.

Note

Some high-resolution formats may not be supported in multi-cam sessions because of bandwidth limitations.


supportsPhotoHDR

readonly supportsPhotoHDR: boolean

Whether this format supports HDR for photo capture.


supportsVideoHDR

readonly supportsVideoHDR: boolean

Whether this format supports HDR for video streams.

Note

On iOS, supportsVideoHDR refers to "EDR", not HDR. A true 10-bit HDR format can be identified via its nativePixelFormat, which should be a 10-bit YUV format like 'yuv-420-10-bit-full'.


videoResolution

readonly videoResolution: Size

The native video resolution of this format. This drives video recording, frame output, and preview size.


zoomFactorUpscaleThreshold

readonly zoomFactorUpscaleThreshold: number

The zoom factor where digital upscaling starts. Below this threshold, zoom usually stays at native quality.

Methods

supportsVideoStabilizationMode()

supportsVideoStabilizationMode(mode: VideoStabilizationMode): boolean

Gets whether this format supports the given VideoStabilizationMode.