Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Add frames to timecode calculation

Featured Replies

Hi all,

I'm a film editor and have started building a FM database to be able to track visual effects shots that go in and out of an editing timeline. 

I am trying to create a calculation that will enable me to add frames to timecode and get the result back in timecode.

At the moment I have a text field called 'Scan TC In' which has the following TC entry 18:59:48:23 (HH:MM:SS:FF) and I need to add 8 frames to it, the timeline runs at 24 frames a second. 

Does anyone know how I can achieve this?

I'm a newbie to FM so any help is greatly appreciated!

Thanks

Michael

 

Start by converting your timecode to frames and adding the duration to the result to get the total number of frames. Then convert the result back to timecode format:

Let ( [
totalFrames = 24 * GetAsTime ( Left ( YourTimecode ; 8 ) ) + Right ( YourTimecode ; 2 ) + YourDuration ;
totalSeconds = Div ( totalFrames ; 24 ) ; 
remFrames = Mod ( totalFrames ; 24 ) 
] ;
SerialIncrement ( "00" ; Mod ( Hour ( totalSeconds ) ; 24 ) ) &
SerialIncrement ( ":00" ; Minute ( totalSeconds ) ) &
SerialIncrement ( ":00" ; Seconds ( totalSeconds ) ) &
SerialIncrement ( ":00" ; remFrames )
)

 

Edited by comment

  • Author

Hi there, thanks so much for this

I should add that the result of Scan TC In + 8 frames needs to go into a new field called Cut In TC... so would I enter this calculation in the Cut In TC field? 

I have been putting in place of 'YourTimecode' the Scan TC In field... is this correct for both left and right and also do I need to first work out the duration of the timecode or does this calculation do it for me?

Thanks for you help

Michael

46 minutes ago, Mike_FM said:

I should add that the result of Scan TC In + 8 frames needs to go into a new field called Cut In TC... so would I enter this calculation in the Cut In TC field? 

Yes. The  Cut In TC field should be defined as a calculation field, using the formula above. Replace both instances of `YourTimecode` with the name of your input field (Scan TC In) and 'YourDuration` with the name of the field that has the duration in frames - or with the number 8 if that's a constant. Set the result type of the calculation to Text.

46 minutes ago, Mike_FM said:

do I need to first work out the duration of the timecode or does this calculation do it for me?

The calculation does everything. I suggest you follow it step-by-step; it's not very difficult and it's good exercise.

 

Edited by comment

  • Author

That's thanks again, works perfectly. I wish I knew how it worked but I'll look at it step by step to try and learn.. I guess what is most confusing in the script is  '+ Right ( YourTimecode ; 2 )' and what that means

2 hours ago, Mike_FM said:

I guess what is most confusing in the script is  '+ Right ( YourTimecode ; 2 )' and what that means

It extracts the FF part (the last two characters) of your timecode and adds it to the frame count.

 

  • Author

Brilliant, that makes sense thank you!

  • Author

Hi there, the above calculation has been very useful in adding 8 frames to a timecode.

I have another field that when a timecode is entered, a calculation should convert it into a frame count, so for eg if TC: 00:00:42:09 was entered the result in frames would be 1017 (frame rate 24)

The above calculation that you gave me converts timecode to frames, adds 8 frames to the value and then converts the frame count back to timecode. I have tried to extract the part of the script that converts timecode to frames but with no luck, can you show me how to convert timecode to frames?

Any help would be appreciated and thanks in advance!

Why it's right there in the first line of the code:

24 * GetAsTime ( Left ( YourTimecode ; 8 ) ) + Right ( YourTimecode ; 2 )

Here the result type should be set to Number.

--
P.S. It's a calculation, not a script.

 

  • Author

Awesome! Thanks :) 

So the only complication is that the TC of the media that I am converting to frames, by default starts at 1 hour so 01:00:42:09 equals 87389 frames... however in my editing application 01:00:42:09 when converted into frames on the timeline actually gives the value of 989 frames... so seems to be ignoring the hour or seeing it as 0...

As a general rule media and timelines in editing software start at 01 hour in order to give ample space for any credits or such that might need to go before the programme starts and therefore avoiding a negative timecode ie if a programme started at TC: 00:00:10:00 but there were 20 seconds of credits to go beforehand this would cause a problem so as a standard programmes and media usually start at 01:00:00:00

Is there a way to make the above calculation do the same as my editing software ie 01:00:42:09 = 989 frames? 

Hope this makes and thanks again!

 

48 minutes ago, Mike_FM said:

01:00:42:09 equals 87389 frames... however in my editing application 01:00:42:09 when converted into frames on the timeline actually gives the value of 989 frames

I am somewhat confused by this, because I get the result of 87417 frames as the equivalent of timecode 01:00:42:09, and if you subtract 1 hour from that it will become 1017. 

You can easily verify these results by calculating:

42 seconds * 24 fps + 9 frames = 1017

and if you add the number of frames in 1 hour =

60 minutes * 60 seconds * 24 fps = 86400

to the above result, you will see that it matches the original calculation:

86400 + 1017 = 87417

so I am not sure how you got the numbers you quote.

 

In any case, if you want to start the frame count at 01:00:00:00, you simply need to subtract 86400 from the actual count.

(This is assuming your program will never be longer than 23 hours. Otherwise you would also need to prevent timecodes between 00:00:00:00 and 00:59:59:23 from returning negative frame counts.)

 

Edited by comment

  • Author

Actually please ignore the above I have managed to work around this.

Thanks so again for the calculation

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.