CameraFormat
interface CameraFormat extends HybridObjectRepresents 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: AutoFocusSystemThe 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: numberThe horizontal field of view, in degrees.
fieldOfViewDistortionCorrected
readonly fieldOfViewDistortionCorrected: numberThe distortion-corrected horizontal field of view, in degrees.
isHighestPhotoFormat
readonly isHighestPhotoFormat: booleanWhether this format has the highest available photo resolution
on the current CameraDevice.
isVideoBinned
readonly isVideoBinned: booleanWhether this format uses video binning.
Binning combines sensor pixels to improve low-light sensitivity.
maxExposureDuration
readonly maxExposureDuration: numberThe maximum exposure duration supported by this format, in seconds.
maxFps
readonly maxFps: numberThe highest supported frame rate out of
supportedFpsRanges for this
format, in FPS.
maxISO
readonly maxISO: numberThe maximum ISO value supported by this format.
maxZoomFactor
readonly maxZoomFactor: numberThe highest zoom factor supported by this format.
mediaType
readonly mediaType: MediaTypeThe media type of this format.
Typical values are 'video'
or 'depth'.
minExposureDuration
readonly minExposureDuration: numberThe minimum exposure duration supported by this format, in seconds.
minISO
readonly minISO: numberThe minimum ISO value supported by this format.
nativePixelFormat
readonly nativePixelFormat: PixelFormatGet 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: SizeThe highest photo resolution out of
supportedPhotoResolutions
available in this CameraFormat.
This is the default resolution used by a CameraPhotoOutput.
recommendedExposureRange?
readonly optional recommendedExposureRange: RangeA system-recommended exposure-bias range, if available.
recommendedZoomRange?
readonly optional recommendedZoomRange: RangeA system-recommended zoom range for best image quality, if available.
secondaryNativeResolutionZoomFactors
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
readonly supportedZoomRangesForDepthDataDelivery: Range[]Zoom ranges where depth data delivery is supported.
supportsAutoFps
readonly supportsAutoFps: booleanWhether 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: booleanGets 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: booleanWhether this format supports HDR for photo capture.
supportsVideoHDR
readonly supportsVideoHDR: booleanWhether 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: SizeThe native video resolution of this format. This drives video recording, frame output, and preview size.
zoomFactorUpscaleThreshold
readonly zoomFactorUpscaleThreshold: numberThe zoom factor where digital upscaling starts. Below this threshold, zoom usually stays at native quality.
Methods
supportsVideoStabilizationMode()
supportsVideoStabilizationMode(mode: VideoStabilizationMode): booleanGets whether this format supports the given
VideoStabilizationMode.