Math formula for finding 'HH:MM:SS:MMM' Timecode given a number of frames and FPS?

38 Views Asked by At

I have been at this for a few days and while I have made progress I am stuck on the last bit, getting timecode to display as HH:MM:SS:MS rather than HH:MM:SS:FF. To do this I need a formula for the milliseconds part

I know this is will be complicated for Drop-Frame Timecodes so I have ruled them out. I am only concerned with NDF Timecodes.

The formula I have for finding a NDF Timecode, for example a video of 30 frames with a 12 FPS:

  1. To get the hours, 30 / (12* 3600), 3600 is the number of seconds in a hour
  2. To get the minutes, 30 / (12 * 60) - (0 * 60), 0 is the sum from step 1
  3. To get the seconds, (30 / 12) - ( (0 * 3600) - (0 * 60)
  4. To get the frames, 30 % 12 (Modulas)

The Timecode would be 00:00:02:06, as shown at Frames to Timecode Calculator.

I would like to make a slight tweak at step 4, to instead get the milliseconds needed for format HH:MM:SS:MMM. I have tried to unsuccessfully solve it on my own, I searched around and turned up with nothing too.

I am not a math wizard by any chance, not even a half rate one. I would really like to learn how to do this though. Any help would be greatly appreciated!