Contents

videoSettings

A dictionary that contains the compression settings for the output.

Declaration

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

Discussion

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

To receive samples in a default uncompressed format, set this value to nil. Then you can query this value to receive a dictionary of the settings the session uses.

In iOS versions prior to iOS 16, the only key supported is kCVPixelBufferPixelFormatTypeKey. In iOS 16 and later, the supported keys include the following:

You can use availableVideoPixelFormatTypes and availableVideoCodecTypes to get a list of the supported pixel formats and video codecs, respectively. The width and height need to match the videoOrientation specified in the output’s AVCaptureConnection, otherwise the system throws an invalidArgumentException. The aspect ratio of the width and height also need to match the aspect ratio of the source’s activeFormat, corrected for the connection’s videoOrientation, otherwise the system throws an invalidArgumentException. If the width or height exceeds the source’s activeFormat‘s width or height, the system throws an invalidArgumentException. Don’t change the width and height if deliversPreviewSizedOutputBuffers is true, otherwise the system throws an invalidArgumentException.

See Also

Configuring video capture