yta-video-frame-time 0.0.7__py3-none-any.whl → 0.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of yta-video-frame-time might be problematic. Click here for more details.
- yta_video_frame_time/t_fraction.py +65 -3
- {yta_video_frame_time-0.0.7.dist-info → yta_video_frame_time-0.0.9.dist-info}/METADATA +1 -1
- yta_video_frame_time-0.0.9.dist-info/RECORD +6 -0
- yta_video_frame_time-0.0.7.dist-info/RECORD +0 -6
- {yta_video_frame_time-0.0.7.dist-info → yta_video_frame_time-0.0.9.dist-info}/LICENSE +0 -0
- {yta_video_frame_time-0.0.7.dist-info → yta_video_frame_time-0.0.9.dist-info}/WHEEL +0 -0
|
@@ -238,6 +238,8 @@ def round_pts(
|
|
|
238
238
|
and 'time_base', but here is an easier
|
|
239
239
|
example using the time moments.
|
|
240
240
|
|
|
241
|
+
(!) This is valid only for video.
|
|
242
|
+
|
|
241
243
|
Examples below, with `time_base = 1/5`:
|
|
242
244
|
- `t = 0.25` => `0.2` (truncated or rounded)
|
|
243
245
|
- `t = 0.35` => `0.2` (truncated)
|
|
@@ -256,8 +258,6 @@ def round_pts(
|
|
|
256
258
|
|
|
257
259
|
return int(frame_index * ticks_per_frame)
|
|
258
260
|
|
|
259
|
-
# TODO: Create a 'round_pts'
|
|
260
|
-
|
|
261
261
|
"""
|
|
262
262
|
When we are working with the 't' time
|
|
263
263
|
moment we need to use the fps, and when
|
|
@@ -306,6 +306,18 @@ class _T:
|
|
|
306
306
|
The formula:
|
|
307
307
|
- `pts * time_base`
|
|
308
308
|
"""
|
|
309
|
+
t = Fraction(pts * self._t_handler.time_base)
|
|
310
|
+
|
|
311
|
+
return (
|
|
312
|
+
self._t_handler.t.truncated(t)
|
|
313
|
+
if do_truncate is True else
|
|
314
|
+
self._t_handler.t.rounded(t)
|
|
315
|
+
if do_truncate is False else
|
|
316
|
+
t # if None
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
# TODO: Remove this below in the next
|
|
320
|
+
# commit
|
|
309
321
|
pts = (
|
|
310
322
|
self._t_handler.pts.truncated(pts)
|
|
311
323
|
if do_truncate is True else
|
|
@@ -552,12 +564,31 @@ class _Pts:
|
|
|
552
564
|
t = self._t_handler.t.from_index(index),
|
|
553
565
|
do_truncate = True
|
|
554
566
|
)
|
|
567
|
+
|
|
568
|
+
"""
|
|
569
|
+
These 2 methods below are here because they
|
|
570
|
+
seem to work for videos, but I think they
|
|
571
|
+
could work not if the video has dynamic frame
|
|
572
|
+
rate or in some other situations, thats why
|
|
573
|
+
this is here as a reminder.
|
|
574
|
+
|
|
575
|
+
I found one video that had audio_fps=44100
|
|
576
|
+
and time_base=256/11025, so it was impossible
|
|
577
|
+
to make a conversion using this formula with
|
|
578
|
+
the audio. With video seems to be ok, but...
|
|
579
|
+
|
|
580
|
+
Use these methods below at your own risk.
|
|
581
|
+
"""
|
|
555
582
|
|
|
556
583
|
def truncated(
|
|
557
584
|
self,
|
|
558
585
|
pts: int
|
|
559
586
|
):
|
|
560
587
|
"""
|
|
588
|
+
(!) This is valid only for video and/or
|
|
589
|
+
could work not properly. Use it at your
|
|
590
|
+
own risk.
|
|
591
|
+
|
|
561
592
|
Get the 'pts' value provided but truncated.
|
|
562
593
|
|
|
563
594
|
This means that if 't' is in a
|
|
@@ -576,6 +607,10 @@ class _Pts:
|
|
|
576
607
|
pts: int
|
|
577
608
|
) -> int:
|
|
578
609
|
"""
|
|
610
|
+
(!) This is valid only for video and/or
|
|
611
|
+
could work not properly. Use it at your
|
|
612
|
+
own risk.
|
|
613
|
+
|
|
579
614
|
Get the 'pts' value provided but rounded.
|
|
580
615
|
|
|
581
616
|
This means that if 't' is in a
|
|
@@ -598,6 +633,10 @@ class _Pts:
|
|
|
598
633
|
do_truncate: bool = True
|
|
599
634
|
) -> int:
|
|
600
635
|
"""
|
|
636
|
+
(!) This is valid only for video and/or
|
|
637
|
+
could work not properly. Use it at your
|
|
638
|
+
own risk.
|
|
639
|
+
|
|
601
640
|
Get the value that is 'n' times ahead of
|
|
602
641
|
the 'pts' value provided (truncated or
|
|
603
642
|
rounded according to the 'do_truncate'
|
|
@@ -624,6 +663,10 @@ class _Pts:
|
|
|
624
663
|
do_truncate: bool = True
|
|
625
664
|
) -> int:
|
|
626
665
|
"""
|
|
666
|
+
(!) This is valid only for video and/or
|
|
667
|
+
could work not properly. Use it at your
|
|
668
|
+
own risk.
|
|
669
|
+
|
|
627
670
|
Get the value that is 'n' times before
|
|
628
671
|
the 't' property of this instance
|
|
629
672
|
(truncated or rounded according to the
|
|
@@ -647,7 +690,7 @@ class _Pts:
|
|
|
647
690
|
)
|
|
648
691
|
|
|
649
692
|
return pts - n * get_ticks_per_frame(self._t_handler.fps, self._t_handler.time_base)
|
|
650
|
-
|
|
693
|
+
|
|
651
694
|
class THandler:
|
|
652
695
|
"""
|
|
653
696
|
Class to simplify the way we work with
|
|
@@ -745,6 +788,8 @@ def frame_t_to_pts(
|
|
|
745
788
|
moment provided, based on the also provided
|
|
746
789
|
'fps' and 'time_base'.
|
|
747
790
|
|
|
791
|
+
(!) This is valid only for videos.
|
|
792
|
+
|
|
748
793
|
The formula:
|
|
749
794
|
- `frame_index * ticks_per_frame`
|
|
750
795
|
"""
|
|
@@ -764,6 +809,23 @@ def frame_pts_to_t(
|
|
|
764
809
|
- `pts * time_base`
|
|
765
810
|
"""
|
|
766
811
|
return parse_fraction(pts * time_base)
|
|
812
|
+
|
|
813
|
+
def get_audio_frame_duration(
|
|
814
|
+
samples: int,
|
|
815
|
+
audio_fps: Fraction
|
|
816
|
+
) -> Fraction:
|
|
817
|
+
"""
|
|
818
|
+
Get the audio frame duration by giving the
|
|
819
|
+
number of '.samples' and also the rate (that
|
|
820
|
+
we call 'audio_fps').
|
|
821
|
+
|
|
822
|
+
This is useful when trying to guess the next
|
|
823
|
+
pts or t.
|
|
824
|
+
|
|
825
|
+
The formula:
|
|
826
|
+
- `samples / audio_fps`
|
|
827
|
+
"""
|
|
828
|
+
return Fraction(samples / audio_fps)
|
|
767
829
|
|
|
768
830
|
def get_ticks_per_frame(
|
|
769
831
|
fps: Union[float, int, Fraction],
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
yta_video_frame_time/__init__.py,sha256=-YOa7lOKdiA3FwDEHHU1tHobnmhjFpTaVLfJQLZqoMI,22252
|
|
2
|
+
yta_video_frame_time/t_fraction.py,sha256=vfLF1R-4PYfP9ItNxbCBM14ck9UBxRpfFy_idsb5ESo,24033
|
|
3
|
+
yta_video_frame_time-0.0.9.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
4
|
+
yta_video_frame_time-0.0.9.dist-info/METADATA,sha256=Qwj6QcsZRcSZRURvdB3DHdiyEg3otcOROVwoVje4wG4,515
|
|
5
|
+
yta_video_frame_time-0.0.9.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
6
|
+
yta_video_frame_time-0.0.9.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
yta_video_frame_time/__init__.py,sha256=-YOa7lOKdiA3FwDEHHU1tHobnmhjFpTaVLfJQLZqoMI,22252
|
|
2
|
-
yta_video_frame_time/t_fraction.py,sha256=hsCNZajG98XGnWYI0T6wSfBnAK3vf7ZiFI_GZHO8yRI,22254
|
|
3
|
-
yta_video_frame_time-0.0.7.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
4
|
-
yta_video_frame_time-0.0.7.dist-info/METADATA,sha256=ooHYnwkytyyjpKRKLKakXhDJJD-HAmpXxvWuaXfVrZo,515
|
|
5
|
-
yta_video_frame_time-0.0.7.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
6
|
-
yta_video_frame_time-0.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|