<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VideoToolbox",
  "identifier" : "/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Video Toolbox"
    ],
    "preciseIdentifier" : "s:12VideoToolbox33VTDecompressionSessionDecodeFrame_12sampleBuffer5flags12infoFlagsOut17completionHandlers5Int32VSo0cD3Refa_So08CMSamplehP0aSo08VTDecodefK0VSpySo0r4InfoK0VGSgyAH_APSo08CVBufferP0aSgSay9CoreMedia08CMTaggedH0VGSgSo6CMTimeaA0_tYbctF"
  },
  "title" : "VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:completionHandler:)"
}
-->

# VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:completionHandler:)

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

```
func VTDecompressionSessionDecodeFrame(_ session: VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags decodeFlags: VTDecodeFrameFlags, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?, completionHandler: @escaping @Sendable (OSStatus, VTDecodeInfoFlags, CVImageBuffer?, [CMTaggedBuffer]?, CMTime, CMTime) -> Void) -> OSStatus
```

## Parameters

`session`

The decompression session.

`sampleBuffer`

A <doc://com.apple.documentation/documentation/CoreMedia/CMSampleBuffer> object containing one or more video frames.

`decodeFlags`

A bitfield of directives to the decompression session and decoder.

    The [`kVTDecodeFrame_EnableAsynchronousDecompression`](/documentation/VideoToolbox/VTDecodeFrameFlags/kVTDecodeFrame_EnableAsynchronousDecompression)     bit indicates whether the video decoder may decompress the frame asynchronously.

    The [`kVTDecodeFrame_EnableTemporalProcessing`](/documentation/VideoToolbox/VTDecodeFrameFlags/kVTDecodeFrame_EnableTemporalProcessing)     bit indicates whether the decoder may delay calls to the output callback so as to enable processing in temporal (display) order.

    If both flags are clear, the decompression shall complete and your output callback function will be called before     `VTDecompressionSessionDecodeFrame`     returns. If either flag is set,     `VTDecompressionSessionDecodeFrame`     may return before the output callback function is called.

`infoFlagsOut`

A [`VTEncodeInfoFlags`](/documentation/VideoToolbox/VTEncodeInfoFlags) pointer to receive information about the decode operation.

    The [`asynchronous`](/documentation/VideoToolbox/VTDecodeInfoFlags/asynchronous)     bit may be set if the decode is (or was) running asynchronously.

    The [`frameDropped`](/documentation/VideoToolbox/VTDecodeInfoFlags/frameDropped)     bit may be set if the frame was dropped (synchronously).

    Pass     `NULL`     if you do not want to receive this information.

`completionHandler`

The closure to be called when decoding the frame is completed. If the VTDecompressionSessionDecodeFrame call returns an error, the closure will not be called.

## Return Value

An `OSStatus` value that indicates the result of the operation.

## Discussion

This function cannot be called with a session created with a [`VTDecompressionOutputCallbackRecord`](/documentation/VideoToolbox/VTDecompressionOutputCallbackRecord).

---

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)