Instance Method


Specifies the recommended settings for use with an AVAssetWriterInput.


func recommendedVideoSettingsForAssetWriter(writingTo outputFileType: AVFileType) -> [String : Any]?



The Uniform Type Identifier of the file type to be written. See File Format UTIs for supported types.

Return Value

A fully populated dictionary of keys and values that are compatible with AVAssetWriter.


This dictionary contains keys and values described in Video Settings Dictionaries and is suitable for use when creating an AVAssetWriterInput with the init(mediaType:outputSettings:) initializer. For QuickTime movie and ISO file types, the recommended video settings produce output comparable to that of AVCaptureMovieFileOutput.

Note that the dictionary of settings is dependent on the current configuration of the output’s AVCaptureSession and its inputs. The settings dictionary may change if the session’s configuration changes. As such, configure your session first, then query the recommended video settings.

See Also

Configuring Video Capture

var videoSettings: [String : Any]!

The compression settings for the output.

Video Settings Dictionaries

Define output image and video formats by using the key and value constants.

var alwaysDiscardsLateVideoFrames: Bool

Indicates whether to drop video frames if they arrive late.

var automaticallyConfiguresOutputBufferDimensions: Bool

A Boolean value that indicates whether the output automatically configures the size of output buffers.

var deliversPreviewSizedOutputBuffers: Bool

A Boolean value that indicates whether the output is configured to deliver preview-sized buffers.

func recommendedVideoSettings(forVideoCodecType: AVVideoCodecType, assetWriterOutputFileType: AVFileType) -> [AnyHashable : Any]?

Returns a video settings dictionary appropriate for capturing video to be recorded to a file with the specified codec and type.