TimeUnitConverter
Utility class for converting between time units.
Source code in video_timestamps/time_unit_converter.py
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 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 | |
time_base_to_time_scale(time_base)
staticmethod
Convert a time base to a time scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_base
|
Fraction
|
The time base to convert. |
required |
Returns:
| Type | Description |
|---|---|
Fraction
|
The corresponding time scale. |
Source code in video_timestamps/time_unit_converter.py
10 11 12 13 14 15 16 17 18 19 20 21 | |
time_scale_to_time_base(time_scale)
staticmethod
Convert a time scale to a time base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_scale
|
Fraction
|
The time scale to convert. |
required |
Returns:
| Type | Description |
|---|---|
Fraction
|
The corresponding time base. |
Source code in video_timestamps/time_unit_converter.py
24 25 26 27 28 29 30 31 32 33 34 35 | |
timestamp_scale_to_time_scale(timestamp_scale)
staticmethod
Convert a timestamp scale to a time scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp_scale
|
int
|
The timestamp scale (e.g., nanoseconds per tick). |
required |
Returns:
| Type | Description |
|---|---|
Fraction
|
The corresponding time scale. |
Source code in video_timestamps/time_unit_converter.py
38 39 40 41 42 43 44 45 46 47 48 49 | |
time_scale_to_timestamp_scale(time_scale)
staticmethod
Convert a time scale to a timestamp scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_scale
|
Fraction
|
The time scale to convert. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding timestamp scale. |
Source code in video_timestamps/time_unit_converter.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
timestamp_scale_to_time_base(timestamp_scale)
staticmethod
Convert a timestamp scale to a time base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp_scale
|
int
|
The timestamp scale. |
required |
Returns:
| Type | Description |
|---|---|
Fraction
|
The corresponding time base. |
Source code in video_timestamps/time_unit_converter.py
76 77 78 79 80 81 82 83 84 85 86 87 | |
time_base_to_timestamp_scale(time_base)
staticmethod
Convert a time base to a timestamp scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_base
|
Fraction
|
The time base to convert. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding timestamp scale. |
Source code in video_timestamps/time_unit_converter.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |