<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaExtension",
  "identifier" : "/documentation/MediaExtension/MEVideoDecoder/decodeFrame(from:options:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MediaExtension"
    ],
    "preciseIdentifier" : "c:objc(pl)MEVideoDecoder(im)decodeFrameFromSampleBuffer:options:completionHandler:"
  },
  "title" : "decodeFrame(from:options:completionHandler:)"
}
-->

# decodeFrame(from:options:completionHandler:)

Requests the extension to decode a video frame.

```
func decodeFrame(from sampleBuffer: CMSampleBuffer, options: MEDecodeFrameOptions, completionHandler: @escaping @Sendable (CVImageBuffer?, MEDecodeFrameStatus, (any Error)?) -> Void)
```

## Parameters

`sampleBuffer`

A sample buffer that contains one video frame.

`options`

Specific decode options for the frame.

`completionHandler`

The completion block to execute when the decode operation finishes.

## Discussion

This method calls the completion handler for every sample buffer frame when decoding completes, but not necessarily in display order. The completion handler receives a decoded pixel buffer, a decode status that indicates a frame dropped, or an error. Use [`MEVideoDecoderPixelBufferManager`](/documentation/MediaExtension/MEVideoDecoderPixelBufferManager) to allocate an image buffer. If an error occurs that’s external to [`MediaExtensionErrorDomain`](/documentation/MediaExtension/MediaExtensionErrorDomain), the <doc://com.apple.documentation/documentation/VideoToolbox/VTDecompressionSession> receives it as <doc://com.apple.documentation/documentation/VideoToolbox/kVTVideoDecoderUnknownErr>.

---

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)