eoyilmaz / timecode

Python Module for SMPTE Time Code Manipulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initializing with start_seconds does not create the correct Timecode object

JohnENoonan opened this issue · comments

When initializing a Timecode instance with the start_seconds field the object does not have an equivalent representation

framerate = "30000/1001"
seconds = 500
instance = Timecode(framerate, start_seconds=seconds)

This yields a representation where instance.float = 500.5005005005005 and instance.frames = 15000.

From using both omnicalculator and zapstudio the correct number of frames should be 14985

If using the corresponding timecode representation of 500 seconds it works

instance_timecode = Timecode(framerate, "00:08:20;00")
# instance_timecode.frames = 14985, instance_timecode.float = 500.0 

Please let me know if I'm misusing the module and if there's anymore info I can give. I am using version 1.2.4.

Well, both omnicalculator and zapstudio has to fix their calculations then. I checked your claims with DaVinci Resolve Studio and a 500 seconds of clip in a 29.97 FPS timeline with dropframes results to a timecode of 00:08:20;15 and there are exactly 15000 frames (DaVinci denotes them with 0-14999) as it is calculated by the Timecode library.

In your second example you enter the timecode 00:08:20;00 which corresponds to 14985 frames and it is correctly calculated.

But, you are right on instance.float should return the same value with the seconds you have given to it. And it seems that there was a bug on the Timecode.float property which was using the wrong frame rate (29.97 in this case instead of the integer representation of 30).

I fixed it and it will be present in version 1.2.5 👍

Thank you very much for looking in to it 😄!