R bindings for OpenTimelineIO (OTIO), built as an Rcpp wrapper over the OTIO C++ library (0.18.x).
It covers the time types, the schema classes, tree construction, JSON
round-trips, and the edit algorithms (overwrite, insert, trim,
slice, slip, slide, ripple, roll, fill, remove) plus
track_trimmed_to_range and flatten_stack. Clips carry the full
media_references map (multiple keyed references with an active key).
Schema versioning is supported too: register_upgrade_function /
register_downgrade_function take R callbacks over the schema dictionary,
to_json_string accepts target_schema_versions to downgrade on write,
and type_version_map reports the registered schema versions.
- Value types are plain classed R values.
RationalTime,TimeRange, andTimeTransformare immutable values, so they live as classed R objects (a named numeric forRationalTime, small lists for the others) and convert to/from C++ only at the call boundary. They print, compare, and serialize naturally in R. - Schema objects are external pointers with OTIO's ref-counting.
Timeline,Stack,Track,Clip, and the rest areSerializableObjects with object identity, parentage, and intrusive reference counting. Each R handle holds a heapRetainer<SerializableObject>inside an external pointer; the object self-deletes only when the last reference (R handle or tree parent) goes away. You neverdeleteone directly. - Names follow OTIO exactly.
source_range,range_in_parent,append_child,media_reference, and so on, withfield<-setters where OTIO has a setter. No invented aliases. - Addressing is by position and reference, never by name. A
nameis a label; sibling items may share one. Tree children are addressed by 1-based position (translated to OTIO's 0-based index at the boundary) and by object reference.
library(RcppOTIO)
tl <- Timeline("my timeline")
trk <- Track("V1", kind = "Video")
clip <- Clip("shot",
ExternalReference("shot.mov"),
source_range = TimeRange(RationalTime(0, 24), RationalTime(48, 24)))
append_child(trk, clip)
append_child(tracks(tl), trk)
duration(tl) # RationalTime(value = 48, rate = 24)
range_in_parent(clip) # where the clip sits in the track
find_clips(tl) # list of clips, recursively
js <- to_json_string(tl) # OTIO JSON
tl2 <- from_json_string(js)
is_equivalent_to(tl, tl2) # TRUErotio is the lightweight sibling: the same OTIO object model and naming, implemented in pure R with no compiled code. RcppOTIO binds the real C++ library; rotio uses it in Suggests as an optional validation oracle, round-tripping its JSON and edit-algorithm output through libopentimelineio in parity tests. If you need OTIO in R without a C++ toolchain, use rotio. If you want the reference implementation itself, you're in the right place.
Building these packages is also what surfaced OpenTimelineIO#2025, an edit-algorithm fix found while parity-testing.
install.packages("RcppOTIO", repos = c(
"https://cornball-ai.github.io/drat",
"https://cloud.r-project.org"
))The OpenTimelineIO C++ library (>= 0.18) and Imath headers must be
installed (default /usr/local). Override at install time with:
R CMD INSTALL --configure-vars='OTIO_HOME=/opt/otio' RcppOTIOApache License 2.0, matching upstream OpenTimelineIO.