How can I use AVCaptureSession to capture spatial video?
Generated on 1/6/2025
1 search
To use AVCaptureSession
to capture spatial video, you need to make a few specific changes to your existing video capture setup. Here's a summary of the steps involved:
-
Change the AV Capture Device: Use the built-in dual wide camera, as spatial video requires both the wide and ultra-wide cameras to be streaming simultaneously. This is specific to the iPhone 15 Pro.
-
Select a Supported Video Format: Iterate through the available video formats on the device to find one that supports spatial video. Once found, set it as the active format on the video device. Ensure to handle errors appropriately if no suitable format is found.
-
Enable Spatial Video Recording: Check if spatial video capture is supported on the device. If it is, set
isSpatialVideoCaptureEnabled
to true. Note that this feature is only available on the iPhone 15 Pro.
These steps abstract away the complexities of synchronization, camera calibration, encoding, and metadata writing, providing you with a fully formed spatial video file on disk.
For more detailed guidance, you can refer to the session Build compelling spatial photo and video experiences (06:12).