mp.Timestamp

A class which represents a timestamp in the MediaPipe framework.

MediaPipe timestamps are in units of microseconds. There are several special values (All these values must be constructed using the static methods provided): UNSET: The default initialization value, not generally valid when a timestamp is required. UNSTARTED: The timestamp before any valid timestamps. This is the input timestamp during Calcultor::Open(). PRESTREAM: A value for specifying that a packet contains "header" data that should be processed before any other timestamp. Like poststream, if this value is sent then it must be the only value that is sent on the stream. MIN: The minimum range timestamp to see in Calcultor::Process(). Any number of "range" timestamp can be sent over a stream, provided that they are sent in monotonically increasing order. MAX: The maximum range timestamp to see in Process(). POSTSTREAM: A value for specifying that a packet pertains to the entire stream. This "summary" timestamp occurs after all the "range" timestamps. If this timestamp is sent on a stream, it must be the only packet sent. DONE: The timestamp after all valid timestamps. This is the input timestamp during Calcultor::Close().

value

Methods

from_seconds

from_seconds(arg0: float) -> mediapipe.python._framework_bindings.timestamp.Timestamp

Create a timestamp from a seconds value

Args: seconds: A seconds value in float.

Returns: A MediaPipe Timestamp object.

Examples: timestamp_now = mp.Timestamp.from_seconds(time.time())

is_allowed_in_stream

is_allowed_in_stream(self: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

Returns true iff this can be the timestamp of a Packet in a stream.

Any number of RangeValue timestamps may be in a stream (in monotonically increasing order). Also, exactly one prestream, or one poststream packet is allowed.

is_range_value

is_range_value(self: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

Check if the timestamp is a range value is anything between Min() and Max() (inclusive).

Any number of packets with range values can be sent over a stream as long as they are sent in monotonically increasing order. is_range_value() isn't quite the opposite of is_special_value() since it is valid to start a stream at Timestamp::Min() and continue until timestamp max (both of which are special values). prestream and postStream are not considered a range value even though they can be sent over a stream (they are "summary" timestamps not "range" timestamps).

is_special_value

is_special_value(self: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

Check if the timestamp is a special value,

A special value is any of the values which cannot be constructed directly
but must be constructed using the static special value.

microseconds

microseconds(self: mediapipe.python._framework_bindings.timestamp.Timestamp) -> int

Return the value in units of microseconds as an int.

seconds

seconds(self: mediapipe.python._framework_bindings.timestamp.Timestamp) -> float

Return the value in units of seconds as a float.

__eq__

eq(self: mediapipe.python._framework_bindings.timestamp.Timestamp, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

__ge__

ge(self: mediapipe.python._framework_bindings.timestamp.Timestamp, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

__gt__

gt(self: mediapipe.python._framework_bindings.timestamp.Timestamp, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

__le__

le(self: mediapipe.python._framework_bindings.timestamp.Timestamp, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

__lt__

lt(self: mediapipe.python._framework_bindings.timestamp.Timestamp, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> bool

DONE Instance of mp.Timestamp
MAX Instance of mp.Timestamp
MIN Instance of mp.Timestamp
POSTSTREAM Instance of mp.Timestamp
PRESTREAM Instance of mp.Timestamp
UNSET Instance of mp.Timestamp
UNSTARTED Instance of mp.Timestamp