How to do math with timecode?

Terrance wrote on 11/13/2022, 6:16 PM

The only way I can find to do math with timecode within a script is something like:


But what if I want to take the length of something and make it five times longer? Something like:

Timecode newTimecode = myTimecode * 5;

That doesn't work as operators aren't allowed on Timecode so far as I know.

How would you approach this?



wwaag wrote on 11/13/2022, 8:52 PM


Convert your timecode to milliseconds, perform your math, and then convert back to timecode.

AKA the HappyOtter at System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

jetdv wrote on 11/14/2022, 7:25 AM

I agree. Convert it to another format. Milliseconds is good. Frames could also work. Just convert it to something that's an actual numerical value, do the math, and then convert that new number back to a timecode.

DMT3 wrote on 11/14/2022, 10:46 AM

But also remember you have to compensate if you are using Drop Frame timecode.