<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVAssetWriterInput/init(mediaType:outputSettings:sourceFormatHint:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAssetWriterInput(im)initWithMediaType:outputSettings:sourceFormatHint:"
  },
  "title" : "init(mediaType:outputSettings:sourceFormatHint:)"
}
-->

# init(mediaType:outputSettings:sourceFormatHint:)

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

```
init(mediaType: AVMediaType, outputSettings: [String : Any]?, sourceFormatHint: CMFormatDescription?)
```

## Parameters

`mediaType`

The type of media that an input accepts.

`outputSettings`

The settings to use for encoding the media you append to the output. Create an output settings dictionary manually, or use [`AVOutputSettingsAssistant`](/documentation/AVFoundation/AVOutputSettingsAssistant) to create preset-based settings.

`sourceFormatHint`

A hint about the format of the media data to append. The input uses the source format hint to fill in missing output settings. If you specify a hint, you only need to specify <doc://com.apple.documentation/documentation/AVFAudio/AVFormatIDKey> for the audio output settings, and [`AVVideoCodecKey`](/documentation/AVFoundation/AVVideoCodecKey) is the only required key for video output settings.

    The system raises an error if the format description isn’t valid for the indicated media type.

## Discussion

To guarantee successful file writing, ensure that sample buffers you append are of the specified format.

---

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)