Cutlass
DocsDownloadsGitHub ↗
07Documentation

CUTLASS.PY DOCS

Track-first object model

Understand Projects, media, tracks, clips, effects, transitions, and animation.

Project

Project owns the timeline, media pool, tracks, renderer, and export entry points.

from cutlass import Project

p = Project("trailer", fps=30, canvas="16:9", background="#101018")

Useful members:

  • p.import_media(path)
  • p.add_track(kind, name="", index=None)
  • p.tracks
  • p.media
  • p.get_frame(t)
  • p.export(path)
  • p.save(path)
  • Project.load(path)

Media

Media is a probed source file in the project media pool. It is not placed on the timeline until you add it to a track.

beach = p.import_media("beach.mp4")
clip_source = beach.subclip(3.0, 8.0)
same_source = beach[3.0:8.0]

One media asset can be placed many times.

Tracks

Tracks are explicit and kind-typed. Later tracks draw on top of earlier tracks.

main = p.add_track("video", name="Main")
titles = p.add_track("text", name="Titles")
score = p.add_track("audio", name="Music")

Track kinds include video, audio, text, sticker, effect, filter, and adjustment. Content must match the track kind or Cutlass.py raises TrackKindError.

Clips

A clip is a placement on a track. Timing is in timeline seconds.

a = main.add(beach.subclip(3.0, 8.0), start=0.0)
b = main.append(beach.subclip(10.0, 14.0))
a.transition("crossfade", duration=0.8)

Common clip operations:

  • clip.split(at)
  • clip.trim(start=None, end=None)
  • clip.move(start, track=None)
  • clip.delete()
  • clip.ripple_delete()
  • clip.set_speed(factor, reverse=False)
  • clip.crop(...)

Animation

Set constants through properties, or keyframe values with animate.

clip.opacity = 0.85
clip.scale = 0.5
clip.position = (0.25, -0.1)

clip.animate(opacity=[(0.0, 0.0), (0.6, 1.0)], easing="ease_out")
clip.animate(scale=1.2, at=2.0)

Animation times are clip-relative seconds, so keyframes stay with the clip when it moves.