pysublib.calc — Convert times and frames values

class pysublib.calc.Calc([fps])
Parameter:fps (int) – framerate

This class provides routines to convert the datetime.timedelta objects to its frame representations and vice-versa.

fps
Framerate used in conversions.
frame_to_time(frame[, fps])
Parameters:
  • frame (int) – frame value to convert
  • fps (int) – framerate
Return type:

datetime.timedelta

Converts frame value to its corresponding datetime.timedelta representation. The result depends on the value of the fps attribute or parameter.

time_to_frame(td[, fps])
Parameters:
  • td (datetime.timedelta) – time value to convert
  • fps (int) – framerate
Return type:

int

Converts the datetime.timedelta object to its corresponding frame value. The result depends on the value of the fps attribute or paramter.

Previous topic

pysublib — Manipulate subtitle files easily

Next topic

pysublib.core — Core functions, classes and methods

This Page