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

# VTCompressionOutputCallback

A callback for the system to invoke when it’s finished compressing a frame.

```
typealias VTCompressionOutputCallback = (UnsafeMutableRawPointer?, UnsafeMutableRawPointer?, OSStatus, VTEncodeInfoFlags, CMSampleBuffer?) -> Void
```

## Parameters

`outputCallbackRefCon`

The callback’s reference value.

`sourceFrameRefCon`

The frame’s reference value, copied from the `sourceFrameRefCon` argument to [`VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)`](/documentation/VideoToolbox/VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)).

`status`

`noErr` if compression was successful; an error code if compression wasn’t successful.

`infoFlags`

Contains information about the encode operation.

    The [`asynchronous`](/documentation/VideoToolbox/VTEncodeInfoFlags/asynchronous)     bit may be set if the encode ran asynchronously.

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

`sampleBuffer`

Contains the compressed frame if compression was successful and the frame wasn’t dropped; otherwise, `NULL`.

## Discussion

When you create a compression session, you pass in a callback function to be called for compressed frames.  This function is called in decode order (which is not necessarily the same as display order).

---

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)