<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 10.2.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VideoToolbox",
  "identifier" : "/documentation/VideoToolbox/kVTCompressionPropertyKey_MultiPassStorage",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Video Toolbox"
    ],
    "preciseIdentifier" : "c:@kVTCompressionPropertyKey_MultiPassStorage"
  },
  "title" : "kVTCompressionPropertyKey_MultiPassStorage"
}
-->

# kVTCompressionPropertyKey_MultiPassStorage

A property key that enables multipass compression and provides storage for encoder private data.

```
let kVTCompressionPropertyKey_MultiPassStorage: CFString
```

## Discussion

Some video encoders support multipass encoding.  To determine whether a [VTCompressionSession](/documentation/VideoToolbox/VTCompressionSession-api-collection) supports multipass encoding, you can inspect the dictionary returned by [`VTSessionCopySupportedPropertyDictionary(_:supportedPropertyDictionaryOut:)`](/documentation/VideoToolbox/VTSessionCopySupportedPropertyDictionary(_:supportedPropertyDictionaryOut:)) to see if it contains [`kVTCompressionPropertyKey_MultiPassStorage`](/documentation/VideoToolbox/kVTCompressionPropertyKey_MultiPassStorage).

To enable multipass encoding, set the [`kVTCompressionPropertyKey_MultiPassStorage`](/documentation/VideoToolbox/kVTCompressionPropertyKey_MultiPassStorage) property to a [VTMultiPassStorage](/documentation/VideoToolbox/VTMultiPassStorage-api-collection) object, which you can create by calling [`VTMultiPassStorageCreate(allocator:fileURL:timeRange:options:multiPassStorageOut:)`](/documentation/VideoToolbox/VTMultiPassStorageCreate(allocator:fileURL:timeRange:options:multiPassStorageOut:)).  Then make one or more passes over the source frames.  Bracket each pass with a call to [`VTCompressionSessionBeginPass(_:flags:_:)`](/documentation/VideoToolbox/VTCompressionSessionBeginPass(_:flags:_:)) at the beginning and [`VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)`](/documentation/VideoToolbox/VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)) at the end.

In the first pass of multipass encoding, call [`VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)`](/documentation/VideoToolbox/VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)) for every source frame (just as in single-pass encoding).  At the end of every pass, call [`VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)`](/documentation/VideoToolbox/VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)).  This may take some time as the video encoder determines whether it can improve the encoding by performing another pass.  If the user cancels encoding during this time, call [`VTCompressionSessionInvalidate(_:)`](/documentation/VideoToolbox/VTCompressionSessionInvalidate(_:)) to interrupt the processing.  [`VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)`](/documentation/VideoToolbox/VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)) indicates through the `furtherPassesRequestedOut` argument whether the video encoder has requested another pass.  There is no particular limit on the number of passes the video encoder may request, but the client is free to disregard this request and use the last-emitted set of frames.

If `furtherPassesRequestedOut` is set to <doc://com.apple.documentation/documentation/Swift/true> and you want to perform another pass, call [`VTCompressionSessionGetTimeRangesForNextPass(_:timeRangeCountOut:timeRangeArrayOut:)`](/documentation/VideoToolbox/VTCompressionSessionGetTimeRangesForNextPass(_:timeRangeCountOut:timeRangeArrayOut:)) to determine the time ranges for the next pass.  Only the source frames within these time ranges need to be passed to [`VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)`](/documentation/VideoToolbox/VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)); the video encoder is satisfied with the already-emitted compressed frames outside these ranges, and they can be kept for the final output.

In second and successive passes, you must pass identical source frames, frame properties, and timestamps to [`VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)`](/documentation/VideoToolbox/VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)) as in the first pass, with the exception that frames not in the requested time ranges should be skipped.

You can create and use a [VTFrameSilo](/documentation/VideoToolbox/VTFrameSilo-api-collection) object to merge sequences of compressed frames across passes during multipass encoding.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)