<!--
{
  "documentType" : "article",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/cvpixelbuffer-q2e",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CVPixelBuffer"
}
-->

# CVPixelBuffer

An image buffer that holds pixels in main memory.

## Discussion

A Core Video pixel buffer is an image buffer that holds pixels in main memory. Applications generating frames, compressing or decompressing video, or using Core Image can all make use of Core Video pixel buffers.

## Topics

### Creating pixel buffers

[`CVPixelBufferCreate(_:_:_:_:_:_:)`](/documentation/CoreVideo/CVPixelBufferCreate(_:_:_:_:_:_:))

Creates a single pixel buffer for a given size and pixel format.

[`CVPixelBufferCreateWithBytes(_:_:_:_:_:_:_:_:_:_:)`](/documentation/CoreVideo/CVPixelBufferCreateWithBytes(_:_:_:_:_:_:_:_:_:_:))

Creates a pixel buffer for a given size and pixel format containing data specified by a memory location.

[`CVPixelBufferCreateWithPlanarBytes(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)`](/documentation/CoreVideo/CVPixelBufferCreateWithPlanarBytes(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:))

Creates a single pixel buffer in planar format for a given size and pixel format containing data specified by a memory location.

[`CVPixelBufferCreateWithIOSurface(_:_:_:_:)`](/documentation/CoreVideo/CVPixelBufferCreateWithIOSurface(_:_:_:_:))

Creates a single pixel buffer for the IO surface that you specify.

### Inspecting Pixel Buffers

[`CVPixelBufferGetBaseAddress(_:)`](/documentation/CoreVideo/CVPixelBufferGetBaseAddress(_:))

Returns the base address of the pixel buffer.

[`CVPixelBufferGetBaseAddressOfPlane(_:_:)`](/documentation/CoreVideo/CVPixelBufferGetBaseAddressOfPlane(_:_:))

Returns the base address of the plane at the specified plane index.

[`CVPixelBufferGetBytesPerRow(_:)`](/documentation/CoreVideo/CVPixelBufferGetBytesPerRow(_:))

Returns the number of bytes per row of the pixel buffer.

[`CVPixelBufferGetBytesPerRowOfPlane(_:_:)`](/documentation/CoreVideo/CVPixelBufferGetBytesPerRowOfPlane(_:_:))

Returns the number of bytes per row for a plane at the specified index in the pixel buffer.

[`CVPixelBufferGetHeight(_:)`](/documentation/CoreVideo/CVPixelBufferGetHeight(_:))

Returns the height of the pixel buffer.

[`CVPixelBufferGetHeightOfPlane(_:_:)`](/documentation/CoreVideo/CVPixelBufferGetHeightOfPlane(_:_:))

Returns the height of the plane at planeIndex in the pixel buffer.

[`CVPixelBufferGetWidth(_:)`](/documentation/CoreVideo/CVPixelBufferGetWidth(_:))

Returns the width of the pixel buffer.

[`CVPixelBufferGetWidthOfPlane(_:_:)`](/documentation/CoreVideo/CVPixelBufferGetWidthOfPlane(_:_:))

Returns the width of the plane at a given index in the pixel buffer.

[`CVPixelBufferIsPlanar(_:)`](/documentation/CoreVideo/CVPixelBufferIsPlanar(_:))

Determines whether the pixel buffer is planar.

[`CVPixelBufferGetPlaneCount(_:)`](/documentation/CoreVideo/CVPixelBufferGetPlaneCount(_:))

Returns number of planes of the pixel buffer.

[`CVPixelBufferGetDataSize(_:)`](/documentation/CoreVideo/CVPixelBufferGetDataSize(_:))

Returns the data size for contiguous planes of the pixel buffer.

[`CVPixelBufferGetPixelFormatType(_:)`](/documentation/CoreVideo/CVPixelBufferGetPixelFormatType(_:))

Returns the pixel format type of the pixel buffer.

[`CVPixelBufferGetExtendedPixels(_:_:_:_:_:)`](/documentation/CoreVideo/CVPixelBufferGetExtendedPixels(_:_:_:_:_:))

Returns the amount of extended pixel padding in the pixel buffer.

[`CVPixelBufferGetIOSurface(_:)`](/documentation/CoreVideo/CVPixelBufferGetIOSurface(_:))

Returns the IOSurface backing the pixel buffer, or `NULL` if it is not backed by an IOSurface.

[`CVPixelBufferCreateResolvedAttributesDictionary(_:_:_:)`](/documentation/CoreVideo/CVPixelBufferCreateResolvedAttributesDictionary(_:_:_:))

Resolves an array of `CFDictionary` objects describing various pixel buffer attributes into a single dictionary.

[`CVPixelBufferIsCompatibleWithAttributes(_:_:)`](/documentation/CoreVideo/CVPixelBufferIsCompatibleWithAttributes(_:_:))

[`CVPixelBufferGetTypeID()`](/documentation/CoreVideo/CVPixelBufferGetTypeID())

Returns the Core Foundation type identifier of the pixel buffer type.

### Modifying Pixel Buffers

[`CVPixelBufferFillExtendedPixels(_:)`](/documentation/CoreVideo/CVPixelBufferFillExtendedPixels(_:))

Fills the extended pixels of the pixel buffer.

[`CVPixelBufferLockBaseAddress(_:_:)`](/documentation/CoreVideo/CVPixelBufferLockBaseAddress(_:_:))

Locks the base address of the pixel buffer.

[`CVPixelBufferUnlockBaseAddress(_:_:)`](/documentation/CoreVideo/CVPixelBufferUnlockBaseAddress(_:_:))

Unlocks the base address of the pixel buffer.

### Retaining and Releasing Pixel Buffers

[`CVPixelBufferRetain`](/documentation/CoreVideo/CVPixelBufferRetain)

Retains a pixel buffer.

[`CVPixelBufferRelease`](/documentation/CoreVideo/CVPixelBufferRelease)

Releases a pixel buffer.

### Protocols

[`CVPixelBufferRepresentable`](/documentation/CoreVideo/CVPixelBufferRepresentable)

CVPixelBufferRepresentable protocol is a sealed protocol intended to be implemented by the
types in CoreVideo framework. This protocol facilitates Swift types that wrap a value
of CVPixelBuffer type.

[`CVPixelBufferAttachmentKeyDefinitions`](/documentation/CoreVideo/CVPixelBufferAttachmentKeyDefinitions)

A namespace for pixel buffer attachment keys.

### Swift overlay types

[`CVReadOnlyPixelBuffer`](/documentation/CoreVideo/CVReadOnlyPixelBuffer)

CVReadOnlyPixelBuffer provides an immutable view of the pixel data held by the pixel buffer.

[`CVMutablePixelBuffer`](/documentation/CoreVideo/CVMutablePixelBuffer)

CVMutablePixelBuffer provides read-write access to the pixel data and attachments.

[`CVPixelBufferAttributes`](/documentation/CoreVideo/CVPixelBufferAttributes)

A partial set of pixel buffer creation attributes. This struct is useful for conveying partial requirements for
pixel buffers to clients. This struct makes all properties of `CVPixelBuffer/CreationAttributes` optional.

[`CVPixelBufferCreationAttributes`](/documentation/CoreVideo/CVPixelBufferCreationAttributes)

Attributes needed for creating a pixel buffer.

[`CVPixelBufferPadding`](/documentation/CoreVideo/CVPixelBufferPadding)

Padding pixels around the CVPixelBuffer

[`CVPixelBufferPlaneProperties`](/documentation/CoreVideo/CVPixelBufferPlaneProperties)

Properties of a plane of pixels in pixel buffer

[`CVProResRawMetadata`](/documentation/CoreVideo/CVProResRawMetadata)

Metadata associated with ProRes RAW images.

### Data Types

[`CVPixelBuffer`](/documentation/CoreVideo/CVPixelBuffer)

A reference to a Core Video pixel buffer object.

[`CVPixelBufferLockFlags`](/documentation/CoreVideo/CVPixelBufferLockFlags)

The flags to pass to [`CVPixelBufferLockBaseAddress(_:_:)`](/documentation/CoreVideo/CVPixelBufferLockBaseAddress(_:_:)) and [`CVPixelBufferUnlockBaseAddress(_:_:)`](/documentation/CoreVideo/CVPixelBufferUnlockBaseAddress(_:_:)).

[`CVPlanarComponentInfo`](/documentation/CoreVideo/CVPlanarComponentInfo)

A structure for describing planar components.

[`CVPlanarPixelBufferInfo`](/documentation/CoreVideo/CVPlanarPixelBufferInfo)

A structure for describing planar buffers.

[`CVPlanarPixelBufferInfo_YCbCrPlanar`](/documentation/CoreVideo/CVPlanarPixelBufferInfo_YCbCrPlanar)

A structure for describing YCbCr planar buffers.

[`CVPlanarPixelBufferInfo_YCbCrBiPlanar`](/documentation/CoreVideo/CVPlanarPixelBufferInfo_YCbCrBiPlanar)

A structure for describing YCbCr biplanar buffers.

### Callbacks

[`CVPixelBufferReleaseBytesCallback`](/documentation/CoreVideo/CVPixelBufferReleaseBytesCallback)

A type that defines a release callback function.

[`CVPixelBufferReleasePlanarBytesCallback`](/documentation/CoreVideo/CVPixelBufferReleasePlanarBytesCallback)

Defines a pointer to a pixel buffer release callback function, which is called when a pixel buffer created by [`CVPixelBufferCreateWithPlanarBytes(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)`](/documentation/CoreVideo/CVPixelBufferCreateWithPlanarBytes(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)) is released.

### Constants

[Pixel Buffer Attribute Keys](/documentation/CoreVideo/pixel-buffer-attribute-keys)

The attributes associated with a pixel buffer.

## See Also

  [Core Video Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/CoreVideo/CVProg_Intro/CVProg_Intro.html#//apple_ref/doc/uid/TP40001536)



---

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)