<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaExtension",
  "identifier" : "/documentation/MediaExtension/MEVideoDecoder",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "MediaExtension"
    ],
    "preciseIdentifier" : "c:objc(pl)MEVideoDecoder"
  },
  "title" : "MEVideoDecoder"
}
-->

# MEVideoDecoder

A protocol that defines the requirements for a video decoder.

```
protocol MEVideoDecoder : NSObjectProtocol
```

## Overview

This protocol provides an interface for <doc://com.apple.documentation/documentation/VideoToolbox> to create and interact with MediaExtension video decoders. `MEVideoDecoder` objects are always instantiated by Video Toolbox.

> Note:
> Developers who wish to build MediaExtension video decoders using this API need to include a <doc://com.apple.mediaextension/documentation/MediaExtension/video-decoder-entitlement>, provisioning profile, and specialized dictionary in their Info.plist file when building their extensions.
> 
> For more information, see [Entitlements](https://developer.apple.com/documentation/bundleresources/entitlements), [Create a development provisioning profile](https://developer.apple.com/help/account/manage-provisioning-profiles/create-a-development-provisioning-profile), and <doc://com.apple.mediaextension/documentation/MediaExtension/video-decoder-property-list-dictionary>

Once a user installs and runs the host app, embedded video decoder extensions become available to any app on the user’s system that opts in to using them by calling <doc://com.apple.documentation/documentation/VideoToolbox/VTRegisterProfessionalVideoWorkflowVideoDecoders()>.

> Important:
> `MEVideoDecoder` objects run in a sandboxed process without access to the filesystem, network, and other kernel resources.

The following sections explain the video decoder life cycle and performing decoding operations.

### Creating a video decoder

The first time Video Toolbox opens a decoder in a process, it creates an instance of the [`MEVideoDecoderExtension`](/documentation/MediaExtension/MEVideoDecoderExtension) factory object. It then calls its [`makeVideoDecoder(codecType:videoFormatDescription:videoDecoderSpecifications:pixelBufferManager:)`](/documentation/MediaExtension/MEVideoDecoderExtension/makeVideoDecoder(codecType:videoFormatDescription:videoDecoderSpecifications:pixelBufferManager:)) method for each decoder instance it needs. A decoder can evaluate the <doc://com.apple.documentation/documentation/CoreMedia/CMVideoCodecType> and <doc://com.apple.documentation/documentation/CoreMedia/CMVideoFormatDescription> that the system provides and confirm whether it can decode the specified format. If the decoder can’t decode the format, the factory routine needs to return the error [`MEError.Code.unsupportedFeature`](/documentation/MediaExtension/MEError-swift.struct/Code/unsupportedFeature). This sequence of events happens within <doc://com.apple.documentation/documentation/VideoToolbox/VTDecompressionSessionCreate(allocator:formatDescription:decoderSpecification:imageBufferAttributes:outputCallback:decompressionSessionOut:)>.

### Configuring a pixel buffer

Once instantiated, a decoder can call back to the provided [`MEVideoDecoderPixelBufferManager`](/documentation/MediaExtension/MEVideoDecoderPixelBufferManager) object to notify Video Toolbox of its output <doc://com.apple.documentation/documentation/CoreVideo/cvpixelbuffer-q2e> requirements. It can make these calls multiple times if output requirements change in response to properties receiving new values or due to observed bitstream characteristics.

### Querying and setting properties

Properties can receive queries or new values on the decoder at any time, before, during or after frame decode, unless otherwise noted. These calls generally correspond to <doc://com.apple.documentation/documentation/VideoToolbox/VTSessionSetProperty(_:key:value:)> and <doc://com.apple.documentation/documentation/VideoToolbox/VTSessionCopyProperty(_:key:allocator:valueOut:)> calls on the <doc://com.apple.documentation/documentation/VideoToolbox/VTDecompressionSession> which opened the decoder. There may be cases where Video Toolbox directly sets or queries properties as well.

### Decoding frames

The framework serializes calls to [`decodeFrame(from:options:completionHandler:)`](/documentation/MediaExtension/MEVideoDecoder/decodeFrame(from:options:completionHandler:)) and doesn’t send a new frame to the decoder until the last [`decodeFrame(from:options:completionHandler:)`](/documentation/MediaExtension/MEVideoDecoder/decodeFrame(from:options:completionHandler:)) returns, unless decoding happens asynchronously. These calls correspond to <doc://com.apple.documentation/documentation/VideoToolbox/VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:outputHandler:)> calls on the owning `VTDecompressionSession`.

Video decoders need to write their output frames into <doc://com.apple.documentation/documentation/CoreVideo/cvpixelbuffer-q2e> objects allocated by the [`MEVideoDecoderPixelBufferManager`](/documentation/MediaExtension/MEVideoDecoderPixelBufferManager) object’s [`makePixelBuffer()`](/documentation/MediaExtension/MEVideoDecoderPixelBufferManager/makePixelBuffer()) method. Obtaining pixel buffers from any other source may degrade performance or result in other issues.

If the decoder’s internal decoding queue is full and it can’t decode more frames, its [`isReadyForMoreMediaData`](/documentation/MediaExtension/MEVideoDecoder/isReadyForMoreMediaData) property value returns <doc://com.apple.documentation/documentation/Swift/false>. It returns <doc://com.apple.documentation/documentation/Swift/true> once the decoder can start accepting new frames again. This generally occurs after an earlier asynchronous frame completes.

### Handling format description changes

If a change occurs in the format description on incoming <doc://com.apple.documentation/documentation/CoreMedia/CMSampleBuffer> objects, <doc://com.apple.documentation/documentation/VideoToolbox> calls [`canAccept(_:)`](/documentation/MediaExtension/MEVideoDecoder/canAccept(_:)) to confirm whether the decoder can transition to the new format description. If that method response is <doc://com.apple.documentation/documentation/Swift/false>, the system usually closes the decoder and creates a new instance for the changed format description. A call to <doc://com.apple.documentation/documentation/VideoToolbox/VTDecompressionSessionCanAcceptFormatDescription(_:formatDescription:)> can trigger a call of [`canAccept(_:)`](/documentation/MediaExtension/MEVideoDecoder/canAccept(_:)), or Video Toolbox calls this method if it sees a format description change on incoming `CMSampleBufferRef` objects.

## Topics

### Inspecting a video decoder

[`contentHasInterframeDependencies`](/documentation/MediaExtension/MEVideoDecoder/contentHasInterframeDependencies)

A Boolean that specifies whether the content has interframe dependencies, if the decoder knows.

[`recommendedThreadCount`](/documentation/MediaExtension/MEVideoDecoder/recommendedThreadCount)

The recommended number of threads for the decoder to use.

[`actualThreadCount`](/documentation/MediaExtension/MEVideoDecoder/actualThreadCount)

The actual number of threads the decoder uses.

[`supportedPixelFormatsOrderedByQuality`](/documentation/MediaExtension/MEVideoDecoder/supportedPixelFormatsOrderedByQuality)

Provides hints about quality tradeoffs between pixel formats.

[`reducedResolution`](/documentation/MediaExtension/MEVideoDecoder/reducedResolution)

A request to decode at a lower resolution than full-size.

[`pixelFormatsWithReducedResolutionDecodeSupport`](/documentation/MediaExtension/MEVideoDecoder/pixelFormatsWithReducedResolutionDecodeSupport)

Provides a list of output pixel formats where the decoder supports reduced resolution decoding.

[`producesRAWOutput`](/documentation/MediaExtension/MEVideoDecoder/producesRAWOutput)

Indicates whether the decoder produces RAW output which requires the use of a RAW processor.

[`readyForMoreMediaData`](/documentation/MediaExtension/MEVideoDecoder/isReadyForMoreMediaData)

A Boolean value that indicates the readiness of the decoder to accept more sample buffers.

### Decoding frames

[`-  canAcceptFormatDescription:`](/documentation/MediaExtension/MEVideoDecoder/canAccept(_:))

Asks the extension whether the decoder can decode frames with the format description that you specify.

[`-  decodeFrameFromSampleBuffer:options:completionHandler:`](/documentation/MediaExtension/MEVideoDecoder/decodeFrame(from:options:completionHandler:))

Requests the extension to decode a video frame.

[`MEDecodeFrameStatus`](/documentation/MediaExtension/MEDecodeFrameStatus)

A type that represents a non-error status related to a frame decode operation.

### Notifications

[`MEVideoDecoderReadyForMoreMediaDataDidChangeNotification`](/documentation/MediaExtension/MEVideoDecoderReadyForMoreMediaDataDidChangeNotification)

A notification that indicates a change to the decoder’s readiness to process additional media data.

### Extension requirements

[Video decoder property list dictionary](/documentation/MediaExtension/video-decoder-property-list-dictionary)

Include a property list dictionary to describe a video decoder.

[Video decoder entitlement](/documentation/MediaExtension/video-decoder-entitlement)

Include an entitlement to indicate your extension is a MediaExtension video decoder.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)