---
title: "append(_:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avassetwriterinput/append(_:)"
---

# append(_:)

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

## Declaration

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

## Parameters

- `sampleBuffer`: The sample buffer to append.

## Return Value

Return Value true if the input successfully appends the sample buffer; otherwise, false.

## Discussion

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:) to determine the timing of samples in the output file. If this method returns false, check the value of the asset writer’s status property to determine whether the writing operation’s status is complete, failed, or canceled. If the status is AVAssetWriter.Status.failed, the asset writer’s 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.

## See Also

### Appending media samples

- [expectsMediaDataInRealTime](avfoundation/avassetwriterinput/expectsmediadatainrealtime.md)
- [isReadyForMoreMediaData](avfoundation/avassetwriterinput/isreadyformoremediadata.md)
- [requestMediaDataWhenReady(on:using:)](avfoundation/avassetwriterinput/requestmediadatawhenready(on:using:).md)
- [markAsFinished()](avfoundation/avassetwriterinput/markasfinished().md)
- [AVAssetWriterInput.SampleBufferReceiver](avfoundation/avassetwriterinput/samplebufferreceiver.md)
- [AVAssetWriterInput.PixelBufferReceiver](avfoundation/avassetwriterinput/pixelbufferreceiver.md)
- [AVAssetWriterInput.TaggedPixelBufferGroupReceiver](avfoundation/avassetwriterinput/taggedpixelbuffergroupreceiver.md)
- [AVAssetWriterInput.MetadataReceiver](avfoundation/avassetwriterinput/metadatareceiver.md)
- [AVAssetWriterInput.CaptionReceiver](avfoundation/avassetwriterinput/captionreceiver.md)
