Answers.Body: <p>Frames are fractions of a second, thus:</p>
  <pre><code>frameduration = 1 / framerate
  framecomponent = totalframes % framerate
  millisecondscomponent = framecomponent * frameduration * 1000
  // finally
  millisecondscomponent = ((totalframes % framerate) * 1000 ) / framerate
  </code></pre>
  <p>In your example:</p>
  <pre><code>millisecondscomponent = ((30 % 12) * 1000 ) / 12 = 500 ms
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-25T17:23:49.867Z
Answers.Text: Thank you for this, I understand it much better now and can do it on my own.
Answers.UserDisplayName: Ralf_Reddings
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-24T23:22:46.947Z
Answers.LastActivityDate: 2023-12-24T23:22:46.947Z
Answers.UserDisplayName: soundflix
Body: <p>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 <code>HH:MM:SS:MS</code> rather than <code>HH:MM:SS:FF</code>. To do this I need a formula for the milliseconds part</p>
  <p>I know this is will be complicated for Drop-Frame Timecodes so I have ruled them out. I am only concerned with NDF Timecodes.</p>
  <p>The formula I have for finding a NDF Timecode, for example a video of 30 frames with a 12 FPS:</p>
  <ol>
  <li>To get the hours, <code>30 / (12* 3600)</code>, <code>3600</code> is the number of seconds in a hour</li>
  <li>To get the minutes, <code>30 / (12 * 60) - (0 * 60)</code>, <code>0</code> is the sum from step 1</li>
  <li>To get the seconds, <code>(30 / 12) - ( (0 * 3600) - (0 * 60)</code></li>
  <li>To get the frames, <code>30 % 12</code> (Modulas)</li>
  </ol>
  <p>The Timecode would be <code>00:00:02:06</code>, as shown at <a href="https://www.omnicalculator.com/other/frames-to-timecode?c=GBP&amp;v=frames:30,fpses:12" rel="nofollow noreferrer">Frames to Timecode Calculator</a>.</p>
  <p>I would like to make a slight tweak at step 4, to instead get the milliseconds needed for format <code>HH:MM:SS:MMM</code>. I have tried to unsuccessfully solve it on my own, I searched around and turned up with nothing too.</p>
  <p>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!</p>
  
Tags: <timecode>
Title: Math formula for finding 'HH:MM:SS:MMM' Timecode given a number of frames and FPS?
UserDisplayName: Ralf_Reddings
ThreadText: # Math formula for finding 'HH:MM:SS:MMM' Timecode given a number of frames and FPS?
  
  (Asked by: username_0 on 2023-12-21)
  
  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](https://www.omnicalculator.com/other/frames-to-timecode?c=GBP&v=frames:30,fpses:12).
  
  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!
  
  **Tags:** timecode
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-12-24. Score: 1 | Accepted answer
  
  Frames are fractions of a second, thus:
  
  ```
  frameduration = 1 / framerate
  framecomponent = totalframes % framerate
  millisecondscomponent = framecomponent * frameduration * 1000
  // finally
  millisecondscomponent = ((totalframes % framerate) * 1000 ) / framerate
  
  ```
  
  In your example:
  
  ```
  millisecondscomponent = ((30 % 12) * 1000 ) / 12 = 500 ms
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you for this, I understand it much better now and can do it on my own.  
  
  ---
  
  