init(mediaType:outputSettings:sourceFormatHint:)
Creates an input that appends sample buffers of the specified type and format hint to the output file.
Declaration
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 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 Avformatidkey for the audio output settings, and 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.