Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Data from Excel file to text layer

  • Data from Excel file to text layer

    Posted by Nathan Taylor on September 4, 2015 at 7:18 pm

    I’ve got some data that was recorded at 200Hz (it’s a steering wheel angle from a car). It’s in a simple Excel file, with the first column being time in seconds and the second being the angle in degrees, like so:

    0.005 -2.124202967
    0.01 -2.114402294
    0.015 -2.116824389
    0.02 -2.133757114
    0.025 -2.134076595
    0.03 -2.105466366
    0.035 -2.081091404
    0.04 -2.083098412
    0.045 -2.097907305
    0.05 -2.098354816

    I want to overlay the angle values as text on some video of the steering wheel (recorded at 29.97fps). I’m totally new to After Effects expressions, so I’m not sure how to go about both loading the data from an external file and then figuring out the time difference so only the appropriate line of data is displayed for each frame of video. Any help would be greatly appreciated.

    Dan Ebberts replied 11 years ago 3 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    September 4, 2015 at 8:42 pm

    After Effects keyframe data are text-based. You can copy and paste them in a text file.

    For instance, the keyframe data for a Slider Effect looks like this (10 frames):

    Adobe After Effects 8.0 Keyframe Data

    Units Per Second 25
    Source Width 100
    Source Height 100
    Source Pixel Aspect Ratio 1
    Comp Pixel Aspect Ratio 1

    Effects Slider Control #1 Slider #2
    Frame
    0 0
    1 0.0399893
    2 0.0799147
    3 0.119712
    4 0.159318
    5 0.198669
    6 0.237703
    7 0.276356
    8 0.314567
    9 0.352274
    10 0.389418

    End of Keyframe Data

    Thus, you can format your Excel to a suitable format, save it as a text file and copy and paste into AE. For two columns of information you could use two sliders, but probably a better option is to use the position keyframe data of a single 2D null.

    Then you can extract the values of the keyframes to your text layer. You can simply pick-whip the position x or y for the text layer source text.

    Then there is the matter of converting from 200 frames per second to your comp speed… valueAtTime expression will handle that. If I’m thinking straight at this hour, you’ll just have to divide 200 by your frame rate for the Time value.

  • Dan Ebberts

    September 4, 2015 at 9:10 pm

    I wouldn’t try to tackle this with the text-file-reading expression hack. First, when you read a text file with an expression, the text file has to evaluate as legal JavaScript, so you’d have to encase everything in triple quotes:

    “””
    0.005 -2.124202967
    0.01 -2.114402294
    0.015 -2.116824389
    0.02 -2.133757114
    0.025 -2.134076595
    0.03 -2.105466366
    0.035 -2.081091404
    0.04 -2.083098412
    0.045 -2.097907305
    0.05 -2.098354816
    “””

    At each frame, your expression would have to read the data file, split it into lines at the carriage returns, ignore blank lines, split each data line at the tab characters, parse the time data to see if it’s greater than the current time, etc.

    A script that reads the data file and sets keyframes would be a better choice for this.

    Dan

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