Mike_FM Posted February 2, 2021 Posted February 2, 2021 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
comment Posted February 2, 2021 Posted February 2, 2021 (edited) 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 February 2, 2021 by comment 1
Mike_FM Posted February 2, 2021 Author Posted February 2, 2021 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
comment Posted February 2, 2021 Posted February 2, 2021 (edited) 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 February 2, 2021 by comment
Mike_FM Posted February 2, 2021 Author Posted February 2, 2021 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
comment Posted February 2, 2021 Posted February 2, 2021 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.
Mike_FM Posted February 2, 2021 Author Posted February 2, 2021 Brilliant, that makes sense thank you!
Mike_FM Posted February 9, 2021 Author Posted February 9, 2021 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!
comment Posted February 9, 2021 Posted February 9, 2021 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.
Mike_FM Posted February 9, 2021 Author Posted February 9, 2021 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!
comment Posted February 9, 2021 Posted February 9, 2021 (edited) 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 February 9, 2021 by comment 1
Mike_FM Posted February 9, 2021 Author Posted February 9, 2021 Actually please ignore the above I have managed to work around this. Thanks so again for the calculation
Recommended Posts
This topic is 1381 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 accountSign in
Already have an account? Sign in here.
Sign In Now