Class

AVMutableMovieTrack

A mutable track that conforms to a QuickTime- or ISO-based media file format.

Declaration

class AVMutableMovieTrack : AVMovieTrack

Topics

Associating Tracks

func addTrackAssociation(to: AVMovieTrack, type: AVAssetTrack.AssociationType)

Creates a specific type of track association between two tracks.

func removeTrackAssociation(to: AVMovieTrack, type: AVAssetTrack.AssociationType)

Removes a specific type of track association between two tracks.

Accessing General Track Information

var alternateGroupID: Int

An number that identifies the track as a member of a particular alternate group.

var isEnabled: Bool

A Boolean value that indicates whether the track is enabled by default for presentation.

var hasProtectedContent: Bool

A Boolean value that indicates whether a track contains protected content.

var mediaDataStorage: AVMediaDataStorage?

A storage container for the media data to be added to a track.

var isModified: Bool

A Boolean value that indicates whether a track has been modified.

var sampleReferenceBaseURL: URL?

The base URL for sample references.

var timescale: CMTimeScale

The time scale for tracks that contain the moov atom.

var metadata: [AVMetadataItem]

A array of metadata stored by the track.

Accessing Visual Information

var naturalSize: CGSize

The dimensions used to display the visual media data for the track.

var preferredTransform: CGAffineTransform

The transform performed on the visual media data of the track for display purposes.

var layer: Int

The layer level for the visual media of the track.

var cleanApertureDimensions: CGSize

The clean aperture dimension of the track.

var productionApertureDimensions: CGSize

The production aperture dimensions of the track.

var encodedPixelsDimensions: CGSize

The encoded pixels dimensions of the track.

Accessing Audio and Language Information

var preferredVolume: Float

The preferred volume for the audible medata data of the track.

var languageCode: String?

A ISO 639-2/T language code that indicates the language associated with the track.

var extendedLanguageTag: String?

An IETF BCP 47 language identifier that identifies the language tag associated with the track.

Modifying Time Ranges

func insertTimeRange(CMTimeRange, of: AVAssetTrack, at: CMTime, copySampleData: Bool)

Inserts a portion of an asset track into the target movie.

func insertEmptyTimeRange(CMTimeRange)

Adds an empty time range to a track.

func removeTimeRange(CMTimeRange)

Removes the specified time range from a track.

func scaleTimeRange(CMTimeRange, toDuration: CMTime)

Changes the duration of a time range in a track.

Accessing Media Chunks

Sample data in a movie file is stored in a series of "chunks". A chunk contains one or more samples, which may have different sizes from one another. The collection of samples into chunks is intended to allow optimized access to the sample data during operations such as movie playback. You can change the default chunk size in a movie file by adjusting the chunk properties of a movie track prior to writing the track's sample data to a media storage container.

var preferredMediaChunkAlignment: Int

The boundary for media chunk alignment for file types that support media chunk alignment.

var preferredMediaChunkDuration: CMTime

The maximum duration to be used for each chunk of sample data written to the file for file types that support media chunk duration.

var preferredMediaChunkSize: Int

The maximum size to be used for each chunk of sample data written to the file for file types that support media chunk duration.

Appending Sample Data

func append(CMSampleBuffer, decodeTime: UnsafeMutablePointer<CMTime>?, presentationTime: UnsafeMutablePointer<CMTime>?)

Appends sample data to a media file and adds sample references for the added data to a track's media sample tables.

func insertMediaTimeRange(CMTimeRange, into: CMTimeRange) -> Bool

Inserts a reference to a media time range into a track.

Changing Format Descriptions

func replaceFormatDescription(CMFormatDescription, with: CMFormatDescription)

Replaces a receiver's format description with a new format description.

Relationships

Inherits From

Conforms To

See Also

Movie Editing

class AVMutableMovie

A mutable object that represents the audiovisual containers that conform to a QuickTime- or ISO-based media file format.