Initialize a writer input object with the specified media type and output settings.
- iOS 4.1+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
The media type of the samples to be accepted by the input object. For a list of media types, see AVFoundation Constants.
Specify a dictionary containing the settings used for encoding the media appended to the output. You may pass
nilfor this parameter if you do not want the appended samples to be re-encoded.
Audio output settings keys are defined in Audio Settings and Formats. Video output settings keys are defined in AVFoundation Constants. Video output settings with keys from
CVPixelare not currently supported.
An initialized writer input object that can accept samples of the specified media type and write them to the output file.
Each new input accepts data for a new track of the asset writer’s output file. You add an input to an asset writer using the
nil for output settings instructs the input to pass through appended samples, doing no processing before they are written to the output file. This is useful if, for example, you are appending buffers that are already in a desirable compressed format. However, if not writing to a QuickTime Movie file (i.e. the
AVAsset was initialized with a file type other than
AVAsset only supports passing through a restricted set of media types and subtypes. In order to pass through media data to files other than
mov, a non-
NULL format hint must be provided using
init(media instead of this method.
media parameter is
output dictionary does not support the
AVSample keys. When using this method, an audio settings dictionary must be fully specified, meaning that it must contain the
AVNumber keys. If no other channel layout information is available, a value of
1 for the
AVNumber key results in mono output and a value of
2 results in stereo output. If the
AVNumber key specifies a value greater than 2, the dictionary must also specify a value for the
AVChannel key. For audio using the
k format, include all relevant
Key keys. For the
k format, include the
AVEncoder keys. To avoid specifying values for each of those keys, use the
init(media method instead.
media parameter is
output dictionary must request a compressed video format. This means that the values specified in the dictionary must follow the rules for compressed video output, as described in
AVVideo. When using this initializer, a video settings dictionary must be fully specified, meaning that it must contain the following keys:
AVVideo. To avoid specifying values for each of those keys, use the