Skip to content

TimeType

Bases: Enum

Represents different types of time intervals for video frames in a player.

When working with a video that has a frame rate of 24000/1001 fps, using the RoundingMethod.ROUND and with the timescale 1000, the first 4 frames will start at the following times in a video player:

  • Frame 0: 0 ms
  • Frame 1: 42 ms
  • Frame 2: 83 ms
  • Frame 3: 125 ms
Source code in video_timestamps/time_type.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class TimeType(Enum):
    """
    Represents different types of time intervals for video frames in a player.

    When working with a video that has a frame rate of 24000/1001 fps, using the [`RoundingMethod.ROUND`][video_timestamps.rounding_method.RoundingMethod.ROUND] and with the timescale 1000,
    the first 4 frames will start at the following times in a video player:

    - Frame 0: 0 ms
    - Frame 1: 42 ms
    - Frame 2: 83 ms
    - Frame 3: 125 ms
    """

    START = "START"
    """
    Corresponds to the start time of the subtitle.
    Each frame has an interval: ]Previous_frame_time, Current_frame_time]

    Example:
        - fps = 24000/1001
        - rounding_method = [`RoundingMethod.ROUND`][video_timestamps.rounding_method.RoundingMethod.ROUND]
        - time_scale = 1000

        Frame intervals:

        - Frame 0: 0 ms
        - Frame 1: ]0, 42] ms
        - Frame 2: ]42, 83] ms
    """

    END = "END"
    """
    Corresponds to the end time of the subtitle.
    Each frame has an interval: ]Current_frame_time, Next_frame_time]

    Example:
        - fps = 24000/1001
        - rounding_method = [`RoundingMethod.ROUND`][video_timestamps.rounding_method.RoundingMethod.ROUND]
        - time_scale = 1000

        Frame intervals:

        - Frame 0: ]0, 42] ms
        - Frame 1: ]42, 83] ms
        - Frame 2: ]83, 125] ms
    """

    EXACT = "EXACT"
    """
    Corresponds to the precise frame time in the video player.
    Each frame has an interval: [Current_frame_time, Next_frame_time[

    Example:
        - fps = 24000/1001
        - rounding_method = [`RoundingMethod.ROUND`][video_timestamps.rounding_method.RoundingMethod.ROUND]
        - time_scale = 1000

        Frame intervals:

        - Frame 0: [0, 42[ ms
        - Frame 1: [42, 83[ ms
        - Frame 2: [83, 125[ ms
    """

START = 'START' class-attribute instance-attribute

Corresponds to the start time of the subtitle. Each frame has an interval: ]Previous_frame_time, Current_frame_time]

Example

Frame intervals:

  • Frame 0: 0 ms
  • Frame 1: ]0, 42] ms
  • Frame 2: ]42, 83] ms

END = 'END' class-attribute instance-attribute

Corresponds to the end time of the subtitle. Each frame has an interval: ]Current_frame_time, Next_frame_time]

Example

Frame intervals:

  • Frame 0: ]0, 42] ms
  • Frame 1: ]42, 83] ms
  • Frame 2: ]83, 125] ms

EXACT = 'EXACT' class-attribute instance-attribute

Corresponds to the precise frame time in the video player. Each frame has an interval: [Current_frame_time, Next_frame_time[

Example

Frame intervals:

  • Frame 0: [0, 42[ ms
  • Frame 1: [42, 83[ ms
  • Frame 2: [83, 125[ ms