yta-video-frame-time 0.0.8__py3-none-any.whl → 0.0.10__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 +39 -73
- {yta_video_frame_time-0.0.8.dist-info → yta_video_frame_time-0.0.10.dist-info}/METADATA +1 -1
- yta_video_frame_time-0.0.10.dist-info/RECORD +6 -0
- yta_video_frame_time-0.0.8.dist-info/RECORD +0 -6
- {yta_video_frame_time-0.0.8.dist-info → yta_video_frame_time-0.0.10.dist-info}/LICENSE +0 -0
- {yta_video_frame_time-0.0.8.dist-info → yta_video_frame_time-0.0.10.dist-info}/WHEEL +0 -0
|
@@ -354,7 +354,7 @@ class _T:
|
|
|
354
354
|
variation.
|
|
355
355
|
|
|
356
356
|
The formula:
|
|
357
|
-
- `int(t * fps)`
|
|
357
|
+
- `int(round(t * fps))`
|
|
358
358
|
"""
|
|
359
359
|
t = (
|
|
360
360
|
self.truncated(t)
|
|
@@ -542,7 +542,7 @@ class _Pts:
|
|
|
542
542
|
variation.
|
|
543
543
|
|
|
544
544
|
The formula:
|
|
545
|
-
- `int((pts * time_base) * fps)`
|
|
545
|
+
- `int(round((pts * time_base) * fps))`
|
|
546
546
|
"""
|
|
547
547
|
return self._t_handler.t.to_index(
|
|
548
548
|
self.to_t(pts, do_truncate = None),
|
|
@@ -566,13 +566,18 @@ class _Pts:
|
|
|
566
566
|
)
|
|
567
567
|
|
|
568
568
|
"""
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
not
|
|
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.
|
|
572
574
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
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.
|
|
576
581
|
"""
|
|
577
582
|
|
|
578
583
|
def truncated(
|
|
@@ -580,13 +585,15 @@ class _Pts:
|
|
|
580
585
|
pts: int
|
|
581
586
|
):
|
|
582
587
|
"""
|
|
588
|
+
(!) This is valid only for video and/or
|
|
589
|
+
could work not properly. Use it at your
|
|
590
|
+
own risk.
|
|
591
|
+
|
|
583
592
|
Get the 'pts' value provided but truncated.
|
|
584
593
|
|
|
585
594
|
This means that if 't' is in a
|
|
586
595
|
[start, end) range, we will obtain the
|
|
587
596
|
'start' value always.
|
|
588
|
-
|
|
589
|
-
(!) This is valid only for video
|
|
590
597
|
"""
|
|
591
598
|
return round_pts(
|
|
592
599
|
pts = pts,
|
|
@@ -600,6 +607,10 @@ class _Pts:
|
|
|
600
607
|
pts: int
|
|
601
608
|
) -> int:
|
|
602
609
|
"""
|
|
610
|
+
(!) This is valid only for video and/or
|
|
611
|
+
could work not properly. Use it at your
|
|
612
|
+
own risk.
|
|
613
|
+
|
|
603
614
|
Get the 'pts' value provided but rounded.
|
|
604
615
|
|
|
605
616
|
This means that if 't' is in a
|
|
@@ -607,8 +618,6 @@ class _Pts:
|
|
|
607
618
|
the 'start' or the 'end' value according
|
|
608
619
|
to which one is closer to the that 't'
|
|
609
620
|
value provided.
|
|
610
|
-
|
|
611
|
-
(!) This is valid only for video.
|
|
612
621
|
"""
|
|
613
622
|
return round_pts(
|
|
614
623
|
pts = pts,
|
|
@@ -617,13 +626,17 @@ class _Pts:
|
|
|
617
626
|
do_truncate = False
|
|
618
627
|
)
|
|
619
628
|
|
|
620
|
-
def
|
|
629
|
+
def next(
|
|
621
630
|
self,
|
|
622
631
|
pts: int,
|
|
623
632
|
n: int = 1,
|
|
624
633
|
do_truncate: bool = True
|
|
625
634
|
) -> int:
|
|
626
635
|
"""
|
|
636
|
+
(!) This is valid only for video and/or
|
|
637
|
+
could work not properly. Use it at your
|
|
638
|
+
own risk.
|
|
639
|
+
|
|
627
640
|
Get the value that is 'n' times ahead of
|
|
628
641
|
the 'pts' value provided (truncated or
|
|
629
642
|
rounded according to the 'do_truncate'
|
|
@@ -632,8 +645,6 @@ class _Pts:
|
|
|
632
645
|
Useful when you need the next value for a
|
|
633
646
|
range in an iteration or similar.
|
|
634
647
|
|
|
635
|
-
(!) This is valid only for video.
|
|
636
|
-
|
|
637
648
|
The formula:
|
|
638
649
|
- `pts + n * ticks_per_frame`
|
|
639
650
|
"""
|
|
@@ -645,38 +656,17 @@ class _Pts:
|
|
|
645
656
|
|
|
646
657
|
return pts + n * get_ticks_per_frame(self._t_handler.fps, self._t_handler.time_base)
|
|
647
658
|
|
|
648
|
-
def
|
|
649
|
-
self,
|
|
650
|
-
pts: int,
|
|
651
|
-
samples_per_frame: int,
|
|
652
|
-
n: int = 1
|
|
653
|
-
) -> int:
|
|
654
|
-
"""
|
|
655
|
-
Get the value that is 'n' times ahead of
|
|
656
|
-
the 'pts' value provided according to the
|
|
657
|
-
number of 'samples_per_frame' each frame
|
|
658
|
-
has.
|
|
659
|
-
|
|
660
|
-
TODO: Are we sure that the number of
|
|
661
|
-
samples per frame is always the same (?)
|
|
662
|
-
|
|
663
|
-
Useful when you need the next value for a
|
|
664
|
-
range in an iteration or similar.
|
|
665
|
-
|
|
666
|
-
(!) This is valid only for audio.
|
|
667
|
-
|
|
668
|
-
The formula:
|
|
669
|
-
- `pts + (n * samples_per_frame)`
|
|
670
|
-
"""
|
|
671
|
-
return pts + (n * samples_per_frame)
|
|
672
|
-
|
|
673
|
-
def previous_video(
|
|
659
|
+
def previous(
|
|
674
660
|
self,
|
|
675
661
|
pts: int,
|
|
676
662
|
n: int = 1,
|
|
677
663
|
do_truncate: bool = True
|
|
678
664
|
) -> int:
|
|
679
665
|
"""
|
|
666
|
+
(!) This is valid only for video and/or
|
|
667
|
+
could work not properly. Use it at your
|
|
668
|
+
own risk.
|
|
669
|
+
|
|
680
670
|
Get the value that is 'n' times before
|
|
681
671
|
the 't' property of this instance
|
|
682
672
|
(truncated or rounded according to the
|
|
@@ -690,8 +680,6 @@ class _Pts:
|
|
|
690
680
|
this will give you an unexpected negative
|
|
691
681
|
value.
|
|
692
682
|
|
|
693
|
-
(!) This is valid only for video.
|
|
694
|
-
|
|
695
683
|
The formula:
|
|
696
684
|
- `pts - n * ticks_per_frame`
|
|
697
685
|
"""
|
|
@@ -703,31 +691,6 @@ class _Pts:
|
|
|
703
691
|
|
|
704
692
|
return pts - n * get_ticks_per_frame(self._t_handler.fps, self._t_handler.time_base)
|
|
705
693
|
|
|
706
|
-
def previous_audio(
|
|
707
|
-
self,
|
|
708
|
-
pts: int,
|
|
709
|
-
samples_per_frame: int,
|
|
710
|
-
n: int = 1
|
|
711
|
-
) -> int:
|
|
712
|
-
"""
|
|
713
|
-
Get the value that is 'n' times before
|
|
714
|
-
the 'pts' value provided according to the
|
|
715
|
-
number of 'samples_per_frame' each frame
|
|
716
|
-
has.
|
|
717
|
-
|
|
718
|
-
TODO: Are we sure that the number of
|
|
719
|
-
samples per frame is always the same (?)
|
|
720
|
-
|
|
721
|
-
Useful when you need the next value for a
|
|
722
|
-
range in an iteration or similar.
|
|
723
|
-
|
|
724
|
-
(!) This is valid only for audio.
|
|
725
|
-
|
|
726
|
-
The formula:
|
|
727
|
-
- `pts - (n * samples_per_frame)`
|
|
728
|
-
"""
|
|
729
|
-
return pts - (n * samples_per_frame)
|
|
730
|
-
|
|
731
694
|
class THandler:
|
|
732
695
|
"""
|
|
733
696
|
Class to simplify the way we work with
|
|
@@ -795,9 +758,9 @@ def frame_t_to_index(
|
|
|
795
758
|
also provided 'fps'.
|
|
796
759
|
|
|
797
760
|
The formula:
|
|
798
|
-
- `int(t * fps)`
|
|
761
|
+
- `int(round(t * fps))`
|
|
799
762
|
"""
|
|
800
|
-
return int(
|
|
763
|
+
return int(round(t * fps))
|
|
801
764
|
|
|
802
765
|
def frame_index_to_t(
|
|
803
766
|
index: int,
|
|
@@ -849,17 +812,20 @@ def frame_pts_to_t(
|
|
|
849
812
|
|
|
850
813
|
def get_audio_frame_duration(
|
|
851
814
|
samples: int,
|
|
852
|
-
|
|
815
|
+
audio_fps: Fraction
|
|
853
816
|
) -> Fraction:
|
|
854
817
|
"""
|
|
855
818
|
Get the audio frame duration by giving the
|
|
856
819
|
number of '.samples' and also the rate (that
|
|
857
|
-
we call '
|
|
820
|
+
we call 'audio_fps').
|
|
858
821
|
|
|
859
822
|
This is useful when trying to guess the next
|
|
860
823
|
pts or t.
|
|
824
|
+
|
|
825
|
+
The formula:
|
|
826
|
+
- `samples / audio_fps`
|
|
861
827
|
"""
|
|
862
|
-
return Fraction(samples /
|
|
828
|
+
return Fraction(samples / audio_fps)
|
|
863
829
|
|
|
864
830
|
def get_ticks_per_frame(
|
|
865
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=lH-rDL2ydoEZhrkgjNMiJpzL5dCy7FanLbTae79Pw1c,24045
|
|
3
|
+
yta_video_frame_time-0.0.10.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
4
|
+
yta_video_frame_time-0.0.10.dist-info/METADATA,sha256=hgO8QXAVfX-fmkQhERaMb5TEQMKhSygpOj8z9c76doE,516
|
|
5
|
+
yta_video_frame_time-0.0.10.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
6
|
+
yta_video_frame_time-0.0.10.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=RQwZ2-ko0m4HIbf35bV107I9k2n-C0qWv-pJGmvNUOI,24799
|
|
3
|
-
yta_video_frame_time-0.0.8.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
4
|
-
yta_video_frame_time-0.0.8.dist-info/METADATA,sha256=VpvV6zRnEK5B0y37UYdH7U94iLtATHwsEAhYARkqVnw,515
|
|
5
|
-
yta_video_frame_time-0.0.8.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
6
|
-
yta_video_frame_time-0.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|