Clip

class Clip(val source: MediaSource, val trim: TimeRange? = null, val effects: List<EffectSpec> = emptyList(), val audio: AudioLevel = AudioLevel.Inherit, val snapWithin: Duration = Duration.ZERO, val fadeIn: Duration = Duration.ZERO, val fadeOut: Duration = Duration.ZERO, val speed: Double = 1.0)(source)

One source contributing a time range to a track.

Clip effects run before track effects, which run before composition effects. All three are sorted into filmstrip's canonical pipeline order, so the order you write them in does not matter, but the scope you write them in does.

Constructors

Link copied to clipboard
constructor(source: MediaSource, trim: TimeRange? = null, effects: List<EffectSpec> = emptyList(), audio: AudioLevel = AudioLevel.Inherit, snapWithin: Duration = Duration.ZERO, fadeIn: Duration = Duration.ZERO, fadeOut: Duration = Duration.ZERO, speed: Double = 1.0)

Properties

Link copied to clipboard

What to do with this clip's audio.

Link copied to clipboard

How long this clip runs on the composition timeline, or null while it is untrimmed or open-ended and the source has not been probed, or while speed is one the planner will refuse.

Link copied to clipboard

Effects applied to this clip only.

Link copied to clipboard

How long the audio takes to rise from silence, starting at the first kept sample. It multiplies audio rather than replacing it, so a fade over a level or an envelope reaches what that asked for. Measured on the composition timeline, so speed does not stretch it.

Link copied to clipboard

How long the audio takes to fall to silence before the last kept sample. Measured on the composition timeline back from the end of trim, so retrimming the clip moves the fade with it and speed does not stretch it.

Link copied to clipboard

How far back the cut may move to reach a sync sample, which is what lets a trimmed export copy its streams instead of re-encoding them. Zero, the default, keeps the cut where it was asked for. A cut that already lands on a sync sample copies at any value, this one included, since reaching it costs no accuracy.

Link copied to clipboard

Where to read the media from.

Link copied to clipboard

How fast trim plays, where 2.0 runs it in half the time and 0.5 in twice the time, always keeping the audio's pitch. trim stays in source time and everything else on this clip, the effects, overlays, fades and envelopes, is in composition time. A speed outside CLIP_SPEED_RANGE is refused with dev.jordond.filmstrip.FilmstripError.InvalidComposition when the composition is planned. A still shows the same pixels at any speed, so its length ignores this.

Link copied to clipboard

The part of the source to keep, or null for all of it.

Functions

Link copied to clipboard

A copy at a different audio level.

Link copied to clipboard

A copy with different clip-level effects.

Link copied to clipboard
fun withFadeIn(fadeIn: Duration): Clip

A copy whose audio rises from silence over fadeIn.

Link copied to clipboard
fun withFadeOut(fadeOut: Duration): Clip

A copy whose audio falls to silence over fadeOut.

Link copied to clipboard
fun withSnapWithin(snapWithin: Duration): Clip

A copy that lets the cut move back up to snapWithin to reach a sync sample.

Link copied to clipboard
fun withSpeed(speed: Double): Clip

A copy that plays its trim at speed.

Link copied to clipboard
fun withTrim(trim: TimeRange?): Clip

A copy trimmed to trim, or untrimmed when null.