---
title: "init(mediaType:outputSettings:sourceFormatHint:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avassetwriterinput/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.

## Declaration

```swift
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 doc://com.apple.avfoundation/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 doc://com.apple.avfoundation/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

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

## See Also

### Creating an input

- [init(mediaType:outputSettings:)](avfoundation/avassetwriterinput/init(mediatype:outputsettings:).md)
