<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureMovieFileOutput/setOutputSettings(_:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureMovieFileOutput(im)setOutputSettings:forConnection:"
  },
  "title" : "setOutputSettings(_:for:)"
}
-->

# setOutputSettings(_:for:)

Sets the options the output uses to encode media from the given connection while recording.

```
func setOutputSettings(_ outputSettings: [String : Any]?, for connection: AVCaptureConnection)
```

## Parameters

`outputSettings`

A dictionary of output settings. Pass an empty dictionary to specify that the format of the media from the connection shouldn’t change before writing to the file. Pass `nil` to specify that the session preset determines output format.

`connection`

The connection delivering the media to encode.

## Discussion

For details on output settings, see [Video settings](/documentation/AVFoundation/video-settings) for video connections and [Audio settings](/documentation/AVFoundation/audio-settings) for audio connections.

On iOS, your output settings dictionary may only contain keys listed returned from the [`supportedOutputSettingsKeys(for:)`](/documentation/AVFoundation/AVCaptureMovieFileOutput/supportedOutputSettingsKeys(for:)) method. If you specify any other key, the system throws an invalid argument exception. Additionally, the value you specify for [`AVVideoCodecKey`](/documentation/AVFoundation/AVVideoCodecKey) should be present in the [`availableVideoCodecTypes`](/documentation/AVFoundation/AVCaptureMovieFileOutput/availableVideoCodecTypes) array. If you specify [`AVVideoCompressionPropertiesKey`](/documentation/AVFoundation/AVVideoCompressionPropertiesKey), you must also specify a valid value for [`AVVideoCodecKey`](/documentation/AVFoundation/AVVideoCodecKey).

On iOS, the [`outputSettings(for:)`](/documentation/AVFoundation/AVCaptureMovieFileOutput/outputSettings(for:)) method always provides a fully populated dictionary. If you call [`outputSettings(for:)`](/documentation/AVFoundation/AVCaptureMovieFileOutput/outputSettings(for:)) with the intent of overriding a few of the values, you must exclude keys that aren’t supported before calling [`setOutputSettings(_:for:)`](/documentation/AVFoundation/AVCaptureMovieFileOutput/setOutputSettings(_:for:)). When providing an [`AVVideoCompressionPropertiesKey`](/documentation/AVFoundation/AVVideoCompressionPropertiesKey) sub dictionary, you may specify a sparse dictionary. A movie file output object always fills in missing keys with default values for the current capture session configuration.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)