Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions JSON / Essential Graphics performance in AE

  • JSON / Essential Graphics performance in AE

  • Scott Smith

    April 26, 2021 at 9:06 pm

    Hi all,

    I’m working on a video piece in which I’m trying to parameterize as much of the animation as possible in After Effects. The main composition contains a number of smaller videos that fade in and out at different times, as well as shape layers and text that accompany those videos as annotation graphics. Since a lot of the animation is repetitive, but slightly different each time, and I don’t want to recompose keyframes every time there’s a change from the client, I’m using AE’s Essential Graphics and JSON functionality pretty extensively. I’m trying to minimize keyframes, so I’ve written expressions using timecodes pulled from the JSON file to fade in and out each video without keyframing, for instance. This lets me set timecodes in the JSON, and not have to move keyframes if we want to rearrange the timing of different elements.

    Effectively, I’m trying to use a combination of Essential Graphics and JSON data to build a parametric video file, where the time of each event fading in, it’s duration, and even its position in the main composition comes from the JSON file. There’s also similar expressions driving trim paths on shape layers, which similarly take their start time, end time, and values from the JSON.

    (Apologies, I realize this might be vague — I would share the project file, except that the project is under NDA.)

    The process is working well, except that the preview and render times feel disproportionately slow. Even when I hide most of the elements and am just previewing the animation of a few shape layers, and reduce the preview quality to 1/4 or less, it still takes a long time to preview each frame. If I were to compose these lines with traditional keyframes rather than JSON data, the preview would be MUCH faster.

    I have not been able to find any detailed documentation from Adobe about how the JSON files work. Does the use of Essential Properties generally affect performance? Does AE query the JSON every frame, and does it have to read the entire JSON on every frame? The JSON is currently about 1200 lines–does that make a difference? If so, is there some way to read the JSON in once, at the beginning of the animation, and then access those values throughout the preview / render? (I’m kind of thinking of the difference between the “setup” and “draw” loop from Processing and other coding environments.) Is there anything else I’m not considering here?

    Curious if there’s any resources or best practices for this kind of data-driven / quasi-parametric workflow. Happy to try to provide more info on the process, if that would help. Apologies again for not being able to share the files.

    Thanks!

  • Filip Vandueren

    April 27, 2021 at 12:33 pm

    I’ve found that reading and parsing CSV or JSON myself in expressions (by using something like papaparse or just manipulaitng strings and splits) and not adding the data to the timeline was much faster last year, haven’t tested again with CC2021.

    At rendertime, I think after effects first does a sort of internal “convert to keyframes” before the first frames actually is rendered. But while working and preveiwing in AE it can be much slower.

    You can try to create a textlayer (in a different comp even ?) with an expression that starts with posterizeTime(0), do all your json lookups in there and return a list or an object that all the other expressions read out, that can speed things up since the JSON-file only needs to be accessed once, not by every individual expression.

    But again here: posterizeTime(0) will not prevent after effects from recalculating things while you are working and tweaking other things (for all AE knows, the expression might depend on a different layer’s position for example, so it’s constantly recalculating when you move seomthing), only at rendertime will it calculate just once instead of every frame.

  • Scott Smith

    April 27, 2021 at 6:03 pm

    Hi Filip,

    Thanks for these ideas. Curious to try the posterizeTime(0) method — does this basically tell that text layer to refresh only on the first frame, and never again? Sneaky.

    Re the parsing in expressions vs the timeline — I am currently reading the JSON in and addressing the objects i want on every expression. I’m also parsing layer names and property names to help address objects I’m pulling from the JSON. For instance, if the json looks like this:

    "obj1" : {
    "obj2" : {
    "obj3": { "dataToReturn" }
    }
    }

    I have expressions like this, on a layer called “obj2_obj3”

    jsonFile = footage("myJson.json").sourceData;
    obj1 = thisComp.layer("obj1").text.sourceText;
    addr = jsonFile[obj1][thisLayer.name.split("_")[0]][thisLayer.name.split("_")[1]];

    So, at the end, addr = myJson.obj1.obj2.obj3 = “dataToReturn”.

    I have stuff like this happening in dozens of expressions simultaneously. Is this what you mean by “parsing in the expression” vs. “adding data to the timeline”?

  • Filip Vandueren

    April 27, 2021 at 6:13 pm

    Yes, I meant that if you add a huge csv or JSON to the timeline, you can pickwhip to the individual exposed parameters that then show up in the timeline, but I found that was very slow, especially for cvs’s with 1000s of items, which was nearly unworkable

  • Tomas Bumbulevičius

    May 7, 2021 at 5:12 pm

    Indeed, I can accompany Filip – it will be a slow approach.

    To add even further, if you are using shapes, they became slower since CC 2020. Haven’t compared with CC 2021 yet, but on 2019 version shapes were SIGNIFICANTLY faster. Even if you don’t use new shapes transformation functionality – they became really slow. Keep that in mind in case if you link data with shapes in some way – it will slow things down.

    On a different note – Filip, did you happened to see improvements on expressions, which had to be faster if not required to be re-calculated? I believe it was introduced in 2020 as well – but definitely not a vastly noticeable thing.

    The reason why I mention this – maybe, it would be possible to benefit from this with data files.

Viewing 1 - 5 of 5 posts

Log in to reply.

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