Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction of FrameUtility #46

Closed
wants to merge 47 commits into from
Closed

Conversation

moi15moi
Copy link
Contributor

@moi15moi moi15moi commented Aug 27, 2022

Finally, this should be the last version of FrameUtility.
For reference, here is the previous version: #37

Why it is needed?

The previous FrameUtility would not work with VFR video, now yes.

Finally, the previous FrameUtility was more a hack than anything else. Now it relies on the same algorithm as Aegisub.

What has been done?

  • Add TimeType Enum
  • Add decord dependency
  • Be able to create Timestamps with 3 methods (from_fps, from_video_file, from_timestamps_file)
  • Correction how to convert ms to ass_timestamps
  • Correction of the algorithm of ms_to_frames and frames_to_ms
  • Add some tests

How to get the timestamps from an video?

I did some test with multiple library.

I choose to use decord, because it was the second fastest and it is easy to install compared to some of them like pyffms2.
ffprobe is the best, but it need the user to have installed FFmpeg.

Important to note, decord seems to automatically normalize the timestamps.

Here is the script I used to compare all the librairies: Get timestamps.zip

Here is how much times it took to get the timestamps for an mkv of 24 minutes:

With Movie py 0.65625 seconds
With cv2 2.4375 seconds
With ffms2 0.0625 seconds
With decord 0.03125 seconds
With av 1.28125 seconds
With ffprobe 0.0 seconds

moi15moi and others added 30 commits August 27, 2022 10:09
…when the time 0 and when the time above the end of the video
…ion/normalization, moved back conversion methods inside class Convert, renamed Time class to TimeType, increased version, added ffms2 to dependencies, started to review tests and documentation
@moi15moi
Copy link
Contributor Author

Superseded by #48

@moi15moi moi15moi closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants