<!--
{
  "availability" : [
    "iOS: 4.1.0 - 27.0.0",
    "iPadOS: 4.1.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.7.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVAssetWriterInput/append(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAssetWriterInput(im)appendSampleBuffer:"
  },
  "title" : "append(_:)"
}
-->

# append(_:)

Appends a sample buffer to an input to write to the output file.

```
func append(_ sampleBuffer: CMSampleBuffer) -> Bool
```

## Parameters

`sampleBuffer`

The sample buffer to append.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the input successfully appends the sample buffer; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Order the samples you append according to storage requirements. For example, if you’re working with sample buffers containing compressed video, order and append them according to their decode timestamp. The system uses the timing information in the sample buffer relative to the time you set in the call to [`startSession(atSourceTime:)`](/documentation/AVFoundation/AVAssetWriter/startSession(atSourceTime:)) to determine the timing of samples in the output file.

If this method returns <doc://com.apple.documentation/documentation/Swift/false>, check the value of the asset writer’s [`status`](/documentation/AVFoundation/AVAssetWriter/status-swift.property) property to determine whether the writing operation’s status is complete, failed, or canceled. If the status is [`AVAssetWriter.Status.failed`](/documentation/AVFoundation/AVAssetWriter/Status-swift.enum/failed), the asset writer’s [`error`](/documentation/AVFoundation/AVAssetWriter/error) property contains an error object that describes the failure.

> Important:
> Don’t modify the sample buffer or its contents after you’ve passed it to this method.

---

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)