Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects too many keyframes?

  • too many keyframes?

    Posted by Knubile on June 5, 2006 at 3:51 pm

    I have script that loads keyframe data from a file and modifies the anchor point property of an image in a composition.

    Performance drastically tapers off as the number of keyframes increases. For example, the 1st thousand keyframe takes about 15 seconds to set. When I reach 20,000 keyframe, it takes about 10 seconds to do only 100.

    In total I have on average 40,000 keyframes to set in a 30 minutes composition. Is this getting past AE’s capabilities, or am I misusing something?

    The script simply loops through all the lines in the file and calls the anchor point properties setValueAtTime method.

    Any thoughts?

    Knubile replied 19 years, 11 months ago 3 Members · 8 Replies
  • 8 Replies
  • Steve Roberts

    June 5, 2006 at 5:41 pm

    Can you split this into manageable chunks? Separate shots?

    What are you doing, by the way? Stabilzing a 30-minute movie?

  • Knubile

    June 5, 2006 at 8:31 pm

    Thanks for the prompt reply.

    By dividing into manageable chunks do you mean into seperate aep(project) files, or just compositions within the same aep file?

    They frames are used to animate an object to match some real live captured movement. The data is sampled at 5 times per second over 30 minutes.

  • Steve Roberts

    June 5, 2006 at 9:35 pm

    I’m suggesting you split it up into different compositions within the same project. Or different layers. At any rate, you need to work with fewer keyframes at a time, it sounds like.

    Can you divide your data into 40 1000-line (or whatever) chunks, then run the script 40 times? Just stabbing in the dark here.

  • Knubile

    June 5, 2006 at 10:14 pm

    Ah. You think like me! 🙂
    I didn’t try that exactly, but pretty close. I ran the script to generate the first 20K keyframes, then stopped it. Closed down AE and even rebooted to make sure all RAM etc was released. Ran the script again, starting from 20K and it was very slow.

    Is having thousands of keyframes normal in AE? Wouldn’t motion tracking generate just as many if not more? I’m wondering if AE hits some sort of wall if this many keyframes.

  • Steve Roberts

    June 5, 2006 at 10:28 pm

    I’ve never heard of such a limit, but performance might depend on how the script is calculating keyframes. If it goes back and checks everything that has gone before … ?

  • Knubile

    June 5, 2006 at 11:25 pm

    If I comment out the one line that actually tells after effects to set the frame, the script takes maybe 3 seconds to run. So i’m sure its not my script. It making that call to AE to set a keyframe the 10 thousandth time.
    Maybe I’ll try really simplifying things. I’ll create a very short script and see. Just to elimate all variables.

  • Bascule

    June 12, 2006 at 1:04 pm

    If you don’t already, try calling app.beginUndoGroup before you start adding keyframes.

  • Knubile

    June 12, 2006 at 3:53 pm

    I’ve found the solution!

    Using the setValuesAtTimes method is much much quicker. Now the script loops through and creates two arrays. One array of composition times and one array of values. This method applies all the keyframes with one method call to after effects.
    The 40 minutes to run the script has now been cut down to under 1 minute!

    I’ve now used this approach on all my other scripts with large amounts of keyframes and the results are the same.

    Lesson learned. If you have to set many keyframes(Tens of thousands) us the setValuesAtTimes method.

    P.S. Turning on undo makes things worse. After Effects dies trying to keep undo history for every keyframe. Perhaps it will be different with this new approach though. I haven’t tried that.

    Thanks for all the suggestions!

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