---
title: "CMSampleBufferGetImageBuffer(_:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmsamplebuffergetimagebuffer(_:)"
---

# CMSampleBufferGetImageBuffer(_:)

Returns an image buffer that contains the media data.

## Declaration

```swift
func CMSampleBufferGetImageBuffer(_ sbuf: CMSampleBuffer) -> CVImageBuffer?
```

## Parameters

- `sbuf`: The CMSampleBuffer being interrogated.

## Return Value

Return Value CVImageBuffer of media data. The result will be NULL if the CMSampleBuffer does not contain a CVImageBuffer, if the CMSampleBuffer contains a CMBlockBuffer, or if there is some other error.

## Discussion

Discussion The caller doesn’t own the returned buffer, and must retain it explicitly if the caller needs to maintain a reference to it.

## See Also

### Modifying Sample Buffers

- [CMSampleBufferGetDataBuffer(_:)](coremedia/cmsamplebuffergetdatabuffer(_:).md)
- [CMSampleBufferSetDataBuffer(_:newValue:)](coremedia/cmsamplebuffersetdatabuffer(_:newvalue:).md)
- [CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(_:bufferListSizeNeededOut:bufferListOut:bufferListSize:blockBufferAllocator:blockBufferMemoryAllocator:flags:blockBufferOut:)](coremedia/cmsamplebuffergetaudiobufferlistwithretainedblockbuffer(_:bufferlistsizeneededout:bufferlistout:bufferlistsize:blockbufferallocator:blockbuffermemoryallocator:flags:blockbufferout:).md)
- [CMSampleBufferSetDataBufferFromAudioBufferList(_:blockBufferAllocator:blockBufferMemoryAllocator:flags:bufferList:)](coremedia/cmsamplebuffersetdatabufferfromaudiobufferlist(_:blockbufferallocator:blockbuffermemoryallocator:flags:bufferlist:).md)
- [CMSampleBufferCopyPCMDataIntoAudioBufferList(_:at:frameCount:into:)](coremedia/cmsamplebuffercopypcmdataintoaudiobufferlist(_:at:framecount:into:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptions(_:allocatedSize:packetDescriptionsOut:packetDescriptionsSizeNeededOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptions(_:allocatedsize:packetdescriptionsout:packetdescriptionssizeneededout:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_:packetDescriptionsPointerOut:sizeOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptionsptr(_:packetdescriptionspointerout:sizeout:).md)
