| Title: | Pure-R 'OpenTimelineIO' Document Model |
|---|---|
| Description: | A dependency-light 'OpenTimelineIO' (OTIO) <https://github.com/AcademySoftwareFoundation/OpenTimelineIO> document layer in pure R. Provides constructors for the OTIO object model (timelines, tracks, clips, gaps, media references, rational times and time ranges), functional builders that return new objects, and readers and writers for canonical '.otio' files through 'jsonlite'. The optional 'RcppOTIO' package validates output against the real 'OpenTimelineIO' C++ library. No compiled code. |
| Authors: | Troy Hernandez [aut, cre] (ORCID: <https://orcid.org/0009-0005-4248-604X>), cornball.ai [cph] |
| Maintainer: | Troy Hernandez <[email protected]> |
| License: | Apache License (== 2.0) |
| Version: | 0.1.0 |
| Built: | 2026-06-20 08:49:57 UTC |
| Source: | https://github.com/cornball-ai/rotio |
Active media reference key of a clip
active_media_reference_key(x) active_media_reference_key(x) <- valueactive_media_reference_key(x) active_media_reference_key(x) <- value
x |
A |
value |
New active key. |
The active media reference key, a character string.
cl <- Clip("a", ExternalReference("a.mp4")) active_media_reference_key(cl)cl <- Clip("a", ExternalReference("a.mp4")) active_media_reference_key(cl)
Returns a new composition: a clone of parent with a clone of
child appended. Neither input is mutated (cf. append_child,
which mutates in place).
add_child(parent, child)add_child(parent, child)
parent |
A composition (Track/Stack) or collection. |
child |
An OTIO object. |
A new composition.
v <- add_child(Track("V1"), Clip("a", ExternalReference("a.mp4")))v <- add_child(Track("V1"), Clip("a", ExternalReference("a.mp4")))
Returns a clone of x with effect appended to its effects
list; the input is unchanged.
add_effect(x, effect)add_effect(x, effect)
x |
An item or composition (anything with an |
effect |
An |
A new object of the same class.
clip <- Clip("a", ExternalReference("a.mp4")) clip <- add_effect(clip, LinearTimeWarp(effect_name = "LinearTimeWarp", time_scalar = 2)) length(effects(clip))clip <- Clip("a", ExternalReference("a.mp4")) clip <- add_effect(clip, LinearTimeWarp(effect_name = "LinearTimeWarp", time_scalar = 2)) length(effects(clip))
Returns a new timeline (clone) with a clone of track appended to its
stack. Neither input is mutated.
add_track(timeline, track)add_track(timeline, track)
timeline |
A |
track |
A |
A new timeline.
tl <- add_track(Timeline("demo"), Track("V1", kind = "Video"))tl <- add_track(Timeline("demo"), Track("V1", kind = "Video"))
Rescales a to b's rate and compares to b's value within
delta (in b's rate units), matching opentime.
almost_equal(a, b, delta = 0)almost_equal(a, b, delta = 0)
delta |
Tolerance in |
a, b
|
|
Logical scalar.
almost_equal(RationalTime(24, 24), RationalTime(48, 48))almost_equal(RationalTime(24, 24), RationalTime(48, 48))
Mutates x, attaching child and setting its parent. Errors if
child already has a parent (use remove_child first, or
the functional add_child). Returns x invisibly.
append_child(x, child)append_child(x, child)
x |
A composition or collection. |
child |
An OTIO object with no parent. |
x, invisibly.
trk <- Track("V1") append_child(trk, Clip("a", ExternalReference("a.mp4"))) length(children(trk))trk <- Track("V1") append_child(trk, Clip("a", ExternalReference("a.mp4"))) length(children(trk))
For a media reference, the stored available range. For a clip, the active media reference's available range (errors if none is set, matching OTIO).
available_range(x) available_range(x) <- valueavailable_range(x) available_range(x) <- value
x |
A media reference or clip. |
value |
A |
A TimeRange (NULL for a media reference with none
set); the setter returns x.
ref <- ExternalReference("a.mp4", available_range = TimeRange(RationalTime(0, 30), RationalTime(90, 30))) available_range(ref)ref <- ExternalReference("a.mp4", available_range = TimeRange(RationalTime(0, 30), RationalTime(90, 30))) available_range(ref)
Children of a composition or collection
children(x)children(x)
x |
A composition (Track/Stack) or collection. |
A list of child OTIO objects, in order.
trk <- Track("V1") append_child(trk, Clip("a")) children(trk)trk <- Track("V1") append_child(trk, Clip("a")) children(trk)
tr is the bounding range; other is clamped into it (opentime
TimeRange::clamped).
clamped(tr, other)clamped(tr, other)
tr |
The bounding |
other |
A |
A clamped RationalTime or TimeRange, matching
other.
tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) clamped(tr, RationalTime(96, 24))tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) clamped(tr, RationalTime(96, 24))
Remove all children (in place)
clear_children(x)clear_children(x)
x |
A composition or collection. |
x, invisibly.
trk <- Track("V1") append_child(trk, Clip("a")) clear_children(trk) length(children(trk))trk <- Track("V1") append_child(trk, Clip("a")) clear_children(trk) length(children(trk))
A media reference plus a source_range. The reference is stored under
the DEFAULT_MEDIA key (OTIO's multi-reference model).
Clip(name, media_reference = MissingReference(), source_range = NULL, metadata = NULL)Clip(name, media_reference = MissingReference(), source_range = NULL, metadata = NULL)
name |
Clip name. |
media_reference |
A media reference (default |
source_range |
Optional |
metadata |
Named list of metadata. |
A Clip.
Clip("a", ExternalReference("a.mp4"), source_range = TimeRange(RationalTime(0, 30), RationalTime(90, 30)))Clip("a", ExternalReference("a.mp4"), source_range = TimeRange(RationalTime(0, 30), RationalTime(90, 30)))
Returns a deep copy of x. The clone's parent is reset to NULL
and its descendants' parent pointers are rewired inside the clone, so it is a
fully detached, internally consistent subtree.
clone(x)clone(x)
x |
An OTIO object. |
A deep copy.
tl <- add_track(Timeline("a"), Track("V1")) tl2 <- clone(tl)tl <- add_track(Timeline("a"), Track("V1")) tl2 <- clone(tl)
Get or set an item's display color
color(x) color(x) <- valuecolor(x) color(x) <- value
x |
An item or composition. |
value |
A color value (or |
The item's color value, or NULL if unset.
cl <- Clip("a") color(cl) <- "RED" color(cl)cl <- Clip("a") color(cl) <- "RED" color(cl)
Comment of a Marker
comment(x) comment(x) <- valuecomment(x) comment(x) <- value
x |
A |
value |
New comment. |
The comment string; the setter returns x.
m <- Marker("note", comment = "check color") comment(m)m <- Marker("note", comment = "check color") comment(m)
For a RationalTime: start <= t < end_exclusive. For a
TimeRange: the other range lies strictly within on both ends (tolerance
epsilon_s).
contains(tr, other, epsilon_s = .EPS)contains(tr, other, epsilon_s = .EPS)
tr |
A |
other |
A |
epsilon_s |
Tolerance in seconds. |
Logical scalar.
tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) contains(tr, RationalTime(12, 24))tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) contains(tr, RationalTime(12, 24))
"DEFAULT_MEDIA")The default media reference key ("DEFAULT_MEDIA")
default_media_key()default_media_key()
The string "DEFAULT_MEDIA".
default_media_key()default_media_key()
Effect is a generic effect_name plus metadata parameters.
LinearTimeWarp is OTIO's linear speed change (time_scalar).
Effect(name = "", effect_name = "", enabled = TRUE, metadata = NULL) LinearTimeWarp(name = "", effect_name = "", time_scalar = 1, enabled = TRUE, metadata = NULL) TimeEffect(name = "", effect_name = "", metadata = NULL) FreezeFrame(name = "", metadata = NULL)Effect(name = "", effect_name = "", enabled = TRUE, metadata = NULL) LinearTimeWarp(name = "", effect_name = "", time_scalar = 1, enabled = TRUE, metadata = NULL) TimeEffect(name = "", effect_name = "", metadata = NULL) FreezeFrame(name = "", metadata = NULL)
name |
Effect instance name (default empty). |
effect_name |
Effect kind label (default empty, matching OTIO). |
enabled |
Whether the effect is active (default |
metadata |
Named list of parameters. |
time_scalar |
Linear time scale (playback rate multiplier). |
An Effect.
Effect("blur", "GaussianBlur", metadata = list(size = 4)) LinearTimeWarp("speed", effect_name = "LinearTimeWarp", time_scalar = 2)Effect("blur", "GaussianBlur", metadata = list(size = 4)) LinearTimeWarp("speed", effect_name = "LinearTimeWarp", time_scalar = 2)
Effect kind label
effect_name(x) effect_name(x) <- valueeffect_name(x) effect_name(x) <- value
x |
An |
value |
New effect_name. |
The effect kind string; the setter returns x.
e <- Effect("blur", "GaussianBlur") effect_name(e)e <- Effect("blur", "GaussianBlur") effect_name(e)
Effects of an item or composition
effects(x)effects(x)
x |
An item or composition. |
A list of Effect objects.
clip <- add_effect(Clip("a"), FreezeFrame()) effects(clip)clip <- add_effect(Clip("a"), FreezeFrame()) effects(clip)
A disabled clip/track is muted; a disabled effect is bypassed.
enabled(x) enabled(x) <- valueenabled(x) enabled(x) <- value
x |
An object with an |
value |
|
TRUE if the object is enabled, else FALSE.
cl <- Clip("a") enabled(cl) <- FALSE enabled(cl)cl <- Clip("a") enabled(cl) <- FALSE enabled(cl)
Last frame number of an ImageSequenceReference
end_frame(x)end_frame(x)
x |
Integer frame number of the last image in the sequence.
isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) end_frame(isr)isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) end_frame(isr)
end_time_exclusive = start + duration. end_time_inclusive is the
last whole frame; for a span of one frame or less it is the start time
(matching opentime).
end_time_exclusive(x) end_time_inclusive(x)end_time_exclusive(x) end_time_inclusive(x)
x |
A |
A RationalTime.
tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) end_time_exclusive(tr) end_time_inclusive(tr)tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) end_time_exclusive(tr) end_time_inclusive(tr)
Smallest TimeRange covering two ranges
extended_by(tr, other)extended_by(tr, other)
tr, other
|
|
A TimeRange.
a <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) b <- TimeRange(RationalTime(24, 24), RationalTime(48, 24)) extended_by(a, b)a <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) b <- TimeRange(RationalTime(24, 24), RationalTime(48, 24)) extended_by(a, b)
ExternalReference points a clip at media by URL.
MissingReference is a placeholder for a clip with no resolvable media.
ExternalReference(target_url, available_range = NULL, metadata = NULL) MissingReference(name = "", available_range = NULL, metadata = NULL)ExternalReference(target_url, available_range = NULL, metadata = NULL) MissingReference(name = "", available_range = NULL, metadata = NULL)
target_url |
Media URL for an |
available_range |
Optional |
metadata |
Named list of metadata. |
name |
Reference name (default empty). |
A media reference object.
ExternalReference("media/clip01.mp4") MissingReference()ExternalReference("media/clip01.mp4") MissingReference()
Replaces the gap covering track_time with item. The
reference_point controls the transform: "Source" uses the clip's
own duration, "Sequence" clamps to the gap, "Fit" time-warps the
clip to fill the gap exactly. Mutates track in place.
fill(item, track, track_time, reference_point = "Source")fill(item, track, track_time, reference_point = "Source")
item |
The item to place (usually a clip). |
track |
A |
track_time |
A |
reference_point |
One of |
track, invisibly.
trk <- Track("V1") append_child(trk, Gap(RationalTime(48, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(24, 24))) fill(cl, trk, RationalTime(0, 24)) name(children(trk)[[1]])trk <- Track("V1") append_child(trk, Gap(RationalTime(48, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(24, 24))) fill(cl, trk, RationalTime(0, 24)) name(children(trk)[[1]])
All clips within an object (recursive)
find_clips(x)find_clips(x)
x |
A Timeline, composition, or collection. |
A list of Clip objects.
trk <- Track("V1") append_child(trk, Clip("a")) length(find_clips(trk))trk <- Track("V1") append_child(trk, Clip("a")) length(find_clips(trk))
Composites top-down: starts from the topmost track and fills its holes (gaps and disabled items) with content from the tracks below, recursing downward. Transitions are preserved; a lower transition cut by a hole boundary errors with "Cannot trim in the middle of a transition" (matching OTIO).
flatten_stack(x)flatten_stack(x)
x |
A flattened Track.
trk <- add_child(Track("V1"), Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) flatten_stack(list(trk))trk <- add_child(Track("V1"), Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) flatten_stack(list(trk))
Errors if time falls outside the available range (matching OTIO).
frame_for_time(x, time)frame_for_time(x, time)
x |
|
time |
A |
Integer frame number for time.
isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) frame_for_time(isr, RationalTime(10, 24))isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) frame_for_time(isr, RationalTime(10, 24))
Construct a RationalTime from a frame number at a rate
from_frames(frame, rate)from_frames(frame, rate)
frame |
Integer frame number. |
rate |
Rate (fps). |
A RationalTime.
from_frames(48, 24)from_frames(48, 24)
Read an OTIO JSON file into the object model
from_json_file(file_name)from_json_file(file_name)
file_name |
Path to a |
The reconstructed OTIO object, with parent pointers wired.
f <- tempfile(fileext = ".otio") to_json_file(Timeline("demo"), f) name(from_json_file(f)) unlink(f)f <- tempfile(fileext = ".otio") to_json_file(Timeline("demo"), f) name(from_json_file(f)) unlink(f)
Parse an OTIO JSON string into the object model
from_json_string(input)from_json_string(input)
input |
An OTIO JSON string. |
The reconstructed OTIO object (typically a Timeline),
with parent pointers wired.
tl <- Timeline("demo") identical(name(from_json_string(to_json_string(tl))), "demo")tl <- Timeline("demo") identical(name(from_json_string(to_json_string(tl))), "demo")
Construct a RationalTime from seconds at a rate
from_seconds(seconds, rate = 1)from_seconds(seconds, rate = 1)
seconds |
Numeric seconds. |
rate |
Rate (fps). |
A RationalTime.
from_seconds(1.5, 24)from_seconds(1.5, 24)
Preserves the fractional value (no rounding to a frame boundary).
from_time_string(time_string, rate)from_time_string(time_string, rate)
time_string |
A time string. |
rate |
Rate (fps). |
A RationalTime.
from_time_string("00:00:03.75", 24)from_time_string("00:00:03.75", 24)
A ; frame separator is treated as drop-frame.
from_timecode(timecode, rate)from_timecode(timecode, rate)
timecode |
A |
rate |
Timecode rate. |
A RationalTime.
from_timecode("01:00:00:00", 24)from_timecode("01:00:00:00", 24)
Empty space on a track of a given duration.
Gap(duration, name = "", metadata = NULL)Gap(duration, name = "", metadata = NULL)
duration |
A |
name |
Gap name. |
metadata |
Named list of metadata. |
A Gap.
Gap(RationalTime(15, 30))Gap(RationalTime(15, 30))
Generator kind of a GeneratorReference
generator_kind(x) generator_kind(x) <- valuegenerator_kind(x) generator_kind(x) <- value
x |
|
value |
New generator kind. |
The generator kind string; the setter returns x.
g <- GeneratorReference("bars", generator_kind = "SMPTEBars") generator_kind(g)g <- GeneratorReference("bars", generator_kind = "SMPTEBars") generator_kind(g)
Procedurally-generated media (color bars, solids, ...).
GeneratorReference(name = "", generator_kind = "", available_range = NULL, parameters = NULL, metadata = NULL)GeneratorReference(name = "", generator_kind = "", available_range = NULL, parameters = NULL, metadata = NULL)
name |
Reference name. |
generator_kind |
Generator kind (e.g. |
available_range |
Optional |
parameters |
Named list of generator parameters. |
metadata |
Named list of metadata. |
A GeneratorReference.
GeneratorReference("bars", generator_kind = "SMPTEBars")GeneratorReference("bars", generator_kind = "SMPTEBars")
Global start time of a timeline
global_start_time(x) global_start_time(x) <- valueglobal_start_time(x) global_start_time(x) <- value
x |
A |
value |
A |
The timeline's global start time (a RationalTime or
NULL); the setter returns x.
tl <- Timeline("demo") global_start_time(tl) <- RationalTime(0, 24) global_start_time(tl)tl <- Timeline("demo") global_start_time(tl) <- RationalTime(0, 24) global_start_time(tl)
Does a composition directly contain a child?
has_child(x, child)has_child(x, child)
x |
A composition or collection. |
child |
An OTIO object. |
TRUE if child is a direct child of x, else
FALSE.
trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) has_child(trk, cl)trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) has_child(trk, cl)
Does an object contain any clips (recursive)?
has_clips(x)has_clips(x)
x |
A Timeline, composition, or collection. |
TRUE if x contains at least one clip, else FALSE.
trk <- Track("V1") append_child(trk, Clip("a")) has_clips(trk)trk <- Track("V1") append_child(trk, Clip("a")) has_clips(trk)
A numbered image sequence (e.g. frame.0001.exr).
ImageSequenceReference(target_url_base = "", name_prefix = "", name_suffix = "", start_frame = 1L, frame_step = 1L, rate = 1, frame_zero_padding = 0L, missing_frame_policy = "error", available_range = NULL, metadata = NULL)ImageSequenceReference(target_url_base = "", name_prefix = "", name_suffix = "", start_frame = 1L, frame_step = 1L, rate = 1, frame_zero_padding = 0L, missing_frame_policy = "error", available_range = NULL, metadata = NULL)
target_url_base |
Directory URL. |
start_frame |
First frame number (default 1). |
frame_step |
Frames between images (default 1). |
rate |
Frame rate (default 1). |
frame_zero_padding |
Zero-padding width for the frame number (default 0). |
missing_frame_policy |
One of |
available_range |
Optional |
metadata |
Named list of metadata. |
name_prefix, name_suffix
|
Filename prefix/suffix around the frame number. |
An ImageSequenceReference.
ImageSequenceReference("file:///frames", "frame.", ".exr", frame_zero_padding = 4, rate = 24)ImageSequenceReference("file:///frames", "frame.", ".exr", frame_zero_padding = 4, rate = 24)
1-based position of a child, or NA
index_of_child(x, child)index_of_child(x, child)
x |
A composition or collection. |
child |
An OTIO object. |
The 1-based integer position of child in x, or
NA_integer_ if it is not a direct child.
trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) index_of_child(trk, cl)trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) index_of_child(trk, cl)
Inserts item at time, splitting whatever item spans that point;
before the start it prepends, past the end it appends (filling any gap).
Mutates composition in place.
insert(item, composition, time, remove_transitions = TRUE, fill_template = NULL)insert(item, composition, time, remove_transitions = TRUE, fill_template = NULL)
item |
The item to insert (usually a clip). |
composition |
A |
time |
A |
remove_transitions |
Remove transitions at |
fill_template |
Optional gap template when appending past the end. |
composition, invisibly.
trk <- Track("V1") append_child(trk, Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) cl <- Clip("b", source_range = TimeRange(RationalTime(0, 24), RationalTime(12, 24))) insert(cl, trk, RationalTime(24, 24)) length(children(trk))trk <- Track("V1") append_child(trk, Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) cl <- Clip("b", source_range = TimeRange(RationalTime(0, 24), RationalTime(12, 24))) insert(cl, trk, RationalTime(24, 24)) length(children(trk))
Insert a child at a 1-based position (in place)
insert_child(x, index, child)insert_child(x, index, child)
x |
A composition or collection. |
index |
1-based position. |
child |
An OTIO object with no parent. |
x, invisibly.
trk <- Track("V1") append_child(trk, Clip("b")) insert_child(trk, 1, Clip("a")) name(children(trk)[[1]])trk <- Track("V1") append_child(trk, Clip("b")) insert_child(trk, 1, Clip("a")) name(children(trk)[[1]])
Do two TimeRanges intersect?
intersects(tr, other, epsilon_s = .EPS)intersects(tr, other, epsilon_s = .EPS)
epsilon_s |
Tolerance in seconds. |
tr, other
|
|
Logical scalar.
a <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) b <- TimeRange(RationalTime(24, 24), RationalTime(48, 24)) intersects(a, b)a <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) b <- TimeRange(RationalTime(24, 24), RationalTime(48, 24)) intersects(a, b)
Is x an Effect?
is_effect(x)is_effect(x)
x |
Object to test. |
TRUE if x is an Effect, else FALSE.
is_effect(Effect("blur", "GaussianBlur"))is_effect(Effect("blur", "GaussianBlur"))
Structural equality, compared via canonical OTIO JSON.
is_equivalent_to(x, other)is_equivalent_to(x, other)
x, other
|
OTIO objects. |
Logical scalar.
is_equivalent_to(Timeline("a"), Timeline("a"))is_equivalent_to(Timeline("a"), Timeline("a"))
Is x a MissingReference?
is_missing_reference(x)is_missing_reference(x)
x |
Object to test. |
TRUE if x is a MissingReference, else FALSE.
is_missing_reference(MissingReference())is_missing_reference(MissingReference())
Type predicates for OTIO objects
is_otio(x) is_timeline(x) is_composition(x) is_media_reference(x)is_otio(x) is_timeline(x) is_composition(x) is_media_reference(x)
x |
Object to test. |
TRUE if x is of the corresponding class, else FALSE.
is_otio(Timeline("demo")) is_timeline(Track("V1"))is_otio(Timeline("demo")) is_timeline(Track("V1"))
Is x an ancestor of other?
is_parent_of(x, other)is_parent_of(x, other)
x |
A composition or collection. |
other |
An OTIO object. |
TRUE if x appears anywhere in other's parent
chain, else FALSE.
trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) is_parent_of(trk, cl)trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) is_parent_of(trk, cl)
Is x a RationalTime / TimeRange?
is_rational_time(x) is_time_range(x)is_rational_time(x) is_time_range(x)
x |
Object to test. |
Logical scalar.
is_rational_time(RationalTime(24, 24)) is_time_range(TimeRange(RationalTime(0, 24), RationalTime(48, 24)))is_rational_time(RationalTime(24, 24)) is_time_range(TimeRange(RationalTime(0, 24), RationalTime(48, 24)))
TRUE when the object's schema type is not a recognised OTIO type
(e.g. parsed from JSON written by a newer or third-party schema).
is_unknown_schema(x)is_unknown_schema(x)
x |
An OTIO object. |
A logical scalar.
is_unknown_schema(Timeline("demo"))is_unknown_schema(Timeline("demo"))
A generic OTIO Item (the base class of clips, gaps, and compositions).
Mainly used by the "Fit" reference point of fill, which
wraps media in a plain item carrying a time warp.
Item(name = "", source_range = NULL, effects = NULL, markers = NULL, enabled = TRUE, metadata = NULL)Item(name = "", source_range = NULL, effects = NULL, markers = NULL, enabled = TRUE, metadata = NULL)
name |
Item name. |
source_range |
Optional |
effects |
List of |
markers |
List of |
enabled |
Whether the item is enabled (default |
metadata |
Named list of metadata. |
An Item.
Item("warp", source_range = TimeRange(RationalTime(0, 30), RationalTime(60, 30)))Item("warp", source_range = TimeRange(RationalTime(0, 30), RationalTime(60, 30)))
Get or set a track's kind
kind(x) kind(x) <- valuekind(x) kind(x) <- value
x |
A |
value |
|
The track kind, "Video" or "Audio".
trk <- Track("A1", kind = "Audio") kind(trk)trk <- Track("A1", kind = "Audio") kind(trk)
Marked range of a Marker
marked_range(x) marked_range(x) <- valuemarked_range(x) marked_range(x) <- value
x |
A |
value |
A |
The marker's TimeRange; the setter returns x.
m <- Marker("note", TimeRange(RationalTime(0, 30), RationalTime(30, 30))) marked_range(m)m <- Marker("note", TimeRange(RationalTime(0, 30), RationalTime(30, 30))) marked_range(m)
Annotates a time range on an item.
Marker(name = "", marked_range = NULL, color = "GREEN", comment = "", metadata = NULL)Marker(name = "", marked_range = NULL, color = "GREEN", comment = "", metadata = NULL)
name |
Marker name. |
marked_range |
A |
color |
Marker color (default |
comment |
Free-text comment. |
metadata |
Named list of metadata. |
A Marker.
Marker("note", TimeRange(RationalTime(0, 30), RationalTime(30, 30)), comment = "check color")Marker("note", TimeRange(RationalTime(0, 30), RationalTime(30, 30)), comment = "check color")
Active media reference of a clip
media_reference(x) media_reference(x) <- valuemedia_reference(x) media_reference(x) <- value
x |
A |
value |
A media reference. |
The clip's active media reference object.
cl <- Clip("a", ExternalReference("a.mp4")) media_reference(cl)cl <- Clip("a", ExternalReference("a.mp4")) media_reference(cl)
Media references of a clip
media_references(x)media_references(x)
x |
A |
The clip's named list of media references.
cl <- Clip("a", ExternalReference("a.mp4")) names(media_references(cl))cl <- Clip("a", ExternalReference("a.mp4")) names(media_references(cl))
Construct a generic MediaReference
MediaReference(name = "", available_range = NULL, metadata = NULL)MediaReference(name = "", available_range = NULL, metadata = NULL)
name |
Reference name. |
available_range |
Optional |
metadata |
Named list of metadata. |
A MediaReference.
MediaReference("ref")MediaReference("ref")
Get or set object metadata
metadata(x) metadata(x) <- valuemetadata(x) metadata(x) <- value
x |
An OTIO object. |
value |
A named list. |
The object's metadata as a named list (possibly empty).
cl <- Clip("a") metadata(cl) <- list(note = "take 2") metadata(cl)cl <- Clip("a") metadata(cl) <- list(note = "take 2") metadata(cl)
Get or set the name of an OTIO object
name(x) name(x) <- valuename(x) name(x) <- value
x |
An OTIO object. |
value |
New name. |
The object's name, a character string.
cl <- Clip("a") name(cl) <- "b" name(cl)cl <- Clip("a") name(cl) <- "b" name(cl)
Number of images in an ImageSequenceReference
number_of_images_in_sequence(x)number_of_images_in_sequence(x)
x |
Integer count of images (0 if no available range is set).
isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) number_of_images_in_sequence(isr)isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) number_of_images_in_sequence(isr)
Only transitions overlap (they span a cut); everything else returns
FALSE.
overlapping(x)overlapping(x)
x |
An item. |
Logical scalar.
overlapping(Clip("a", ExternalReference("a.mp4")))overlapping(Clip("a", ExternalReference("a.mp4")))
Do two TimeRanges overlap (cross without containment)?
overlaps(tr, other, epsilon_s = .EPS)overlaps(tr, other, epsilon_s = .EPS)
epsilon_s |
Tolerance in seconds. |
tr, other
|
|
Logical scalar.
a <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) b <- TimeRange(RationalTime(24, 24), RationalTime(48, 24)) overlaps(a, b)a <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) b <- TimeRange(RationalTime(24, 24), RationalTime(48, 24)) overlaps(a, b)
Places item over range (in composition coordinates), partitioning
or removing the items it covers and filling any hole before/after with a gap
(or fill_template). Mutates composition in place.
overwrite(item, composition, range, remove_transitions = TRUE, fill_template = NULL)overwrite(item, composition, range, remove_transitions = TRUE, fill_template = NULL)
item |
The item to place (usually a clip). |
composition |
A |
range |
A |
remove_transitions |
Remove transitions within |
fill_template |
Optional gap template for holes. |
composition, invisibly.
trk <- Track("V1") append_child(trk, Gap(RationalTime(48, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(12, 24))) overwrite(cl, trk, TimeRange(RationalTime(12, 24), RationalTime(12, 24))) length(children(trk))trk <- Track("V1") append_child(trk, Gap(RationalTime(48, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(12, 24))) overwrite(cl, trk, TimeRange(RationalTime(12, 24), RationalTime(12, 24))) length(children(trk))
Parameters of a GeneratorReference
parameters(x) parameters(x) <- valueparameters(x) parameters(x) <- value
x |
|
value |
A named list of parameters. |
A named list of generator parameters; the setter returns x.
g <- GeneratorReference("bars", parameters = list(width = 1920)) parameters(g)g <- GeneratorReference("bars", parameters = list(width = 1920)) parameters(g)
The containing composition/collection, or NULL. A Timeline's root track
Stack is parentless.
parent(x)parent(x)
x |
An OTIO object. |
The parent object or NULL.
trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) name(parent(cl))trk <- Track("V1") cl <- Clip("a") append_child(trk, cl) name(parent(cl))
Presentation time of the nth image (1-based)
presentation_time_for_image_number(x, image_number)presentation_time_for_image_number(x, image_number)
x |
|
image_number |
1-based image index. |
A RationalTime at the reference's rate.
isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) presentation_time_for_image_number(isr, 2)isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) presentation_time_for_image_number(isr, 2)
Duration is computed in the start time's rate (opentime convention).
range_from_start_end_time(start_time, end_time_exclusive)range_from_start_end_time(start_time, end_time_exclusive)
start_time |
A |
end_time_exclusive |
A |
A TimeRange.
range_from_start_end_time(RationalTime(0, 24), RationalTime(48, 24))range_from_start_end_time(RationalTime(0, 24), RationalTime(48, 24))
Computed from the durations of the preceding siblings (gaps included). The duration is the item's trimmed duration.
range_in_parent(x)range_in_parent(x)
x |
An item with a parent. |
A TimeRange in the parent's coordinates.
trk <- Track("V1") cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) range_in_parent(cl)trk <- Track("V1") cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) range_in_parent(cl)
A value / rate pair measured in the rate's units (frame number / fps
for frame-based work).
RationalTime(value, rate = 1)RationalTime(value, rate = 1)
value |
Time value. Coerced to double. |
rate |
Rate (fps); must be > 0. Default 1. |
A RationalTime.
RationalTime(180, 30)RationalTime(180, 30)
Reads <dir>/content.otio into the object model. Media references stay
relative to the bundle directory.
read_otiod(dir)read_otiod(dir)
dir |
Bundle directory. |
The bundle's OTIO object (typically a Timeline).
d <- tempfile("bundle") write_otiod(Timeline("demo"), d) name(read_otiod(d)) unlink(d, recursive = TRUE)d <- tempfile("bundle") write_otiod(Timeline("demo"), d) name(read_otiod(d)) unlink(d, recursive = TRUE)
fn receives the field list of a schema_name object at
version_to_downgrade_from and returns the field list one version lower.
Stored for use when writing older schema versions.
register_downgrade_function(schema_name, version_to_downgrade_from, fn)register_downgrade_function(schema_name, version_to_downgrade_from, fn)
schema_name |
Schema type name. Must be a known OTIO schema. |
version_to_downgrade_from |
Source version (integer). |
fn |
Function of one argument (the field list) returning a field list. |
TRUE if registered; FALSE for an unknown schema or a
duplicate (schema, version) pair (matching RcppOTIO).
register_downgrade_function("Effect", 2, function(fields) fields)register_downgrade_function("Effect", 2, function(fields) fields)
fn receives the parsed field list of a schema_name object at the
version below version_to_upgrade_to and returns the upgraded list. It is
applied automatically by from_json_string when an older version
is read.
register_upgrade_function(schema_name, version_to_upgrade_to, fn)register_upgrade_function(schema_name, version_to_upgrade_to, fn)
schema_name |
Schema type name (e.g. |
version_to_upgrade_to |
Target version (integer). |
fn |
Function of one argument (the field list) returning a field list. |
TRUE if registered; FALSE for an unknown schema or a
duplicate (schema, version) pair (matching RcppOTIO).
register_upgrade_function("Effect", 2, function(fields) fields)register_upgrade_function("Effect", 2, function(fields) fields)
Removes the item covering time; if fill, replaces it with a gap
(or fill_template) of the same range, otherwise the neighbours
concatenate. Mutates composition in place.
remove(composition, time, fill = TRUE, fill_template = NULL)remove(composition, time, fill = TRUE, fill_template = NULL)
composition |
A |
time |
A |
fill |
Fill the hole with a gap/template (default TRUE). |
fill_template |
Optional item to fill with (default a gap). |
composition, invisibly.
trk <- Track("V1") append_child(trk, Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) remove(trk, RationalTime(0, 24)) class(children(trk)[[1]])trk <- Track("V1") append_child(trk, Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) remove(trk, RationalTime(0, 24)) class(children(trk)[[1]])
Remove the child at a position (in place)
remove_child(x, index)remove_child(x, index)
x |
A composition or collection. |
index |
1-based position. |
x, invisibly.
trk <- Track("V1") append_child(trk, Clip("a")) remove_child(trk, 1) length(children(trk))trk <- Track("V1") append_child(trk, Clip("a")) remove_child(trk, 1) length(children(trk))
Rescale a RationalTime to a new rate
rescaled_to(x, new_rate)rescaled_to(x, new_rate)
x |
A |
new_rate |
Target rate (fps). |
A RationalTime at new_rate.
rescaled_to(RationalTime(24, 24), 48)rescaled_to(RationalTime(24, 24), 48)
Adjusts the item's source_range start by delta_in and exclusive
end by delta_out without moving any other item. Mutates in place.
ripple(item, delta_in, delta_out)ripple(item, delta_in, delta_out)
item |
An item (usually a clip). |
delta_in, delta_out
|
|
item, invisibly.
cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) ripple(cl, RationalTime(0, 24), RationalTime(12, 24)) source_range(cl)cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) ripple(cl, RationalTime(0, 24), RationalTime(12, 24)) source_range(cl)
Adjusts the item's start by delta_in and exclusive end by
delta_out, absorbing the change into the neighbouring items' source
ranges (no new items are created); clamps to media available ranges. Mutates
in place.
roll(item, delta_in, delta_out)roll(item, delta_in, delta_out)
item |
An item (usually a clip). |
delta_in, delta_out
|
|
item, invisibly.
trk <- Track("V1") a <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(24, 24))) b <- Clip("b", source_range = TimeRange(RationalTime(24, 24), RationalTime(24, 24))) append_child(trk, a) append_child(trk, b) roll(b, RationalTime(-6, 24), RationalTime(0, 24))trk <- Track("V1") a <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(24, 24))) b <- Clip("b", source_range = TimeRange(RationalTime(24, 24), RationalTime(24, 24))) append_child(trk, a) append_child(trk, b) roll(b, RationalTime(-6, 24), RationalTime(0, 24))
The schema type (without the version suffix); unrecognised types report
"UnknownSchema" (matching OTIO).
schema_name(x)schema_name(x)
x |
An OTIO object. |
A character scalar.
schema_name(Clip("shot1"))schema_name(Clip("shot1"))
Schema version of an OTIO object
schema_version(x)schema_version(x)
x |
An OTIO object. |
An integer.
schema_version(Clip("shot1"))schema_version(Clip("shot1"))
A flat, named collection of OTIO objects (not a composition).
SerializableCollection(name = "", children = list(), metadata = NULL)SerializableCollection(name = "", children = list(), metadata = NULL)
name |
Collection name. |
children |
A list of OTIO objects. |
metadata |
Named list of metadata. |
A SerializableCollection.
col <- SerializableCollection("shots", list(Clip("a"), Clip("b"))) length(children(col))col <- SerializableCollection("shots", list(Clip("a"), Clip("b"))) length(children(col))
Detaches the replaced child and attaches the new one. Returns x
invisibly.
set_child(x, index, child)set_child(x, index, child)
x |
A composition or collection. |
index |
1-based position. |
child |
An OTIO object with no parent. |
x, invisibly.
trk <- Track("V1") append_child(trk, Clip("a")) set_child(trk, 1, Clip("b")) name(children(trk)[[1]])trk <- Track("V1") append_child(trk, Clip("a")) set_child(trk, 1, Clip("b")) name(children(trk)[[1]])
Available as set_children(x, kids) and set_children(x) <- kids.
set_children(x, children) set_children(x) <- valueset_children(x, children) set_children(x) <- value
x |
A composition or collection. |
children, value
|
A list of parentless OTIO objects. |
x (invisibly from the function form).
trk <- Track("V1") set_children(trk, list(Clip("a"), Clip("b"))) length(children(trk))trk <- Track("V1") set_children(trk, list(Clip("a"), Clip("b"))) length(children(trk))
Replace the media references of a clip (in place)
set_media_references(x, media_references, new_active_key = NULL)set_media_references(x, media_references, new_active_key = NULL)
x |
A |
media_references |
A named list of media references. |
new_active_key |
Optional new active key. |
x, invisibly.
cl <- Clip("a") set_media_references(cl, list(DEFAULT_MEDIA = ExternalReference("a.mp4"))) target_url(cl)cl <- Clip("a") set_media_references(cl, list(DEFAULT_MEDIA = ExternalReference("a.mp4"))) target_url(cl)
Splits the item covering time into two adjacent items at that point.
Mutates composition in place. A slice exactly at an item boundary is a
no-op; slicing through a transition removes it (or errors if
remove_transitions is FALSE).
slice(composition, time, remove_transitions = TRUE)slice(composition, time, remove_transitions = TRUE)
composition |
A |
time |
A |
remove_transitions |
Remove transitions at |
composition, invisibly.
trk <- Track("V1") append_child(trk, Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) slice(trk, RationalTime(24, 24)) length(children(trk))trk <- Track("V1") append_child(trk, Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) slice(trk, RationalTime(24, 24)) length(children(trk))
Moves the item's start by delta by changing the previous item's
duration; the item's own source range is unchanged. No-op for the first item.
Mutates in place.
slide(item, delta)slide(item, delta)
item |
An item (usually a clip). |
delta |
A |
item, invisibly.
trk <- Track("V1") append_child(trk, Gap(RationalTime(24, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) slide(cl, RationalTime(-6, 24))trk <- Track("V1") append_child(trk, Gap(RationalTime(24, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) slide(cl, RationalTime(-6, 24))
Shifts the item's source_range start by delta without changing
its duration or any surrounding item; clamps to the media available range when
present. Mutates item in place.
slip(item, delta)slip(item, delta)
item |
An item (usually a clip). |
delta |
A |
item, invisibly.
cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) slip(cl, RationalTime(6, 24)) source_range(cl)cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) slip(cl, RationalTime(6, 24)) source_range(cl)
Get or set an item's source range
source_range(x) source_range(x) <- valuesource_range(x) source_range(x) <- value
x |
An item (clip, gap, track). |
value |
A |
The item's TimeRange, or NULL if unset.
cl <- Clip("a") source_range(cl) <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) source_range(cl)cl <- Clip("a") source_range(cl) <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) source_range(cl)
Parallel tracks (a Timeline's tracks is a Stack).
Stack(name = "tracks", source_range = NULL, metadata = NULL)Stack(name = "tracks", source_range = NULL, metadata = NULL)
name |
Stack name (default |
source_range |
Optional |
metadata |
Named list of metadata. |
A Stack.
Stack()Stack()
TimeRange start_time and duration
start_time(x) duration(x)start_time(x) duration(x)
x |
A |
A RationalTime.
tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) start_time(tr) duration(tr)tr <- TimeRange(RationalTime(0, 24), RationalTime(48, 24)) start_time(tr) duration(tr)
Target URL of a clip or external reference
target_url(x) target_url(x) <- valuetarget_url(x) target_url(x) <- value
x |
A |
value |
New URL. |
The target URL string, or NULL if the active reference has
no URL.
cl <- Clip("a", ExternalReference("a.mp4")) target_url(cl) <- "b.mp4" target_url(cl)cl <- Clip("a", ExternalReference("a.mp4")) target_url(cl) <- "b.mp4" target_url(cl)
ImageSequenceReference fields
target_url_base(x) target_url_base(x) <- value name_prefix(x) name_suffix(x) start_frame(x) frame_step(x) frame_zero_padding(x)target_url_base(x) target_url_base(x) <- value name_prefix(x) name_suffix(x) start_frame(x) frame_step(x) frame_zero_padding(x)
x |
|
value |
New value. |
The stored field value; the setter returns x.
isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", frame_zero_padding = 4, rate = 24) target_url_base(isr) start_frame(isr)isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", frame_zero_padding = 4, rate = 24) target_url_base(isr) start_frame(isr)
Target URL of the nth image (1-based)
target_url_for_image_number(x, image_number)target_url_for_image_number(x, image_number)
x |
|
image_number |
1-based image index. |
The image URL as a string.
isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", frame_zero_padding = 4, rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) target_url_for_image_number(isr, 1)isr <- ImageSequenceReference("file:///frames", "frame.", ".exr", frame_zero_padding = 4, rate = 24, available_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) target_url_for_image_number(isr, 1)
Time scalar of a LinearTimeWarp
time_scalar(x) time_scalar(x) <- valuetime_scalar(x) time_scalar(x) <- value
x |
|
value |
New time scalar. |
The numeric time scalar; the setter returns x.
w <- LinearTimeWarp(effect_name = "LinearTimeWarp", time_scalar = 2) time_scalar(w)w <- LinearTimeWarp(effect_name = "LinearTimeWarp", time_scalar = 2) time_scalar(w)
Wraps a Stack of tracks. Add tracks with add_track.
Timeline(name = "", global_start_time = NULL, metadata = NULL)Timeline(name = "", global_start_time = NULL, metadata = NULL)
name |
Timeline name. |
global_start_time |
Optional |
metadata |
Named list of metadata. |
A Timeline.
Timeline("demo")Timeline("demo")
A start_time plus a duration, both RationalTime.
TimeRange(start_time, duration)TimeRange(start_time, duration)
start_time |
A |
duration |
A |
A TimeRange.
TimeRange(RationalTime(0, 30), RationalTime(180, 30))TimeRange(RationalTime(0, 30), RationalTime(180, 30))
An offset/scale/rate transform (OTIO TimeTransform). Note: in RcppOTIO
TimeTransform is a plain opentime value type that does not serialize to
JSON; rotio gives it an OTIO_SCHEMA for its own (de)serialization,
which is not verified against RcppOTIO JSON.
TimeTransform(offset = RationalTime(0, 1), scale = 1, rate = -1)TimeTransform(offset = RationalTime(0, 1), scale = 1, rate = -1)
offset |
A |
scale |
Time scale (default 1). |
rate |
Target rate, or -1 to preserve (default -1). |
A TimeTransform.
TimeTransform(RationalTime(12, 24), scale = 2)TimeTransform(RationalTime(12, 24), scale = 2)
Integer frame number. With no rate, truncates at the time's own rate;
with a rate, rescales first. Truncates toward zero (opentime
int(value_rescaled_to(rate))).
to_frames(x, rate = NULL)to_frames(x, rate = NULL)
x |
A |
rate |
Optional target rate to rescale to first. |
Integer scalar, the frame number.
to_frames(from_seconds(1.5, 24)) to_frames(RationalTime(48, 24), 48)to_frames(from_seconds(1.5, 24)) to_frames(RationalTime(48, 24), 48)
Write an OTIO object to a JSON file
to_json_file(x, file_name, indent = 2, target_schema_versions = NULL)to_json_file(x, file_name, indent = 2, target_schema_versions = NULL)
x |
An OTIO object (typically a |
file_name |
Output path (conventionally |
indent |
Indent width (default 2). |
target_schema_versions |
Optional schema downgrade targets; see
|
file_name, invisibly.
f <- tempfile(fileext = ".otio") to_json_file(Timeline("demo"), f) unlink(f)f <- tempfile(fileext = ".otio") to_json_file(Timeline("demo"), f) unlink(f)
Emits canonical OpenTimelineIO JSON. Each object carries its own
OTIO_SCHEMA, so the output is the standard .otio format and
parses in any OTIO reader (verify with validate_with_RcppOTIO).
to_json_string(x, indent = 2, target_schema_versions = NULL)to_json_string(x, indent = 2, target_schema_versions = NULL)
x |
An OTIO object (typically a |
indent |
Indent width for pretty-printing (default 2). Use 0 for compact. |
target_schema_versions |
Optional named integer vector mapping schema
type to a target version; objects above that version are downgraded using
the registered downgrade functions (e.g. |
A JSON string.
to_json_string(Timeline("demo"))to_json_string(Timeline("demo"))
Convert a RationalTime to seconds
to_seconds(x)to_seconds(x)
x |
A |
Numeric scalar, the time in seconds.
to_seconds(RationalTime(48, 24))to_seconds(RationalTime(48, 24))
Time string ("HH:MM:SS.sss") for a RationalTime
to_time_string(x)to_time_string(x)
x |
A |
Character scalar, the time as "HH:MM:SS.sss".
to_time_string(RationalTime(90, 24))to_time_string(RationalTime(90, 24))
SMPTE timecode for a RationalTime
to_timecode(x, rate = NULL, drop_frame = NULL)to_timecode(x, rate = NULL, drop_frame = NULL)
x |
A |
rate |
Timecode rate (default |
drop_frame |
Drop-frame timecode. |
Character scalar, the timecode as "HH:MM:SS:FF" (or
";FF" for drop-frame).
to_timecode(RationalTime(86400, 24))to_timecode(RationalTime(86400, 24))
An ordered sequence of items. Add children with add_child (or
the mutating append_child).
Track(name, kind = "Video", source_range = NULL, metadata = NULL)Track(name, kind = "Video", source_range = NULL, metadata = NULL)
name |
Track name. |
kind |
|
source_range |
Optional |
metadata |
Named list of metadata. |
A Track.
Track("V1", kind = "Video")Track("V1", kind = "Video")
Returns a new track containing each child trimmed to the portion that falls
within trim_range (in track coordinates); children fully outside are
dropped.
track_trimmed_to_range(in_track, trim_range)track_trimmed_to_range(in_track, trim_range)
in_track |
A |
trim_range |
A |
A new Track.
trk <- add_child(Track("V1"), Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) track_trimmed_to_range(trk, TimeRange(RationalTime(0, 24), RationalTime(24, 24)))trk <- add_child(Track("V1"), Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))) track_trimmed_to_range(trk, TimeRange(RationalTime(0, 24), RationalTime(24, 24)))
The track stack of a timeline
tracks(x) tracks(x) <- valuetracks(x) tracks(x) <- value
x |
A |
value |
A |
The timeline's Stack.
tl <- add_track(Timeline("demo"), Track("V1", kind = "Video")) length(children(tracks(tl)))tl <- add_track(Timeline("demo"), Track("V1", kind = "Video")) length(children(tracks(tl)))
A transition (e.g. a dissolve) between adjacent items on a track.
Transition(name = "", transition_type = "", in_offset = RationalTime(0, 1), out_offset = RationalTime(0, 1), metadata = NULL)Transition(name = "", transition_type = "", in_offset = RationalTime(0, 1), out_offset = RationalTime(0, 1), metadata = NULL)
name |
Transition name. |
transition_type |
Transition type (e.g. |
metadata |
Named list of metadata. |
in_offset, out_offset
|
|
A Transition.
Transition(transition_type = "SMPTE_Dissolve", in_offset = RationalTime(5, 30), out_offset = RationalTime(5, 30))Transition(transition_type = "SMPTE_Dissolve", in_offset = RationalTime(5, 30), out_offset = RationalTime(5, 30))
Transition type / offsets
transition_type(x) transition_type(x) <- value in_offset(x) in_offset(x) <- value out_offset(x) out_offset(x) <- valuetransition_type(x) transition_type(x) <- value in_offset(x) in_offset(x) <- value out_offset(x) out_offset(x) <- value
x |
A |
value |
New value. |
transition_type returns a string, in_offset and
out_offset a RationalTime; setters return x.
tr <- Transition(transition_type = "SMPTE_Dissolve", in_offset = RationalTime(5, 30), out_offset = RationalTime(5, 30)) transition_type(tr) in_offset(tr)tr <- Transition(transition_type = "SMPTE_Dissolve", in_offset = RationalTime(5, 30), out_offset = RationalTime(5, 30)) transition_type(tr) in_offset(tr)
Adjusts the item's start by delta_in (also extending the previous
item) and its exclusive end by delta_out, filling now-empty time with a
gap (or fill_template); an adjacent gap is grown instead. Mutates in
place.
trim(item, delta_in, delta_out, fill_template = NULL)trim(item, delta_in, delta_out, fill_template = NULL)
item |
An item (usually a clip). |
fill_template |
Optional item to fill freed time with (default a gap). |
delta_in, delta_out
|
|
item, invisibly.
trk <- Track("V1") cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) trim(cl, RationalTime(6, 24), RationalTime(0, 24)) source_range(cl)trk <- Track("V1") cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) trim(cl, RationalTime(6, 24), RationalTime(0, 24)) source_range(cl)
The item's source_range if set, else (for a clip) the active media
reference's available range.
trimmed_range(x)trimmed_range(x)
x |
An item (clip, gap). |
A TimeRange.
cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) trimmed_range(cl)cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) trimmed_range(cl)
Range of an item within its parent, trimmed by the parent's source range
trimmed_range_in_parent(x)trimmed_range_in_parent(x)
x |
An item with a parent. |
A TimeRange.
trk <- Track("V1", source_range = TimeRange(RationalTime(12, 24), RationalTime(24, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) trimmed_range_in_parent(cl)trk <- Track("V1", source_range = TimeRange(RationalTime(12, 24), RationalTime(24, 24))) cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) trimmed_range_in_parent(cl)
A named integer vector mapping each schema type to its current version, matching OpenTimelineIO 0.18.1.
type_version_map()type_version_map()
A named integer vector.
type_version_map()["Clip"]type_version_map()["Clip"]
Serializes x to OTIO JSON, parses it with RcppOTIO (the exact
libopentimelineio binding), and re-serializes through RcppOTIO. Confirms the
emitted JSON is accepted by real OTIO. Requires the optional RcppOTIO
package.
validate_with_RcppOTIO(x)validate_with_RcppOTIO(x)
x |
An OTIO object (typically a |
Invisibly, a list with status ("valid" or
"unverified") and, when validated, the RcppOTIO-normalized JSON.
validate_with_RcppOTIO(Timeline("demo"))validate_with_RcppOTIO(Timeline("demo"))
RationalTime value and rate
value(x) rate(x)value(x) rate(x)
x |
A |
Numeric scalar, the time's value or rate.
value(RationalTime(180, 30)) rate(RationalTime(180, 30))value(RationalTime(180, 30)) rate(RationalTime(180, 30))
Video / audio tracks of a timeline
video_tracks(x) audio_tracks(x)video_tracks(x) audio_tracks(x)
x |
A |
A list of Tracks of the matching kind.
tl <- add_track(Timeline("demo"), Track("V1", kind = "Video")) video_tracks(tl) audio_tracks(tl)tl <- add_track(Timeline("demo"), Track("V1", kind = "Video")) video_tracks(tl) audio_tracks(tl)
A Gap is never visible; a Transition always is; any other item is visible when enabled (matching OTIO).
visible(x)visible(x)
x |
An item. |
Logical scalar.
visible(Gap(RationalTime(24, 24))) visible(Clip("a", ExternalReference("a.mp4")))visible(Gap(RationalTime(24, 24))) visible(Clip("a", ExternalReference("a.mp4")))
Visible range of an item (including adjacent transitions)
visible_range(x)visible_range(x)
x |
An item with a parent. |
A TimeRange.
trk <- Track("V1") cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) visible_range(cl)trk <- Track("V1") cl <- Clip("a", source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24))) append_child(trk, cl) visible_range(cl)
Writes timeline to <dir>/content.otio and ensures a
media/ subdirectory exists. Optionally copies media files into
it. Media references inside timeline should already be relative paths
(e.g. "media/clip01.mp4"); this writer does not rewrite them.
write_otiod(timeline, dir, media = NULL, indent = 2)write_otiod(timeline, dir, media = NULL, indent = 2)
timeline |
A |
dir |
Bundle directory (created if needed). |
media |
Optional character vector of media files to copy into
|
indent |
Indent width for content.otio (default 2). |
The path to the written content.otio, invisibly.
d <- tempfile("bundle") write_otiod(Timeline("demo"), d) dir(d) unlink(d, recursive = TRUE)d <- tempfile("bundle") write_otiod(Timeline("demo"), d) dir(d) unlink(d, recursive = TRUE)