<!--
{
  "availability" : [
    "iOS: 7.0.0 - 15.4.0",
    "iPadOS: 7.0.0 - 15.4.0",
    "macCatalyst: 14.0.0 - 15.4.0",
    "macOS: 10.9.0 - 12.3.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureSession/masterClock",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureSession(py)masterClock"
  },
  "title" : "masterClock"
}
-->

# masterClock

A clock object used for output synchronization.

```
var masterClock: CMClock? { get }
```

## Discussion

The returned <doc://com.apple.documentation/documentation/CoreMedia/CMClock> object is read-only and provides a timebase for all sample buffers in capture output. Use this clock in conjunction with the clock from an [`AVCaptureInput.Port`](/documentation/AVFoundation/AVCaptureInput/Port) object to synchronize capture output with external data sources such as motion samples.

For example, to synchronize output timestamps to the original timestamps provided by an input device, you can do the following in your [`fileOutput(_:didOutputSampleBuffer:from:)`](/documentation/AVFoundation/AVCaptureFileOutputDelegate/fileOutput(_:didOutputSampleBuffer:from:)) method:

```swift
guard let masterClock = captureSession.masterClock,
    let originalClock = connection.inputPorts.first?.clock else { return }

let synchedPTS = sampleBuffer.presentationTimeStamp
let originalPTS = masterClock.convertTime(synchedPTS, to: originalClock)
```

This property is key-value observable.

---

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)