how to generate spatial video file

Generated on 3/3/2025

1 search

To generate a spatial video file, you can follow the steps outlined in the session "Build compelling spatial photo and video experiences" from WWDC 2024. Here's a summary of the process:

  1. Set Up AV Capture Session:

    • Create an AV capture session.
    • Add an AV capture device, setting it to the default system preferred camera.
    • Add an input and an output to the session.
    • Commit the configuration and start running the session.
  2. Enable Spatial Video Recording:

    • Change the AV capture device to use the built-in dual wide camera, as spatial video requires both the wide and ultra-wide cameras to stream simultaneously.
    • Select a video format that supports spatial video by iterating through the formats in the video device and checking if isSpatialVideoCaptureSupported is true.
    • Set isSpatialVideoCaptureEnabled to true if spatial video capture is supported. Note that this feature is only available on the iPhone 15 Pro.
  3. Handle Output:

    • The movie file output will manage the output and write the spatial video file to disk. The complexity of synchronization, camera calibration, encoding, and metadata writing is abstracted away, providing a fully formed spatial video file.
  4. Enhance Quality:

    • For improved video stabilization, set the preferred video stabilization mode to cinematic extended enhanced.

For more detailed information, you can refer to the session Build compelling spatial photo and video experiences (04:33).