<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMSampleBufferGetSampleTimingInfo(_:at:timingInfoOut:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMSampleBufferGetSampleTimingInfo"
  },
  "title" : "CMSampleBufferGetSampleTimingInfo(_:at:timingInfoOut:)"
}
-->

# CMSampleBufferGetSampleTimingInfo(_:at:timingInfoOut:)

Retrieves a timing information structure that describes a specified sample in a sample buffer.

```
func CMSampleBufferGetSampleTimingInfo(_ sbuf: CMSampleBuffer, at sampleIndex: CMItemIndex, timingInfoOut: UnsafeMutablePointer<CMSampleTimingInfo>) -> OSStatus
```

## Parameters

`sbuf`

The `CMSampleBuffer` being interrogated.

`sampleIndex`

Sample index (0 is the first sample in `sbuf`).

`timingInfoOut`

On output, points to a single `CMSampleTimingInfo` struct to receive the timing info.

## Return Value

A result code. See [Sample Buffer Error Codes](/documentation/CoreMedia/sample-buffer-errors).

## Discussion

A sample-specific [`CMSampleTimingInfo`](/documentation/CoreMedia/CMSampleTimingInfo) struct will be returned with a sample-specific `presentationTimeStamp` and `decodeTimeStamp`, even if a single `CMSampleTimingInfo` struct was used during creation to describe all the samples in the buffer. The timing info struct must be allocated by the caller. If the sample index isn’t in the range 0…numSamples-1, [`CMSampleBuffer`](/documentation/CoreMedia/CMSampleBuffer) will be returned. If there’s no `timingInfo` in this `CMSampleBuffer`, [`CMSampleBuffer`](/documentation/CoreMedia/CMSampleBuffer) will be returned.

---

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)