Jump to content
Server Maintenance This Week. ×

Add frames to timecode calculation


Mike_FM

This topic is 1172 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

 

Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

This topic is 1172 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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