Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Displaying original embedded timecode via timecode plug-in and expression

  • Displaying original embedded timecode via timecode plug-in and expression

    Posted by Waldemar Werbel on September 11, 2009 at 12:24 pm

    Hello.

    I may be missing something really obvious here (which wouldn’t be the first time…) but here’s what I’m trying to do:

    I have a QT clip in my AE project. The original timecode start is embedded in the clip and I want it to display over the picture.

    I’m applying the Timecode effect.

    Given that I know the start timecode I could just scrub in a new Starting Frame so that my timecode in the first frame of the comp corresponds with the timecode start in my clip. Easy enough.

    But once the timecode values start to get into the hours, that’s a fair bit of scrubbing… The problem is that although the “Display Format” accomodates the timecode format of HH:MM:SS:FF the “Starting Frame” parameter only works in frame numbers.

    Yes, it’s simple maths but the lazy part of me is asking this:

    is there an expression that I can apply to the “Starting Frame” parameter which evaluates the embedded start timecode in the QT movie clip, and converts it into a frame number?

    I’m working in PAL.

    Thanks for any help!

    Jim Arco replied 16 years, 11 months ago 3 Members · 10 Replies
  • 10 Replies
  • Dan Ebberts

    September 11, 2009 at 3:06 pm

    As far as I know, expressions don’t have access to embedded timecode. You could set up an expression that could parse and convert a time code that you embed in the expression (or in a text layer), but you’d have still have to edit/enter the timecode itself by hand.

    Dan

  • Waldemar Werbel

    September 11, 2009 at 3:17 pm

    Cheers Dan.

    Would that be along the lines of setting up 4 variables:

    h = 01
    m = 23
    s = 12
    f = 05

    then multiplying them up

    frameNumber = h*90000 + m*1500 + s*25 + f

    I’m sorry to be asking this question, but what would the script look like for this?

    Cheers.


    w.werbel. uk.

    https://homepage.ntlworld.com/w.werbel/showreel/

  • Dan Ebberts

    September 11, 2009 at 3:33 pm

    This would be one way:

    h = 1;
    m = 23 ;
    s = 12;
    f = 5;

    ((h*60 + m)*60 + s)*25 + f

    This would be another:

    tc = “01:23:12:05”;

    t = tc.split(“:”);
    h = parseInt(t[0],10);
    m = pareseInt(t[1],10);
    s = parseInt(t[2],10);
    h = parseInt(t[3],10);

    ((h*60 + m)*60 + s)*25 + f

    I haven’t tested these, but they should be close.

    Dan

  • Waldemar Werbel

    September 11, 2009 at 3:52 pm

    Awesome. First bit of code worked a treat. Love the way you’ve used the smaller numbers, too. As you can probably guess, maths isn’t a strong point of mine..!

    Thanks again.


    w.werbel. uk.

    https://homepage.ntlworld.com/w.werbel/showreel/

  • Waldemar Werbel

    September 11, 2009 at 3:57 pm

    Out of interest, I know this bit’s pulling out the relevant number from the timecode variable, but what’s the ’10’ doing in the

    h = parseInt(t[0],10);

    part?


    w.werbel. uk.

    https://homepage.ntlworld.com/w.werbel/showreel/

  • Dan Ebberts

    September 11, 2009 at 4:08 pm

    The 10 tells parseInt() to convert to a base 10 (decimal) number. It’s an optional parameter and most of the time you don’t need it, but in this case, where your number strings can have a leading zero character, like (“05”), parseInt() will try and convert them to octal.

    Dan

  • Waldemar Werbel

    September 11, 2009 at 4:13 pm

    Hehe,

    my next question was going to be: “Why would parseInt try and convert to octal?” But I’m guessing I probably don’t need to know that… 😉

    As ever, thanks for your help. Amazing.


    w.werbel. uk.

    https://homepage.ntlworld.com/w.werbel/showreel/

  • Dan Ebberts

    September 11, 2009 at 4:32 pm

    In JavaScript, the way you specify an octal number is by starting it with a zero. So if you use a number like 077, JavaScript will assume it’s octal. If you want to specify numbers in hexidecimal, you start them with “0x”. So 0x5000 is a hexidecimal number (equivalent to 20480 decimal). Maybe seldom used, but useful to know about…

    Dan

  • Waldemar Werbel

    September 11, 2009 at 4:49 pm

    >Maybe seldom used, but useful to know about…

    That bit of info’s probably saved me a couple of days from the future!

    Nice one.


    w.werbel. uk.

    https://homepage.ntlworld.com/w.werbel/showreel/

  • Jim Arco

    September 16, 2009 at 12:42 pm

    Being able to get to the original timecode seems like it would be useful to many people. It is imbedded in the original file without any encryption and we see several shareware programs that are able to read it without much difficulty.

    I am puzzled as to why it is not available in any of the desktop NLE software available?

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy