• Isadora
  • Get it
  • Forum
  • Help
  • ADD-ONS
  • Newsletter
  • Impressum
  • Dsgvo
  • Impressum
Forum
    • Categories
    • Recent
    • Popular
    • Tags
    • Register
    • Login

    Converting Time to Timecode and Percent: Check my math?

    How To... ?
    3
    5
    189
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • WolandW
      Woland Tech Staff
      last edited by Woland

      So I'm making User Actors based on Media Percent to Time and Media Time to Percent that also take into consideration the speed at which the media is played, and also allow you to convert things to and from timecode.

      I keep second-guessing myself on the math, so I wanted to put what I have out here and see if anyone can poke holes in it for me.

      Conversion: Time --> Percent or Timecode = you must multiply the percent or timecode value by the absolute value of the speed

      T-->P/TC Examples: (Assuming a 10 second video that's 30 fps)

      1. Speed 1, Input: 1 sec --> Output: 10% / 00:00:01:00/30
        1. T--> P: 1 sec = 10% of 10 seconds --> 10% x |1| = 10%
        2. T--> TC: 1 sec = 00:00:01:00/30 --> 00:00:01:00/30 x |1| = 00:00:01:00/30
      2. Speed -1, Input: 1 sec --> Output: 10% / 00:00:01:00/30 
        1. T--> P: 1 sec = 10% of 10 seconds --> 10% x |-1| = 10%
        2. T--> TC: 1 sec = 00:00:01:00/30 --> 00:00:01:00/30 x |-1| = 00:00:01:00/30
      3. Speed 2, Input: 0.5 sec --> Output: 10% / 00:00:01:00/30 
        1. T--> P: 0.5 sec = 5% of 10 seconds --> 5% x |2| = 10%
        2. T--> TC: 0.5 sec = 00:00:00:15/30 --> 00:00:00:15/30 x |2| = 00:00:01:00/30
      4. Speed 2, Input: 1 sec --> Output: 20% / 00:00:02:00/30
        1. T--> P: 1 sec = 10% of 10 seconds --> 10% x |2| = 20%
        2. T--> TC: 1 sec = 00:00:01:00/30 --> 00:00:01:00/30 x |2| = 00:00:02:00/30
      5. Speed -2, Input: 1 sec --> Output: 20% / 00:00:02:00/30 
        1. T--> P: 1 sec = 10% of 10 seconds --> 10% x |-2| = 20%
        2. T--> TC: 1 sec = 00:00:01:00/30 --> 00:00:01:00/30 x |-2| = 00:00:02:00/30
      6. Speed 0.5, Input: 1 sec --> Output: 5% / 00:00:00:15/30
        1. T--> P: 1 sec = 10% of 10 seconds --> 10% x |0.5| = 5%
        2. T--> TC: 1 sec = 00:00:01:00/30 --> 00:00:01:00/30 x |0.5| = 00:00:00:15/30
      7. Speed -0.5, Input: 1 sec --> Output: 5% / 00:00:00:15/30
        1. T--> P: 1 sec = 10% of 10 seconds --> 10% x |-0.5| = 5%
        2. T--> TC: 1 sec = 00:00:01:00/30 --> 00:00:01:00/30 x |-0.5| = 00:00:00:15/30
      8. Speed 1, Input: 0.5 sec --> Output: 5% / 00:00:00:15/30 
        1. T--> P: 0.5 sec = 5% of 10 seconds --> 5% x |1| = 5%
        2. T--> TC: 0.5 sec = 00:00:00:15/30 --> 00:00:00:15/30 x |1| = 00:00:00:15/30
      9. Speed 0.5, Input: 0.5 sec --> Output: 2.5% / 00:00:00:08/30
        1. T--> P: 0.5 sec = 5% of 10 seconds --> 5% x |0.5| = 2.5%
        2. T--> TC: 0.5 sec = 00:00:00:15/30 --> 00:00:00:15/30 x |0.5| = 00:00:00:08/30

      Conversion: 
      Percent --> Time = ((Percentage value x 0.01) x (Total Time Duration)) / (|Speed|) You must divide the time by the absolute value of the speed. 
      Percent --> Timecode = (Percentage value X 0.01) x (Total Timecode Duration). You don't need to involve speed at all.

      P-->T/TC Examples: (Assuming a 10 second video that's 30 fps)

      1. Speed 1, Input: 10% --> Output: 1 sec/ 00:00:01:00/30
        1. P-->T: 10% of 10 seconds = 1 sec --> 1 sec x |1| = 1 sec
        2. P-->TC: 00:00:10:00/30 x 0.1 = 00:00:01:00/30
      2. Speed -1, Input: 10% --> Output: 1 sec/ 00:00:01:00/30
        1. P-->T: 10% of 10 seconds = 1 sec --> 1 sec x |-1| = 1 sec
        2. P-->TC: 00:00:10:00/30 x 0.1 = 00:00:01:00/30 
      3. Speed 2, Input: 5% --> Output: 0.25 seconds / 00:00:00:15/30 
        1. P-->T: 5% of 10 seconds = 0.5 sec --> (0.5 sec)/(|2|) = 0.25 secs
        2. P-->TC: 00:00:10:00/30 x 0.05 = 00:00:00:15/30
      4. Speed 2, Input: 20% --> Output: 1 sec / 00:00:02:00/30
        1. P-->T: 20% of 10 seconds = 2 seconds --> (2 seconds)/(|2|) = 1 sec
        2. P-->TC: 00:00:10:00/30 x 0.2 = 00:00:02:00/30
      5. Speed -2, Input: 20% --> Output: 1 sec / 00:00:02:00/30 
        1. P-->T: 20% of 10 seconds = 2 seconds --> (2 seconds)/(|-2|) = 1 sec
        2. P-->TC: 00:00:10:00/30 x 0.2 = 00:00:02:00/30 
      6. Speed 0.5, Input: 5% --> Output: 1 sec / 00:00:00:15/30
        1. P-->T: 5% of 10 seconds = 0.5 sec --> (0.5 sec)/(|0.5|) = 1 sec
        2. P-->TC: 00:00:10:00/30 x 0.05 = 00:00:00:15/30 
      7. Speed -0.5, Input: 5% --> Output: 1 secs / 00:00:00:15/30
        1. P-->T: 5% of 10 seconds = 0.5 sec --> (0.5 sec)/(|-0.5|) = 1 sec
        2. P-->TC:  00:00:10:00/30 x 0.05 = 00:00:00:15/30 
      8. Speed 1, Input: 5% --> Output: 0.5 secs / 00:00:00:15/30 
        1. P-->T: 5% of 10 seconds = 0.5 sec --> (0.5 sec)/(|1|) = 0.5 sec
        2. P-->TC: 00:00:10:00/30 x 0.05 = 00:00:00:15/30 
      9. Speed 0.5, Input: 2.5% --> Output: 0.5 sec / 00:00:00:15/30
        1. P-->T: 2.5% of 10 seconds = 0.25 sec --> (0.25 sec)/(|0.5|) = 0.5 sec
        2. P-->TC: 00:00:10:00/30 x 0.025 = 00:00:00:8/30

      If I'm not mistaken, then the math and examples for converting Timecode to Time should be the same, but to convert Timecode to Percentage you'd just divide to total timecode duration by the given timecode value in order to get the percentage value (no speed involved).

      Did I do the math correctly?

      TroikaTronix Technical Support
      New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
      TroikaTronix Support Policy: https://support.troikatronix.com/support/solutions/articles/13000064762
      TroikaTronix Add-Ons Page: https://troikatronix.com/add-ons/

      | Isadora 3.2.6 | Mac Pro (Late 2013), macOS 10.14.6, 3.5GHz 6-core, 1TB SSD, 64GB RAM, Dual AMD FirePro D700s |

      DusXD 1 Reply Last reply Reply Quote 1
      • DusXD
        DusX Tech Staff @Woland
        last edited by

        @woland

        Take a look at these User Actors: https://troikatronix.com/add-o...
        I think some of what you are looking for is covered there.

        Troikatronix Technical Support

        • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
        • Isadora Add-ons: https://troikatronix.com/add-ons/
        • My Add-ons: https://troikatronix.com/add-ons/?u=dusx

        Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

        WolandW 1 Reply Last reply Reply Quote 1
        • WolandW
          Woland Tech Staff @DusX
          last edited by

          @dusx said:

          I think some of what you are looking for is covered there.

           Some, yes, but the tricky thing is accounting for speed. I think I've got it figured out at this point though (unless someone tells me I'm wrong).

          TroikaTronix Technical Support
          New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
          TroikaTronix Support Policy: https://support.troikatronix.com/support/solutions/articles/13000064762
          TroikaTronix Add-Ons Page: https://troikatronix.com/add-ons/

          | Isadora 3.2.6 | Mac Pro (Late 2013), macOS 10.14.6, 3.5GHz 6-core, 1TB SSD, 64GB RAM, Dual AMD FirePro D700s |

          CitizenJoeC 1 Reply Last reply Reply Quote 0
          • CitizenJoeC
            CitizenJoe @Woland
            last edited by

            @woland said:

            I think I've got it figured out at this point though (unless someone tells me I'm wrong).

             It gives me a headache... 😆

            Cheers,

            Hugh

            Hugh in Winnipeg - All test machines, Win10 Pro, 64 bit, OS SSD and separate data SSD.

            1. new laptop: Dell 7560, i9 11950H, 64 gigs, NVIDIA RTX A4000 w/8 GB GDDR6
            2. old desktop: Dell T5500 2009, Dual Quad Core Processor E5530, 12 gigs, 2x Radeon 5750... Still works well!
            WolandW 1 Reply Last reply Reply Quote 1
            • WolandW
              Woland Tech Staff @CitizenJoe
              last edited by

              @citizenjoe said:

               It gives me a headache

               Me too. After I finish the User Actor, I never want to have to do this math again.

              TroikaTronix Technical Support
              New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
              TroikaTronix Support Policy: https://support.troikatronix.com/support/solutions/articles/13000064762
              TroikaTronix Add-Ons Page: https://troikatronix.com/add-ons/

              | Isadora 3.2.6 | Mac Pro (Late 2013), macOS 10.14.6, 3.5GHz 6-core, 1TB SSD, 64GB RAM, Dual AMD FirePro D700s |

              1 Reply Last reply Reply Quote 1
              • First post
                Last post