mcut
@mcut/timeline

Model types and ids

TypeScript types for the project document and the branded id constructors.

Types

AssetId

type AssetId = `a-${string}`

A branded asset id string with the a- prefix.

ElementId

type ElementId = `e-${string}`

A branded element id string with the e- prefix.

GroupId

type GroupId = `g-${string}`

A branded group id string with the g- prefix.

MarkerId

type MarkerId = `m-${string}`

A branded marker id string with the m- prefix.

TrackId

type TrackId = `t-${string}`

A branded track id string with the t- prefix.

AssetKind

type AssetKind = AssetRef['kind']

The media kind of an asset, video, audio, or image.

AssetRef

type AssetRef = z.infer<typeof assetRefSchema>

A project asset as inferred from assetRefSchema.

AudioElement

type AudioElement = z.infer<typeof audioElementSchema>

An audio element as inferred from audioElementSchema.

AngleCutRef

type AngleCutRef = MulticamElement['angles'][number]

One entry of a multicam element's angles list, the source clock time a layout takes effect and the layout id.

CaptionElement

type CaptionElement = z.infer<typeof captionElementSchema>

A caption element as inferred from captionElementSchema.

CaptionStyle

type CaptionStyle = z.infer<typeof captionStyleSchema>

Caption styling as inferred from captionStyleSchema.

The compositor centers top and bottom captions across 85% of the frame. A multicam slot drawn over another slot in its layout is a picture-in-picture overlay. When an overlay reaches the bottom quarter of the frame for bottom, or the top quarter for top, the caption centers in the widest horizontal gap beside the overlays instead, so a corner head never covers it. A gap under 40% of the frame width keeps the full-frame placement. middle captions ignore overlays.

CaptionWord

type CaptionWord = z.infer<typeof captionWordSchema>

A timed caption word as inferred from captionWordSchema.

CreateProjectOptions

interface CreateProjectOptions {
  id?: string
  name?: string
  width?: number
  height?: number
  fps?: number
}

Optional id, name, size, and fps for createProject.

ElementType

type ElementType = TimelineElement['type']

The type field of the six element kinds, video, audio, image, text, caption, and multicam.

ImageElement

type ImageElement = z.infer<typeof imageElementSchema>

An image element as inferred from imageElementSchema.

Marker

type Marker = z.infer<typeof markerSchema>

A project marker as inferred from markerSchema.

MulticamElement

type MulticamElement = z.infer<typeof multicamElementSchema>

A multicam element as inferred from multicamElementSchema.

MulticamSource

type MulticamSource = z.infer<typeof multicamSourceSchema>

One synced source of a multicam element, a role key, an asset id, and offsetMs, the source media time that plays at source clock time 0. A source with an audio asset is audio-only and is never drawn.

Project

type Project = z.infer<typeof projectSchema>

A project as inferred from projectSchema.

TextElement

type TextElement = z.infer<typeof textElementSchema>

A text element as inferred from textElementSchema.

TextBox

type TextBox = z.infer<typeof textBoxSchema>

A text box as inferred from textBoxSchema.

TextShadow

type TextShadow = z.infer<typeof textShadowSchema>

A text shadow as inferred from textShadowSchema.

TextStroke

type TextStroke = z.infer<typeof textStrokeSchema>

A text outline as inferred from textStrokeSchema.

TextStyle

type TextStyle = z.infer<typeof textStyleSchema>

Text styling as inferred from textStyleSchema.

TimelineElement

type TimelineElement =
  | VideoElement
  | AudioElement
  | ImageElement
  | TextElement
  | CaptionElement
  | MulticamElement

The closed union of the six element kinds.

TimelineElementDraft

type TimelineElementDraft =
  | WithOptionalId<VideoElement>
  | WithOptionalId<AudioElement>
  | WithOptionalId<ImageElement>
  | WithOptionalId<TextElement>
  | WithOptionalId<CaptionElement>
  | WithOptionalId<MulticamElement>

The output of elementInputSchema, a parsed element with every default applied and only id still optional.

TimelineElementInput

type TimelineElementInput =
  | WithOptionalId<z.input<typeof videoElementSchema>>
  | WithOptionalId<z.input<typeof audioElementSchema>>
  | WithOptionalId<z.input<typeof imageElementSchema>>
  | WithOptionalId<z.input<typeof textElementSchema>>
  | WithOptionalId<z.input<typeof captionElementSchema>>
  | WithOptionalId<z.input<typeof multicamElementSchema>>

The union of the element input shapes, where id is optional and defaulted fields may be omitted.

Track

type Track = z.infer<typeof trackSchema>

A track as inferred from trackSchema.

Transform

type Transform = z.infer<typeof transformSchema>

Position, scale, and rotation as inferred from transformSchema.

VideoElement

type VideoElement = z.infer<typeof videoElementSchema>

A video element as inferred from videoElementSchema.

Voice

type Voice = z.infer<typeof voiceSchema>

Voice cleanup mix as inferred from voiceSchema, whether it is on and how much cleaned audio to blend in.

Functions

createAssetId

const createAssetId = (): AssetId => `a-${randomSuffix()}`

Returns a new random AssetId.

createElementId

const createElementId = (): ElementId => `e-${randomSuffix()}`

Returns a new random ElementId.

createGroupId

const createGroupId = (): GroupId => `g-${randomSuffix()}`

Returns a new random GroupId shared by elements that move and edit as one item.

createLayoutId

const createLayoutId = (): string => `lay-${randomSuffix()}`

Returns a new random id for a multicam layout.

createLinkId

const createLinkId = (): string => `l-${randomSuffix()}`

Returns a new random link id shared by linked elements such as a video and its detached audio.

createMarkerId

const createMarkerId = (): MarkerId => `m-${randomSuffix()}`

Returns a new random MarkerId.

createPresetId

const createPresetId = (): string => `ps-${randomSuffix()}`

Returns a new random id for a property preset.

createProjectId

const createProjectId = (): string => `p-${randomSuffix()}`

Returns a new random project id.

createTrackId

const createTrackId = (): TrackId => `t-${randomSuffix()}`

Returns a new random TrackId.

On this page