assetWriterInputWithMediaType:outputSettings:sourceFormatHint:
Returns a new input that appends sample buffers of the specified type and format hint to the output file.
Declaration
+ (instancetype) assetWriterInputWithMediaType:(AVMediaType) mediaType outputSettings:(NSDictionary<NSString *,id> *) outputSettings sourceFormatHint:(CMFormatDescriptionRef) sourceFormatHint;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.
Return Value
A new asset writer input.
Discussion
To guarantee successful file writing, ensure that sample buffers you append are of the specified format.