Time-to-sample atom ('stts')
An atom that stores duration information for a media’s samples, providing a mapping from a time in a media to the corresponding data sample.
Overview
Time-to-sample atoms store duration information for a media’s samples, providing a mapping from a time in a media to the corresponding data sample. The time-to-sample atom has an atom type of 'stts'.
You can determine the appropriate sample for any time in a media by examining the time-to-sample atom table, which is contained in the time-to-sample atom.
The atom contains a compact version of a table that allows indexing from time to sample number. Other tables provide sample sizes and pointers from the sample number. Each entry in the table gives the number of consecutive samples with the same time delta, and the delta of those samples. By adding the deltas, a complete time-to-sample map can be built.
The atom contains time deltas: DT(n+1) = DT(n) + STTS(n) where STTS(n) is the (uncompressed) table entry for sample n and DT is the display time for sample (n). The sample entries are ordered by time stamps; therefore, the deltas are all nonnegative. The DT axis has a zero origin; DT(i) = SUM (for j=0 to i-1 of delta(j)), and the sum of all deltas gives the length of the media in the track (not mapped to the overall time scale, and not considering any edit list). The edit list atom provides the initial DT value if it is nonempty (nonzero).
The layout of the time-to-sample atom is as follows.
Time-to-sample atom data field | Bytes |
|---|---|
4 | |
Type = | 4 |
1 | |
3 | |
4 | |
Variable |
Topics
Data fields
See Also
Describing samples
Sample table atom ('stbl')Seeking with a QuickTime fileSample description atom ('stsd')Creating video tracks at 30 frames per secondCreating video tracks at 29.97 frames per secondCreating sound tracks at 44.1 kHzComposition offset atom ('ctts')Composition shift least greatest atom ('cslg')Using composition offset and composition shift least greatest atomsSync sample atom ('stss')Partial sync sample atom ('stps')Sample-to-chunk atom ('stsc')Referencing two data files with a single trackSample size atom ('stsz')Chunk offset atom ('stco')