<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "QuickTime File Format",
  "identifier" : "/documentation/quicktime-file-format/Sample-to-group_atom",
  "metadataVersion" : "0.1.0",
  "role" : "Atom",
  "symbol" : {
    "kind" : "Atom",
    "modules" : [
      "QuickTime File Format"
    ],
    "preciseIdentifier" : "__docc_universal_symbol_reference_$Sample-to-group_atom"
  },
  "title" : "Sample-to-group atom ('sbgp')"
}
-->

# Sample-to-group atom ('sbgp')

An atom that associates a sample with a sample group description.

## Overview

Sample-to-group atoms are used to find the group that a sample belongs to and the associated description of that sample group. The sample-to-group atom has an atom type of `‘sbgp’`.

In a general case, there may be multiple instances of sample-to-group atoms if there is more than one sample grouping for the samples in a track. Each instance of the sample-to group atom has a grouping type code that distinguishes different sample groupings. Within a track there can be at most one instance of this atom with a particular grouping type. An associated sample group description atom indicates the same value for the grouping type.

The sample-to-group atom contains a table with a sample count and group description index pairs. The sample count is the number of media samples in the run of samples with the same sample group description. The group description index is an index into the array of payload data entries in the associated sample group description atom’s payload data table, the association defined by having the same grouping type value.

For use in AAC encoder delay representation, there is one sample-to-group atom instance in a given QuickTime sound track with grouping type `‘roll’` matching the single instance of the sample group description atom. The entry count field value is set to `1`, indicating one entry in the table data array. That entry is describing all the AAC packets in the track. The sample count in the table data array is typically the same as the sample size atom’s number of entries field, see [`Sample size atom`](/documentation/quicktime-file-format/Sample_size_atom), which represents the number of media samples in the track (in this use, AAC packets). For AAC encoder delay representation, the only entry in the associated sample group description atom’s payload data table is the first, which provides the value of 1 for the group description index.

The layout of the sample-to-group atom is as follows:

|Sample-to-group atom                                                                             |Bytes   |
|-------------------------------------------------------------------------------------------------|--------|
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Size``           |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Type`` = `'sbgp'`|4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Version``        |1       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Flags``          |3       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Grouping_type``  |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Default_length`` |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Entry_count``    |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Sample-to-group_atom/Table_data``     |variable|

## Topics

### Data fields

[`Size`](/documentation/quicktime-file-format/Sample-to-group_atom/Size)

A 32-bit integer that specifies the number of bytes in this sample-to-group atom.

[`Type`](/documentation/quicktime-file-format/Sample-to-group_atom/Type)

A 32-bit integer that identifies the atom type.

[`Version`](/documentation/quicktime-file-format/Sample-to-group_atom/Version)

A 1-byte specification of the version of this sample-to-group atom.

[`Flags`](/documentation/quicktime-file-format/Sample-to-group_atom/Flags)

A 3-byte reserved space.

[`Grouping type`](/documentation/quicktime-file-format/Sample-to-group_atom/Grouping_type)

A 32-bit integer identifying the grouping type.

[`Default length`](/documentation/quicktime-file-format/Sample-to-group_atom/Default_length)

A 32-bit integer indicating the length of the group entry in the payload data.

[`Entry count`](/documentation/quicktime-file-format/Sample-to-group_atom/Entry_count)

A 32-bit integer giving the number of entries in the table data that follows.

[`Table data`](/documentation/quicktime-file-format/Sample-to-group_atom/Table_data)

A table of sample count and group description index pairs.



---

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)