---
title: AVSampleBufferGenerator
framework: avfoundation
role: symbol
role_heading: Class
path: avfoundation/avsamplebuffergenerator
---

# AVSampleBufferGenerator

An object that creates sample buffers.

## Declaration

```swift
class AVSampleBufferGenerator
```

## Overview

Overview Each request for CMSampleBuffer creation is described in an AVSampleBufferRequest object. The CMSampleBuffer opaque objects are returned synchronously. If requested, sample data may be loaded asynchronously (depending on file format support).

## Topics

### Creating sample buffer generators

- [init(asset:timebase:)](avfoundation/avsamplebuffergenerator/init(asset:timebase:).md)

### Creating a sample buffer

- [makeSampleBuffer(for:)](avfoundation/avsamplebuffergenerator/makesamplebuffer(for:).md)
- [makeBatch()](avfoundation/avsamplebuffergenerator/makebatch().md)
- [makeSampleBuffer(for:addTo:)](avfoundation/avsamplebuffergenerator/makesamplebuffer(for:addto:).md)
- [createSampleBuffer(for:)](avfoundation/avsamplebuffergenerator/createsamplebuffer(for:).md)

### Retrieving sample buffer data

- [notifyOfDataReady(for:completionHandler:)](avfoundation/avsamplebuffergenerator/notifyofdataready(for:completionhandler:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Sample buffer generation

- [Playing custom audio with your own player](avfaudio/playing-custom-audio-with-your-own-player.md)
- [AVSampleBufferRequest](avfoundation/avsamplebufferrequest.md)
- [AVSampleBufferGeneratorBatch](avfoundation/avsamplebuffergeneratorbatch.md)
