AVCapturePhotoOutput
A capture output for still image, Live Photos, and other photography workflows.
Declaration
class AVCapturePhotoOutputMentioned in
Overview
AVCapturePhotoOutput provides an interface for capture workflows related to still photography. In addition to basic capture of still images, a photo output supports RAW-format capture, bracketed capture of multiple images, Live Photos, and wide-gamut color. You can output captured photos in a variety of formats and codecs, including RAW format DNG files, HEVC format HEIF files, and JPEG files.
To capture photos with the AVCapturePhotoOutput class, follow these steps:
Create an AVCapturePhotoOutput object. Use its properties to determine supported capture settings and to enable certain features (for example, whether to capture Live Photos).
Create and configure an AVCapturePhotoSettings object to choose features and settings for a specific capture (for example, whether to enable image stabilization or flash).
Capture an image by passing your photo settings object to the capturePhoto(with:delegate:) method along with a delegate object implementing the AVCapturePhotoCaptureDelegate protocol. The photo capture output then calls your delegate to notify you of significant events during the capture process.
Some photo capture settings, such as the flashMode property, include options for automatic behavior. For such settings, the photo output determines whether to use that feature at the moment of capture—you don’t know when requesting a capture whether the feature will be enabled when the capture completes. When the photo capture output calls your AVCapturePhotoCaptureDelegate methods with information about the completed or in-progress capture, it also provides an AVCaptureResolvedPhotoSettings object that details which automatic features are set for that capture. The resolved settings object’s uniqueID property matches the uniqueID value of the AVCapturePhotoSettings object you used to request capture.
Enabling certain photo features (Live Photo capture and high resolution capture) requires a reconfiguration of the capture render pipeline. To opt into these features, set the isHighResolutionCaptureEnabled, isLivePhotoCaptureEnabled, and isLivePhotoAutoTrimmingEnabled properties before calling your AVCaptureSession object’s startRunning() method. Changing any of these properties while the session is running disrupts the capture render pipeline: Live Photo captures in progress end immediately, unfulfilled photo requests abort, and video preview temporarily freezes.
Using a photo capture output adds other requirements to your AVCaptureSession object:
A capture session can’t support both Live Photo capture and movie file output. If your capture session includes an AVCaptureMovieFileOutput object, the isLivePhotoCaptureSupported property becomes false. (As an alternative, you can use the AVCaptureVideoDataOutput class to output video buffers at the same resolution as a simultaneous Live Photo capture).
A capture session can’t contain both an AVCapturePhotoOutput object and an AVCaptureStillImageOutput object. The AVCapturePhotoOutput class includes all functionality of (and deprecates) the AVCaptureStillImageOutput class.
The AVCapturePhotoOutput class implicitly supports wide-gamut color photography. If the source AVCaptureDevice object’s activeColorSpace value is AVCaptureColorSpace.P3_D65, the capture output produces photos with wide color information (unless your AVCapturePhotoSettings object specifies an output format that doesn’t support wide color).
Topics
Creating a photo output
Capturing a photo
Managing responsive capture
captureReadinessAVCapturePhotoOutput.CaptureReadinessisAutoDeferredPhotoDeliveryEnabledisAutoDeferredPhotoDeliverySupportedisFastCapturePrioritizationSupportedisFastCapturePrioritizationEnabledisResponsiveCaptureSupportedisResponsiveCaptureEnabledisZeroShutterLagSupportedisZeroShutterLagEnabled
Determining supported pixel formats
availablePhotoPixelFormatTypesavailableRawPhotoPixelFormatTypessupportedPhotoPixelFormatTypes(for:)supportedRawPhotoPixelFormatTypes(for:)isAppleProRAWPixelFormat(_:)isBayerRAWPixelFormat(_:)
Determining supported codec types
Determining supported file types
Suppressing the shutter sound
Configuring ProRAW support
Determining available settings
isContentAwareDistortionCorrectionSupportedisContentAwareDistortionCorrectionEnabledisLensStabilizationDuringBracketedCaptureSupportedmaxBracketedCapturePhotoCountsupportedFlashModesisAutoRedEyeReductionSupported
Monitoring the visible scene
Configuring high-resolution still capture
Configuring Live Photo capture
isLivePhotoCaptureSupportedisLivePhotoCaptureEnabledisLivePhotoCaptureSuspendedpreservesLivePhotoCaptureSuspendedOnSessionStopisLivePhotoAutoTrimmingEnabledavailableLivePhotoVideoCodecTypes
Configuring depth data capture
Configuring Portrait Effects matte capture
Configuring constant color
Configuring orientation compensation
Configuring virtual device capture
isVirtualDeviceFusionSupportedisVirtualDeviceConstituentPhotoDeliverySupportedisVirtualDeviceConstituentPhotoDeliveryEnabled
Preparing for resource-intensive captures
Getting segmentation mattes
Setting the capture prioritization
Determining calibration data delivery support
Deprecated
Instance properties
Instance methods
See Also
Photo capture
Capturing consistent color imagesCapturing still and Live PhotosCapturing photos in RAW and Apple ProRAW formatsSupporting Continuity Camera in Your Mac AppAVCapturePhotoAVCaptureDeferredPhotoProxyAVCapturePhotoCaptureDelegateAVCapturePhotoOutputReadinessCoordinatorAVCapturePhotoOutputReadinessCoordinatorDelegateAVCaptureStillImageOutput