opentimelineio.opentime

class opentimelineio.opentime.RationalTime(value: float = 0, rate: float = 1)

The RationalTime class represents a measure of time of \(rt.value/rt.rate\) seconds. It can be rescaled into another RationalTime’s rate.

almost_equal(other: opentimelineio._opentime.RationalTime, delta: float = 0) bool
ceil() opentimelineio._opentime.RationalTime
static duration_from_start_end_time(start_time: opentimelineio._opentime.RationalTime, end_time_exclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime

Compute the duration of samples from first to last (excluding last). This is not the same as distance.

For example, the duration of a clip from frame 10 to frame 15 is 5 frames. Result will be in the rate of start_time.

static duration_from_start_end_time_inclusive(start_time: opentimelineio._opentime.RationalTime, end_time_inclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime

Compute the duration of samples from first to last (including last). This is not the same as distance.

For example, the duration of a clip from frame 10 to frame 15 is 6 frames. Result will be in the rate of start_time.

floor() opentimelineio._opentime.RationalTime
static from_frames(frame: float, rate: float) opentimelineio._opentime.RationalTime

Turn a frame number and rate into a RationalTime object.

static from_seconds(seconds: float, rate: float) opentimelineio._opentime.RationalTime
static from_seconds(seconds: float) opentimelineio._opentime.RationalTime

Overloaded function.

  1. from_seconds(seconds: float, rate: float) -> opentimelineio._opentime.RationalTime

  2. from_seconds(seconds: float) -> opentimelineio._opentime.RationalTime

static from_time_string(time_string: str, rate: float) opentimelineio._opentime.RationalTime

Convert a time with microseconds string (HH:MM:ss where ss is an integer or a decimal number) into a RationalTime.

static from_timecode(timecode: str, rate: float) opentimelineio._opentime.RationalTime

Convert a timecode string (HH:MM:SS;FRAME) into a RationalTime.

is_invalid_time() bool

Returns true if the time is invalid. The time is considered invalid if the value or the rate are a NaN value or if the rate is less than or equal to zero.

static is_valid_timecode_rate(rate: float) bool

Returns true if the rate is valid for use with timecode.

static nearest_valid_timecode_rate(rate: float) float

Returns the first valid timecode rate that has the least difference from the given value.

property rate
rescaled_to(new_rate: float) opentimelineio._opentime.RationalTime
rescaled_to(other: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime

Overloaded function.

  1. rescaled_to(new_rate: float) -> opentimelineio._opentime.RationalTime

Returns the time value for time converted to new_rate.

  1. rescaled_to(other: opentimelineio._opentime.RationalTime) -> opentimelineio._opentime.RationalTime

Returns the time for time converted to new_rate.

round() opentimelineio._opentime.RationalTime
strictly_equal(other: opentimelineio._opentime.RationalTime) bool
to_frames() int
to_frames(rate: float) int

Overloaded function.

  1. to_frames() -> int

Returns the frame number based on the current rate.

  1. to_frames(rate: float) -> int

Returns the frame number based on the given rate.

to_nearest_timecode(rate: float, drop_frame: Optional[bool]) str
to_nearest_timecode(rate: float) str
to_nearest_timecode() str

Overloaded function.

  1. to_nearest_timecode(rate: float, drop_frame: Optional[bool]) -> str

Convert to nearest timecode (HH:MM:SS;FRAME)

  1. to_nearest_timecode(rate: float) -> str

  2. to_nearest_timecode() -> str

to_seconds() float
to_time_string() str
to_timecode(rate: float, drop_frame: Optional[bool]) str
to_timecode(rate: float) str
to_timecode() str

Overloaded function.

  1. to_timecode(rate: float, drop_frame: Optional[bool]) -> str

Convert to timecode (HH:MM:SS;FRAME)

  1. to_timecode(rate: float) -> str

  2. to_timecode() -> str

property value
value_rescaled_to(new_rate: float) float
value_rescaled_to(other: opentimelineio._opentime.RationalTime) float

Overloaded function.

  1. value_rescaled_to(new_rate: float) -> float

Returns the time value for “self” converted to new_rate.

  1. value_rescaled_to(other: opentimelineio._opentime.RationalTime) -> float

class opentimelineio.opentime.TimeRange(start_time: opentimelineio._opentime.RationalTime = None, duration: opentimelineio._opentime.RationalTime = None)

The TimeRange class represents a range in time. It encodes the start time and the duration, meaning that end_time_inclusive() (last portion of a sample in the time range) and end_time_exclusive() can be computed.

before(other: opentimelineio._opentime.RationalTime, epsilon_s: float = 2.6041666666666666e-06) bool
before(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

Overloaded function.

  1. before(other: opentimelineio._opentime.RationalTime, epsilon_s: float = 2.6041666666666666e-06) -> bool

The end of this strictly precedes other by a value >= epsilon_s.

          other
            ↓
[ this ]    *
  1. before(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) -> bool

The end of this strictly equals the start of other and the start of this strictly equals the end of other.

[this][other]

The converse would be other.meets(this)

begins(other: opentimelineio._opentime.RationalTime, epsilon_s: float = 2.6041666666666666e-06) bool
begins(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

Overloaded function.

  1. begins(other: opentimelineio._opentime.RationalTime, epsilon_s: float = 2.6041666666666666e-06) -> bool

The start of this strictly equals other.

other
  ↓
  *
  [ this ]
  1. begins(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) -> bool

The start of this strictly equals the start of other. The end of this strictly precedes the end of other by a value >= epsilon_s.

[ this ]
[    other    ]

The converse would be other.begins(this)

clamped(other: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime
clamped(other: opentimelineio._opentime.TimeRange) opentimelineio._opentime.TimeRange

Overloaded function.

  1. clamped(other: opentimelineio._opentime.RationalTime) -> opentimelineio._opentime.RationalTime

Clamp ‘other’ (RationalTime) according to start_time/end_time_exclusive and bound arguments.

  1. clamped(other: opentimelineio._opentime.TimeRange) -> opentimelineio._opentime.TimeRange

Clamp ‘other’ (TimeRange) according to start_time/end_time_exclusive and bound arguments.

contains(other: opentimelineio._opentime.RationalTime) bool
contains(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

Overloaded function.

  1. contains(other: opentimelineio._opentime.RationalTime) -> bool

The start of this precedes other. other precedes the end of this.

      other
        ↓
        *
[      this      ]
  1. contains(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) -> bool

The start of this precedes start of other. The end of this antecedes end of other.

     [ other ]
[      this      ]

The converse would be other.contains(this)

property duration
duration_extended_by(other: opentimelineio._opentime.RationalTime) opentimelineio._opentime.TimeRange
end_time_exclusive() opentimelineio._opentime.RationalTime

Time of the first sample outside the time range.

If start frame is 10 and duration is 5, then end_time_exclusive is 15, because the last time with data in this range is 14.

If start frame is 10 and duration is 5.5, then end_time_exclusive is 15.5, because the last time with data in this range is 15.

end_time_inclusive() opentimelineio._opentime.RationalTime

The time of the last sample containing data in the time range.

If the time range starts at (0, 24) with duration (10, 24), this will be (9, 24)

If the time range starts at (0, 24) with duration (10.5, 24): (10, 24)

In other words, the last frame with data, even if the last frame is fractional.

extended_by(other: opentimelineio._opentime.TimeRange) opentimelineio._opentime.TimeRange

Construct a new TimeRange that is this one extended by other.

finishes(other: opentimelineio._opentime.RationalTime, epsilon_s: float = 2.6041666666666666e-06) bool
finishes(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

Overloaded function.

  1. finishes(other: opentimelineio._opentime.RationalTime, epsilon_s: float = 2.6041666666666666e-06) -> bool

The end of this strictly equals other.

     other
       ↓
       *
[ this ]
  1. finishes(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) -> bool

The start of this strictly antecedes the start of other by a value >= epsilon_s. The end of this strictly equals the end of other.

        [ this ]
[     other    ]

The converse would be other.finishes(this)

intersects(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

The start of this precedes or equals the end of other by a value >= epsilon_s. The end of this antecedes or equals the start of other by a value >= epsilon_s.

[    this    ]           OR      [    other    ]
     [     other    ]                    [     this    ]

The converse would be other.finishes(this)

meets(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

The end of this strictly equals the start of other and the start of this strictly equals the end of other.

[this][other]

The converse would be other.meets(this)

overlaps(other: opentimelineio._opentime.RationalTime) bool
overlaps(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) bool

Overloaded function.

  1. overlaps(other: opentimelineio._opentime.RationalTime) -> bool

this contains other.

     other
      ↓
      *
[    this    ]
  1. overlaps(other: opentimelineio._opentime.TimeRange, epsilon_s: float = 2.6041666666666666e-06) -> bool

The start of this strictly precedes end of other by a value >= epsilon_s. The end of this strictly antecedes start of other by a value >= epsilon_s.

[ this ]
    [ other ]

The converse would be other.overlaps(this)

static range_from_start_end_time(start_time: opentimelineio._opentime.RationalTime, end_time_exclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.TimeRange

Creates a TimeRange from start and end RationalTimes (exclusive).

For example, if start_time is 1 and end_time is 10, the returned will have a duration of 9.

static range_from_start_end_time_inclusive(start_time: opentimelineio._opentime.RationalTime, end_time_inclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.TimeRange

Creates a TimeRange from start and end RationalTimes (inclusive).

For example, if start_time is 1 and end_time is 10, the returned will have a duration of 10.

property start_time
class opentimelineio.opentime.TimeTransform(offset: opentimelineio._opentime.RationalTime = otio.opentime.RationalTime(value=0, rate=1), scale: float = 1, rate: float = -1)

1D transform for RationalTime. Has offset and scale.

applied_to(other: opentimelineio._opentime.TimeRange) opentimelineio._opentime.TimeRange
applied_to(other: opentimelineio._opentime.TimeTransform) opentimelineio._opentime.TimeTransform
applied_to(other: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime

Overloaded function.

  1. applied_to(other: opentimelineio._opentime.TimeRange) -> opentimelineio._opentime.TimeRange

  2. applied_to(other: opentimelineio._opentime.TimeTransform) -> opentimelineio._opentime.TimeTransform

  3. applied_to(other: opentimelineio._opentime.RationalTime) -> opentimelineio._opentime.RationalTime

property offset
property rate
property scale
opentimelineio.opentime.duration_from_start_end_time(start_time: opentimelineio._opentime.RationalTime, end_time_exclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime

Compute the duration of samples from first to last (excluding last). This is not the same as distance.

For example, the duration of a clip from frame 10 to frame 15 is 5 frames. Result will be in the rate of start_time.

opentimelineio.opentime.duration_from_start_end_time_inclusive(start_time: opentimelineio._opentime.RationalTime, end_time_inclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.RationalTime

Compute the duration of samples from first to last (including last). This is not the same as distance.

For example, the duration of a clip from frame 10 to frame 15 is 6 frames. Result will be in the rate of start_time.

opentimelineio.opentime.from_frames(frame: float, rate: float) opentimelineio._opentime.RationalTime

Turn a frame number and rate into a RationalTime object.

opentimelineio.opentime.from_seconds(seconds: float, rate: float) opentimelineio._opentime.RationalTime
opentimelineio.opentime.from_seconds(seconds: float) opentimelineio._opentime.RationalTime

Overloaded function.

  1. from_seconds(seconds: float, rate: float) -> opentimelineio._opentime.RationalTime

  2. from_seconds(seconds: float) -> opentimelineio._opentime.RationalTime

opentimelineio.opentime.from_time_string(time_string: str, rate: float) opentimelineio._opentime.RationalTime

Convert a time with microseconds string (HH:MM:ss where ss is an integer or a decimal number) into a RationalTime.

opentimelineio.opentime.from_timecode(timecode: str, rate: float) opentimelineio._opentime.RationalTime

Convert a timecode string (HH:MM:SS;FRAME) into a RationalTime.

opentimelineio.opentime.range_from_start_end_time(start_time: opentimelineio._opentime.RationalTime, end_time_exclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.TimeRange

Creates a TimeRange from start and end RationalTimes (exclusive).

For example, if start_time is 1 and end_time is 10, the returned will have a duration of 9.

opentimelineio.opentime.range_from_start_end_time_inclusive(start_time: opentimelineio._opentime.RationalTime, end_time_inclusive: opentimelineio._opentime.RationalTime) opentimelineio._opentime.TimeRange

Creates a TimeRange from start and end RationalTimes (inclusive).

For example, if start_time is 1 and end_time is 10, the returned will have a duration of 10.

opentimelineio.opentime.to_frames(rt, rate=None)

Turn a RationalTime into a frame number.

opentimelineio.opentime.to_nearest_timecode(rt, rate=None, drop_frame=None)

Convert a RationalTime into a timecode string.

opentimelineio.opentime.to_seconds(rt)

Convert a RationalTime into float seconds

opentimelineio.opentime.to_time_string(rt)

Convert this timecode to time as used by ffmpeg, formatted as hh:mm:ss where ss is an integer or decimal number.

opentimelineio.opentime.to_timecode(rt, rate=None, drop_frame=None)

Convert a RationalTime into a timecode string.