<!--
{
  "documentType" : "article",
  "framework" : "VideoToolbox",
  "identifier" : "/documentation/VideoToolbox/VTDecompressionSession-api-collection",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "VTDecompressionSession"
}
-->

# VTDecompressionSession

An object that decompresses video data.

## Discussion

A decompression session supports the decompression of a sequence of video frames. Here’s the basic workflow:

1. Create a decompression session by calling [`VTDecompressionSessionCreate(allocator:formatDescription:decoderSpecification:imageBufferAttributes:outputCallback:decompressionSessionOut:)`](/documentation/VideoToolbox/VTDecompressionSessionCreate(allocator:formatDescription:decoderSpecification:imageBufferAttributes:outputCallback:decompressionSessionOut:)).
2. Optionally, configure the session with your desired [Decompression Properties](/documentation/VideoToolbox/decompression-properties) by calling [`VTSessionSetProperty(_:key:value:)`](/documentation/VideoToolbox/VTSessionSetProperty(_:key:value:)) or [`VTSessionSetProperties(_:propertyDictionary:)`](/documentation/VideoToolbox/VTSessionSetProperties(_:propertyDictionary:)).
3. Decode video frames using [`VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameRefcon:infoFlagsOut:)`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameRefcon:infoFlagsOut:)).
4. When you finish with the decompression session, call [`VTDecompressionSessionInvalidate(_:)`](/documentation/VideoToolbox/VTDecompressionSessionInvalidate(_:)) to tear it down, and call <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> to free its memory.

## Topics

### Creating a Session

[`func VTDecompressionSessionCreate(allocator: CFAllocator?, formatDescription: CMVideoFormatDescription, decoderSpecification: CFDictionary?, imageBufferAttributes: CFDictionary?, decompressionSessionOut: UnsafeMutablePointer<VTDecompressionSession?>) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionCreate(allocator:formatDescription:decoderSpecification:imageBufferAttributes:decompressionSessionOut:))

[`func VTDecompressionSessionCreate(allocator: CFAllocator?, formatDescription: CMVideoFormatDescription, decoderSpecification: CFDictionary?, imageBufferAttributes: CFDictionary?, outputCallback: UnsafePointer<VTDecompressionOutputCallbackRecord>?, decompressionSessionOut: UnsafeMutablePointer<VTDecompressionSession?>) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionCreate(allocator:formatDescription:decoderSpecification:imageBufferAttributes:outputCallback:decompressionSessionOut:))

Creates a session for decompressing video frames.

### Configuring a Session

[Decompression Properties](/documentation/VideoToolbox/decompression-properties)

Properties used to configure a VideoToolbox decompression session.

[`func VTVideoDecoderExtensionProperties(CMFormatDescription) throws -> [VTExtensionPropertiesKey : Any]`](/documentation/VideoToolbox/VTVideoDecoderExtensionProperties(_:))

### Decoding Frames

[`func VTDecompressionSessionCanAcceptFormatDescription(VTDecompressionSession, formatDescription: CMFormatDescription) -> Bool`](/documentation/VideoToolbox/VTDecompressionSessionCanAcceptFormatDescription(_:formatDescription:))

Indicates whether the session can decode frames with the given format description.

[`func VTDecompressionSessionDecodeFrame(VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags: VTDecodeFrameFlags, frameRefcon: UnsafeMutableRawPointer?, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameRefcon:infoFlagsOut:))

Decompresses a video frame.

[`func VTDecompressionSessionDecodeFrame(VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags: VTDecodeFrameFlags, frameOptions: CFDictionary?, frameRefcon: UnsafeMutableRawPointer?, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameOptions:frameRefcon:infoFlagsOut:))

[`func VTDecompressionSessionDecodeFrame(VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags: VTDecodeFrameFlags, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?, outputHandler: VTDecompressionOutputHandler) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:outputHandler:))

Decompresses a video frame and invokes the output callback when the decompression completes.

[`func VTDecompressionSessionDecodeFrame(VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags: VTDecodeFrameFlags, frameOptions: CFDictionary?, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?, outputHandler: VTDecompressionOutputHandler) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameOptions:infoFlagsOut:outputHandler:))

[`func VTDecompressionSessionDecodeFrame(VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags: VTDecodeFrameFlags, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?, completionHandler: (OSStatus, VTDecodeInfoFlags, CVImageBuffer?, [CMTaggedBuffer]?, CMTime, CMTime) -> Void) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:completionHandler:))

Decompresses a video frame and calls the provided output closure when decompression completes.

[`func VTDecompressionSessionFinishDelayedFrames(VTDecompressionSession) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionFinishDelayedFrames(_:))

Directs the decompression session to emit all delayed frames.

[`func VTDecompressionSessionWaitForAsynchronousFrames(VTDecompressionSession) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionWaitForAsynchronousFrames(_:))

Waits for any and all outstanding asynchronous and delayed frames to complete, then returns.

[`func VTDecompressionSessionCopyBlackPixelBuffer(VTDecompressionSession, pixelBufferOut: UnsafeMutablePointer<CVPixelBuffer?>) -> OSStatus`](/documentation/VideoToolbox/VTDecompressionSessionCopyBlackPixelBuffer(_:pixelBufferOut:))

Copies a black pixel buffer from the decompression session.

### Decoding Multi-Image Frames

[`func VTIsStereoMVHEVCDecodeSupported() -> Bool`](/documentation/VideoToolbox/VTIsStereoMVHEVCDecodeSupported())

Returns a Boolean value that indicates whether the system supports MV-HEVC decoding.

[`extern OSStatus VTDecompressionSessionSetMultiImageCallback(VTDecompressionSessionRef decompressionSession, VTDecompressionOutputMultiImageCallback outputMultiImageCallback, void *outputMultiImageRefcon);`](/documentation/VideoToolbox/VTDecompressionSessionSetMultiImageCallback)

Provides a callback capable of receiving multiple images for individual frame decoding requests.

[`extern OSStatus VTDecompressionSessionDecodeFrameWithMultiImageCapableOutputHandler(VTDecompressionSessionRef session, CMSampleBufferRef sampleBuffer, VTDecodeFrameFlags decodeFlags, VTDecodeInfoFlags *infoFlagsOut, VTDecompressionMultiImageCapableOutputHandler multiImageCapableOutputHandler);`](/documentation/VideoToolbox/VTDecompressionSessionDecodeFrameWithMultiImageCapableOutputHandler)

Decompresses a multi-image frame and calls the specified output handler upon completion.

[`typealias VTDecompressionMultiImageCapableOutputHandler`](/documentation/VideoToolbox/VTDecompressionMultiImageCapableOutputHandler)

A type alias for callback that the system invokes when it finishes decompressing a frame.

### Invalidating a Session

[`func VTDecompressionSessionInvalidate(VTDecompressionSession)`](/documentation/VideoToolbox/VTDecompressionSessionInvalidate(_:))

Tears down a decompression session.

### Accessing the Type Identifier

[`func VTDecompressionSessionGetTypeID() -> CFTypeID`](/documentation/VideoToolbox/VTDecompressionSessionGetTypeID())

Returns the Core Foundation type identifier for the decompression session.

### Data Types

[`class VTDecompressionSession`](/documentation/VideoToolbox/VTDecompressionSession)

A reference to a decompression session.

[`struct VTDecodeFrameFlags`](/documentation/VideoToolbox/VTDecodeFrameFlags)

Flags to pass to a decompression session and the video decoder.

[`struct VTDecodeInfoFlags`](/documentation/VideoToolbox/VTDecodeInfoFlags)

Flags that provide information about the status of a decode operation.

[`typealias VTDecompressionOutputCallback`](/documentation/VideoToolbox/VTDecompressionOutputCallback)

The prototype for the callback invoked when frame decompression is complete.

[`struct VTDecompressionOutputCallbackRecord`](/documentation/VideoToolbox/VTDecompressionOutputCallbackRecord)

[`typealias VTDecompressionOutputHandler`](/documentation/VideoToolbox/VTDecompressionOutputHandler)

The prototype for the block invoked when frame decompression is complete.



---

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)