Jump to content

Add frames to timecode calculation


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 post
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 post
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 post
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 post
Share on other sites

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

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

 

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

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.

 

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

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
  • Similar Content

    • By bgscott
      I have an application where some of the related files will reside on removable media.  When sorting, a message box appears telling the user that the related file (which is not on the server) can not be opened (Not Found) and asks the user to locate it.  The related file may or may not be available on the removable media and is not needed for the purposes of the sort.
      Is there anyway to prevent this message from appearing?  Error capture on does not solve the problem
    • By St3v1e
      New user
      I have a "Search" script setup in one of my layouts, which works well but I'd like to refine it a little to make searching quicker and with less mouse clicks.
      Currently, I have a field into which I enter a client name, and a "Search" button which activates a search throughout my database for any records containing this name. For the search to work I have to input the name (or a portion of it) into the "Search Name" field , and then click on the "Search" button.
      What I'd like to happen is to enter the name into the field and then hit the enter key to activate the same search. Is this possible?

      Thanks in advance.
    • By ChrisOC
      Has anyone integrated Smartsheet with FileMaker using Claris Connect? I can get the basics set up and am able to create a Flow that will add a new record in FM when a row is added in Smartsheet.  However, I can't seem to figure out how to pass any column data from that row into the new FM record.  It does not give me the tags for any of the columns from my sheet, only high level parent and body tags.  What am I missing?  
    • By paulkivett
      My first try using a Server Side Script. I'm importing csv data which is on "This PC / Documents/CompPBM_checks.csv". I have tried every possible path, but still get missing file error. Options tried include
       file:FileMakerServer/data/documents/CompPBM_checks.csv
      file:ThisPC/data/documents/CompPBM_checks.csv
      file:ThisPC/FileMaker Server/data/documents/CompPBM_checks.csv
      $Import.
      $Import equals: Get ( DocumentsPath )&"CompPBM_checks.cvs"
      FM Server is hosted on AWS
    • By pixi
      Has anyone played with latest FMS Linux and LetsEncrypt-Certificates? 
      (How) does it work?
×
×
  • Create New...

Important Information

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