<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVSampleBufferGenerator",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVSampleBufferGenerator"
  },
  "title" : "AVSampleBufferGenerator"
}
-->

# AVSampleBufferGenerator

An object that creates sample buffers.

```
class AVSampleBufferGenerator
```

## Overview

Each request for `CMSampleBuffer` creation is described in an `AVSampleBufferRequest` object. The <doc://com.apple.documentation/documentation/CoreMedia/CMSampleBuffer> opaque objects are returned synchronously. If requested, sample data may be loaded asynchronously (depending on file format support).

## Topics

### Creating sample buffer generators

[`-  initWithAsset:timebase:`](/documentation/AVFoundation/AVSampleBufferGenerator/init(asset:timebase:))

Creates a new sample buffer generator.

### Creating a sample buffer

[`-  createSampleBufferForRequest:error:`](/documentation/AVFoundation/AVSampleBufferGenerator/makeSampleBuffer(for:))

Creates a sample buffer, and attempts to load its data asynchronously if requested.

[`-  makeBatch`](/documentation/AVFoundation/AVSampleBufferGenerator/makeBatch())

Creates a batch object to handle generating multiple sample buffers.

[`-  createSampleBufferForRequest:addingToBatch:error:`](/documentation/AVFoundation/AVSampleBufferGenerator/makeSampleBuffer(for:addTo:))

Creates a sample buffer and attempts to defer I/O for its data.

[`-  createSampleBufferForRequest:`](/documentation/AVFoundation/AVSampleBufferGenerator/createSampleBuffer(for:))

Creates a new sample buffer reference for the specified buffer request.

### Retrieving sample buffer data

[`+  notifyOfDataReadyForSampleBuffer:completionHandler:`](/documentation/AVFoundation/AVSampleBufferGenerator/notifyOfDataReady(for:completionHandler:))

Notifies the sample buffer generator when data is ready for the sample buffer reference or an error has occurred.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

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

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)