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

# AVAssetWriterInput

An object that appends media samples to a track in an asset writer’s output file.

```
class AVAssetWriterInput
```

## Overview

Create an asset writer input to write a single track of media, and optional track-level metadata, to the output file. To write multiple concurrent tracks with ideal interleaving of media data, observe the value of the [`isReadyForMoreMediaData`](/documentation/AVFoundation/AVAssetWriterInput/isReadyForMoreMediaData) property of each input.

You can use an asset writer input to create tracks in a QuickTime movie file that aren’t self-contained, and instead reference sample data that exists in another file.

## Topics

### Creating an input

[`assetWriterInputWithMediaType:outputSettings:`](/documentation/AVFoundation/AVAssetWriterInput/assetWriterInputWithMediaType:outputSettings:)

Returns a new input to append sample buffers of the specified type to the output file.

[`init(mediaType:outputSettings:)`](/documentation/AVFoundation/AVAssetWriterInput/init(mediaType:outputSettings:))

Creates an input to append sample buffers of the specified type to the output file.

[`assetWriterInputWithMediaType:outputSettings:sourceFormatHint:`](/documentation/AVFoundation/AVAssetWriterInput/assetWriterInputWithMediaType:outputSettings:sourceFormatHint:)

Returns a new input that appends sample buffers of the specified type and format hint to the output file.

[`init(mediaType:outputSettings:sourceFormatHint:)`](/documentation/AVFoundation/AVAssetWriterInput/init(mediaType:outputSettings:sourceFormatHint:))

Creates an input that appends sample buffers of the specified type and format hint to the output file.

### Configuring presentation

[`naturalSize`](/documentation/AVFoundation/AVAssetWriterInput/naturalSize)

The natural display dimensions of the output’s visual media.

[`transform`](/documentation/AVFoundation/AVAssetWriterInput/transform)

The transform to use for display of the output’s visual media.

[`preferredVolume`](/documentation/AVFoundation/AVAssetWriterInput/preferredVolume)

The volume to prefer for playback of the output’s audio data.

[`mediaTimeScale`](/documentation/AVFoundation/AVAssetWriterInput/mediaTimeScale)

The time scale of the track in the output file.

[`marksOutputTrackAsEnabled`](/documentation/AVFoundation/AVAssetWriterInput/marksOutputTrackAsEnabled)

A Boolean value that indicates whether to enable a track in the output for playback and processing.

### Configuring language support

[`languageCode`](/documentation/AVFoundation/AVAssetWriterInput/languageCode)

The language code of the input’s track.

[`extendedLanguageTag`](/documentation/AVFoundation/AVAssetWriterInput/extendedLanguageTag)

The extended language for the input’s track.

### Configuring metadata

[`metadata`](/documentation/AVFoundation/AVAssetWriterInput/metadata)

The track-level metadata to write to the output.

### Configuring media data layout

[`preferredMediaChunkAlignment`](/documentation/AVFoundation/AVAssetWriterInput/preferredMediaChunkAlignment)

The boundary, in bytes, for aligning media chunks.

[`preferredMediaChunkDuration`](/documentation/AVFoundation/AVAssetWriterInput/preferredMediaChunkDuration)

The duration to use for each chunk of sample data in the output file.

[`sampleReferenceBaseURL`](/documentation/AVFoundation/AVAssetWriterInput/sampleReferenceBaseURL)

The base URL sample references are relative to.

[`mediaDataLocation`](/documentation/AVFoundation/AVAssetWriterInput/mediaDataLocation-swift.property)

Specifies how the input lays out and interleaves media data.

[`AVAssetWriterInput.MediaDataLocation`](/documentation/AVFoundation/AVAssetWriterInput/MediaDataLocation-swift.struct)

A structure that indicates how to lay out and interleave media data.

### Configuring track associations

[`canAddTrackAssociation(withTrackOf:type:)`](/documentation/AVFoundation/AVAssetWriterInput/canAddTrackAssociation(withTrackOf:type:))

Determines whether it’s valid to associate another input’s track with this input’s track.

[`addTrackAssociation(withTrackOf:type:)`](/documentation/AVFoundation/AVAssetWriterInput/addTrackAssociation(withTrackOf:type:))

Adds an association between input tracks.

### Appending media samples

[`expectsMediaDataInRealTime`](/documentation/AVFoundation/AVAssetWriterInput/expectsMediaDataInRealTime)

A Boolean value that indicates whether the input tailors its processing for real-time sources.

[`isReadyForMoreMediaData`](/documentation/AVFoundation/AVAssetWriterInput/isReadyForMoreMediaData)

A Boolean value that indicates whether the input is ready to accept media data.

[`requestMediaDataWhenReady(on:using:)`](/documentation/AVFoundation/AVAssetWriterInput/requestMediaDataWhenReady(on:using:))

Tells the input to request media data, at its convenience, to write to the output file.

[`append(_:)`](/documentation/AVFoundation/AVAssetWriterInput/append(_:))

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

[`markAsFinished()`](/documentation/AVFoundation/AVAssetWriterInput/markAsFinished())

Marks the input as finished to indicate that you’re done appending samples to it.

[`AVAssetWriterInput.SampleBufferReceiver`](/documentation/AVFoundation/AVAssetWriterInput/SampleBufferReceiver)

Provides an interface for writing sample buffers to an input.

[`AVAssetWriterInput.PixelBufferReceiver`](/documentation/AVFoundation/AVAssetWriterInput/PixelBufferReceiver)

Provides an interface for writing pixel buffers to an input.

[`AVAssetWriterInput.TaggedPixelBufferGroupReceiver`](/documentation/AVFoundation/AVAssetWriterInput/TaggedPixelBufferGroupReceiver)

Provides an interface for writing tagged pixel buffers to an input.

[`AVAssetWriterInput.MetadataReceiver`](/documentation/AVFoundation/AVAssetWriterInput/MetadataReceiver)

Provides an interface for writing timed metadata groups to an input.

[`AVAssetWriterInput.CaptionReceiver`](/documentation/AVFoundation/AVAssetWriterInput/CaptionReceiver)

Provides an interface for writing caption data to an input.

### Performing multiple-pass encoding

[`canPerformMultiplePasses`](/documentation/AVFoundation/AVAssetWriterInput/canPerformMultiplePasses)

A Boolean value that indicates whether the input may perform multiple passes over appended media data.

[`currentPassDescription`](/documentation/AVFoundation/AVAssetWriterInput/currentPassDescription)

An object that describes the requirements for the current pass.

[`AVAssetWriterInputPassDescription`](/documentation/AVFoundation/AVAssetWriterInputPassDescription)

An object that defines the interface to query for the requirements of the current pass.

[`markCurrentPassAsFinished()`](/documentation/AVFoundation/AVAssetWriterInput/markCurrentPassAsFinished())

Tells the input to analyze the appended media to determine whether it can improve the results by reencoding certain segments.

[`performsMultiPassEncodingIfSupported`](/documentation/AVFoundation/AVAssetWriterInput/performsMultiPassEncodingIfSupported)

A Boolean value that indicates whether the input attempts to encode the source media data using multiple passes.

[`respondToEachPassDescription(on:using:)`](/documentation/AVFoundation/AVAssetWriterInput/respondToEachPassDescription(on:using:))

Tells the input to invoke a callback whenever it begins a new pass.

[`AVAssetWriterInput.MultiPassController`](/documentation/AVFoundation/AVAssetWriterInput/MultiPassController)

Provides an interface to receive an async sequence of pass descriptions for the writer input receiver, if multi-pass is supported.

### Inspecting an input

[`mediaType`](/documentation/AVFoundation/AVAssetWriterInput/mediaType)

The media type of the samples that the input accepts.

[`outputSettings`](/documentation/AVFoundation/AVAssetWriterInput/outputSettings)

The settings to use for encoding media data you append to the output.

[`sourceFormatHint`](/documentation/AVFoundation/AVAssetWriterInput/sourceFormatHint)

A hint about the format of the sample buffers to append to the input.



---

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)