Asset

public struct Asset : Resource

A reference to a media file managed by a library.

Some asset properties are optional because their values can be derived from the respective media file. However, the asset file may be offline when Final Cut Pro X tries to access it, therefore, it is recommended that you specify the following properties for all assets: hasAudio, hasVideo, audioSources, audioChannels, and audioRate.

Third party tools can assign a unique identifier with the uid property of the asset. This allows you to reference the same asset in a subsequent XML import, even if the URL specified by the sourceURL is different. Final Cut Pro X locates the asset using the uid property value and relinks the media. The asset now uses the media file at the new URL.

This enables a workflow where the initial XML import uses the proxy media that is currently available to allow the editor to start working. Then, when the respective high resolution media becomes available, a second XML import can be used to replace the proxy media with the high resolution media. For this to work, the proxy and the high resolution media must be compatible, meaning their frame rates match and the high resolution media covers the time range of the proxy media. If desired, you can also go back from the high resolution media to the proxy media, as long as the two medias are compatible. There can be a situation where an importing XML includes a media asset with its unique identifier assigned by a third party tool, yet the media asset has already been imported manually into Final Cut Pro X by the user. In such a case, Final Cut Pro X finds the asset through the URL specified by the sourceURL property and assigns the unique identifier from the importing XML to the asset already imported into Final Cut Pro X overriding the unique identifier generated by Final Cut Pro X. This is only possible when the media asset imported has a unique identifier assigned by Final Cut Pro X.

  • The security-scoped bookmark associated with the asset. A security-scoped bookmark is required for sandboxed applications that need to access a media asset (file-system resource) outside the sandboxed environment.

    Declaration

    Swift

    public var bookmark: String?
  • The metadata associated with the asset.

    Declaration

    Swift

    public var metadata: [Metadatum]? { get set }
  • id

    The identifier of the asset. This identifier is unique within the context of a FCPXML document and refers to the resource identifier (e.g. r1).

    Declaration

    Swift

    public let id: String
  • The name of the asset.

    Declaration

    Swift

    public var name: String?
  • uid

    The unique identifier of the asset. It is recommended to use a UUID or a string with a reverse DNS prefix to ensure uniqueness.

    Note

    Final Cut Pro X reserves strings containing only uppercase hexadecimal characters for internal identifiers. A third party tool must not use these strings when assigning its own asset identifiers.

    Declaration

    Swift

    public var uid: String?
  • The file URL of the asset.

    Declaration

    Swift

    public var sourceURL: String
  • The start time of the asset.

    Declaration

    Swift

    public var start: CMTime?
  • The duration of the asset.

    Declaration

    Swift

    public var duration: CMTime?
  • A Boolean value that indicates whether the asset contains video.

    Declaration

    Swift

    public var hasVideo: Bool?
  • The identifier of the Format resource referenced by the asset.

    Declaration

    Swift

    public var formatID: String?
  • A Boolean value that indicates whether the asset contains audio.

    Declaration

    Swift

    public var hasAudio: Bool?
  • The number of audio sources (or tracks) in the asset.

    Declaration

    Swift

    public var audioSources: Int?
  • The number of audio channels in an audio source (or track).

    Declaration

    Swift

    public var audioChannels: Int?
  • The audio rate of the asset.

    Declaration

    Swift

    public var audioRate: Int?
  • Specifies a custom LUT to use for the asset. This value can also be a built-in custom camera Log or processing mode.

    Declaration

    Swift

    public var customLUTOverride: String?
  • Specifies the color space to use for the asset.

    Declaration

    Swift

    public var colorSpaceOverride: ColorSpace?
  • Specifies the projection type to use for the asset.

    Declaration

    Swift

    public var projectionOverride: Projection?
  • Specifies the stereoscopic mode to use for the asset.

    Declaration

    Swift

    public var stereoscopicOverride: Stereoscopic?
  • Initializes a new asset.

    Declaration

    Swift

    public init(id: String, name: String? = nil, uid: String? = nil, sourceURL: String, start: CMTime? = nil, duration: CMTime? = nil,
                hasVideo: Bool? = nil, hasAudio: Bool? = nil, formatID: String? = nil, audioSources: Int? = nil, audioChannels: Int? = nil,
                audioRate: Int? = nil)

    Parameters

    id

    The identifier of the asset.

    name

    The name of the asset.

    uid

    The unique identifier of the asset.

    sourceURL

    The file URL of the asset.

    start

    The start time of the asset.

    duration

    The duration of the asset.

    hasVideo

    A Boolean value that indicates whether the asset contains video.

    hasAudio

    A Boolean value that indicates whether the asset contains audio.

    formatID

    The identifier of the Format resource referenced by the asset.

    audioSources

    The number of audio sources (or tracks) in the asset.

    audioChannels

    The number of audio channels in an audio source (or track).

    audioRate

    The audio rate of the asset.