<!--
{
  "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

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

Creates a new sample buffer generator.

### Creating a sample buffer

[`makeSampleBuffer(for:)`](/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.

[`makeSampleBuffer(for:addTo:)`](/documentation/AVFoundation/AVSampleBufferGenerator/makeSampleBuffer(for:addTo:))

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

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

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

### Retrieving sample buffer data

[`notifyOfDataReady(for: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.



---

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)