mrv2 module

class mrv2.Path

Class used to hold a file path

get(self: mrv2.Path, idx: int = -1, directoru: tl::file::PathType = True) str

Returns the path

getBaseName(self: mrv2.Path) str
getDirectory(self: mrv2.Path) str
getExtension(self: mrv2.Path) str
getNumber(self: mrv2.Path) str
getPadding(self: mrv2.Path) int
isAbsolute(self: mrv2.Path) bool
isEmpty(self: mrv2.Path) bool
class mrv2.RationalTime

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(self: mrv2.RationalTime, other: mrv2.RationalTime, delta: float = 0) bool
static duration_from_start_end_time(start_time: mrv2.RationalTime, end_time_exclusive: mrv2.RationalTime) mrv2.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: mrv2.RationalTime, end_time_inclusive: mrv2.RationalTime) mrv2.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.

static from_frames(frame: float, rate: float) mrv2.RationalTime

Turn a frame number and rate into a RationalTime object.

static from_seconds(*args, **kwargs)

Overloaded function.

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

  2. from_seconds(seconds: float) -> mrv2.RationalTime

static from_time_string(time_string: str, rate: float) mrv2.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) mrv2.RationalTime

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

is_invalid_time(self: mrv2.RationalTime) 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.

rescaled_to(*args, **kwargs)

Overloaded function.

  1. rescaled_to(self: mrv2.RationalTime, new_rate: float) -> mrv2.RationalTime

Returns the time value for time converted to new_rate.

  1. rescaled_to(self: mrv2.RationalTime, other: mrv2.RationalTime) -> mrv2.RationalTime

Returns the time for time converted to new_rate.

to_frames(*args, **kwargs)

Overloaded function.

  1. to_frames(self: mrv2.RationalTime) -> int

Returns the frame number based on the current rate.

  1. to_frames(self: mrv2.RationalTime, rate: float) -> int

Returns the frame number based on the given rate.

to_seconds(self: mrv2.RationalTime) float
to_time_string(self: mrv2.RationalTime) str
to_timecode(*args, **kwargs)

Overloaded function.

  1. to_timecode(self: mrv2.RationalTime, rate: float, drop_frame: object) -> str

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

  1. to_timecode(self: mrv2.RationalTime, rate: float) -> str

  2. to_timecode(self: mrv2.RationalTime) -> str

value_rescaled_to(*args, **kwargs)

Overloaded function.

  1. value_rescaled_to(self: mrv2.RationalTime, new_rate: float) -> float

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

  1. value_rescaled_to(self: mrv2.RationalTime, other: mrv2.RationalTime) -> float

class mrv2.TimeRange

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(*args, **kwargs)

Overloaded function.

  1. before(self: mrv2.TimeRange, other: mrv2.RationalTime, epsilon_s: float = 2.6041666666666666e-06) -> bool

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

          other
            |
[ this ]    *
  1. before(self: mrv2.TimeRange, other: mrv2.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(*args, **kwargs)

Overloaded function.

  1. begins(self: mrv2.TimeRange, other: mrv2.RationalTime, epsilon_s: float = 2.6041666666666666e-06) -> bool

The start of this strictly equals other.

other
  |
  *
  [ this ]
  1. begins(self: mrv2.TimeRange, other: mrv2.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(*args, **kwargs)

Overloaded function.

  1. clamped(self: mrv2.TimeRange, other: mrv2.RationalTime) -> mrv2.RationalTime

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

  1. clamped(self: mrv2.TimeRange, other: mrv2.TimeRange) -> mrv2.TimeRange

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

contains(*args, **kwargs)

Overloaded function.

  1. contains(self: mrv2.TimeRange, other: mrv2.RationalTime) -> bool

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

      other
        |
        *
[      this      ]
  1. contains(self: mrv2.TimeRange, other: mrv2.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)

duration_extended_by(self: mrv2.TimeRange, other: mrv2.RationalTime) mrv2.TimeRange
end_time_exclusive(self: mrv2.TimeRange) mrv2.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(self: mrv2.TimeRange) mrv2.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(self: mrv2.TimeRange, other: mrv2.TimeRange) mrv2.TimeRange

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

finishes(*args, **kwargs)

Overloaded function.

  1. finishes(self: mrv2.TimeRange, other: mrv2.RationalTime, epsilon_s: float = 2.6041666666666666e-06) -> bool

The end of this strictly equals other.

     other
       |
       *
[ this ]
  1. finishes(self: mrv2.TimeRange, other: mrv2.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(self: mrv2.TimeRange, other: mrv2.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(self: mrv2.TimeRange, other: mrv2.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(*args, **kwargs)

Overloaded function.

  1. overlaps(self: mrv2.TimeRange, other: mrv2.RationalTime) -> bool

this contains other.

     other
      |
      *
[    this    ]
  1. overlaps(self: mrv2.TimeRange, other: mrv2.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: mrv2.RationalTime, end_time_exclusive: mrv2.RationalTime) mrv2.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: mrv2.RationalTime, end_time_inclusive: mrv2.RationalTime) mrv2.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.

class mrv2.FileMedia

Class used to hold a media item.

path = mrv2.Path

Path mrv2.Path to the File Media.

audioPath = mrv2.Path

Audio path mrv2.Path to the File Media if any.

timeRange = mrv2.TimeRange

Time range mrv2.TimeRange of the File Media.

playback = mrv2.timeline.Playback

Playback state mrv2.timeline.Playbacks of the File Media.

loop = mrv2.timeline.Loop

Loop state mrv2.timeline.Loop of the File Media.

currentTime = mrv2.RationalTime

Current time mrv2.RationalTime of the File Media.

inOutRange = mrv2.TimeRange

In/Out range mrv2.TimeRange of the File Media.

videoLayer = int

Video layer of the File Media.

volume = float

Volume of the File Media.

mute = bool

Mute state of the File Media.

audioOffset = float

Audio offset of the File Media.