Instance Property


The compression settings for the output.


var videoSettings: [String : Any]! { get set }


The dictionary contains values for compression settings keys defined in Video Settings, or pixel buffer attributes keys defined in CVPixelBuffer. The only key currently supported is the kCVPixelBufferPixelFormatTypeKey key.

To get possible values for the supported video pixel formats (kCVPixelBufferPixelFormatTypeKey) and video codec formats (AVVideoCodecKey), see availableVideoPixelFormatTypes and availableVideoCodecTypes respectively.

To receive samples in their device native format, set this property to an empty dictionary:

let myVideoOutput = AVCaptureVideoDataOutput()   // Assume this exists.
myVideoOutput.videoSettings = [:]  // Receive samples in device format.

If you set this property to nil and then subsequently query it, you get a dictionary reflecting the settings used by the capture sessions’s current sessionPreset.

See Also

Configuring Video Capture

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.

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

Specifies the recommended settings for use with an AVAssetWriterInput.