FPSTimestamps
Bases: ABCTimestamps
Create a Timestamps object from a fps.
Source code in video_timestamps/fps_timestamps.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
__init__(rounding_method, time_scale, fps, first_timestamps=Fraction(0))
Initialize the FPSTimestamps object.
To understand why the rounding_method and the time_scale are needed, see the detailed explanation in the
frame_to_time section.
If after reading the frame_to_time section,
you still think you need to have time = frame * (1/fps) instead of time = pts * timebase, use any rounding_method and use the same value for the time_scale as for the fps.
It will be the equivalent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rounding_method
|
RoundingMethod
|
The rounding method used to round/floor the PTS (Presentation Time Stamp). |
required |
time_scale
|
Fraction
|
Unit of time (in seconds) in terms of which frame PTS are represented. |
required |
fps
|
int | float | Fraction | Decimal
|
Frames per second (must be > 0). |
required |
first_timestamps
|
Fraction
|
The first timestamp of the video. By default, 0. |
Fraction(0)
|
Source code in video_timestamps/fps_timestamps.py
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 | |