---
title: "assetWriterInputWithMediaType:outputSettings:"
framework: avfoundation
role: symbol
role_heading: Type Method
path: "avfoundation/avassetwriterinput/assetwriterinputwithmediatype:outputsettings:"
---

# assetWriterInputWithMediaType:outputSettings:

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

## Declaration

```occ
+ (instancetype) assetWriterInputWithMediaType:(AVMediaType) mediaType outputSettings:(NSDictionary<NSString *,id> *) outputSettings;
```

## Parameters

- `mediaType`: The media type of the samples the 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.

## Return Value

Return Value A new asset writer input.

## Discussion

Discussion If you’re appending samples that are already in an acceptable compressed format, pass a value of nil for the output settings to pass the buffers to the output unaltered. However, if you’re not writing to a QuickTime movie file, an asset writer only supports passing through a restricted set of media types and subtypes. To pass through media data to files with a type other than mov, pass a nonnull format hint using the init(mediaType:outputSettings:sourceFormatHint:) instead. Configuring audio settings You must fully specify the audio settings dictionary when using this initializer, which means you must provide values for the following keys: AVFormatIDKey. The identifier of the audio format. For kAudioFormatLinearPCM format, you must include values for all relevant keys with a AVLinearPCM prefix, and for kAudioFormatAppleLossless, you must specify a value for AVEncoderBitDepthHintKey. AVSampleRateKey. The sample rate of the audio. Common values are 44100 and 48000. AVNumberOfChannelsKey. If no other channel layout information is available, specifying a value of 1 results in mono output and a value of 2 results in stereo output. If AVNumberOfChannelsKey specifies a channel count greater than 2, the dictionary must also specify a value for AVChannelLayoutKey. note: The system doesn’t support specifying a value for AVSampleRateConverterAudioQualityKey in audio output settings. Configuring video settings A video output settings dictionary must request a compressed video format, which means that the value you specify must follow the rules for compressed video output. You must fully specify the video settings dictionary when using this initializer, which means you must provide values for the following keys AVVideoCodecKey, AVVideoWidthKey, AVVideoHeightKey. note: Specifying a AVVideoScalingModeKey value of AVVideoScalingModeFit results in an error.

## See Also

### Creating an input

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