Nexrender: Tracking on Rendering Progress

Created on 3 Apr 2018  路  11Comments  路  Source: inlife/nexrender

Thank you so much for making this library open source! It's super useful for personalised video rendering and I can also generate image thumbnail from your library.

However, I would like to ask if is there any functions / callback that I can use to keep track on the progress of rendering? For example, I would like to know how many percent left for the rendering process to be completed once I run renderer.render . Or do you have any suggestions on this?

Btw. I'm very new to After Effects CC and aerender. Hope you understand.

question

All 11 comments

Hello, thank you for your feedback, really appreciate it !!
Regarding the progress callback, the only solution i could come up with
is just parsing the logs as they appear from the aerender process

for example, you could add console.log there:
https://github.com/inlife/nexrender/blob/master/renderer/tasks/render.js#L98

at least for the purpose of understanding how does it behave
and maybe you will come up with much better way to do this

Here is a bit of a brute force method. Im sure there is a more elegant way of writing this but its still effective. I modified Vladyslav's highlighted function to look like this:

ae.stdout.on('data', (data) => {

    aedata.push(data.toString());
    var str_len = data.toString().split(/[()]+/).filter(Number).length;
    var str_filter = data.toString().split(/[()]+/).filter(Number);

    if (str_len === 1) {
        var percent_div = ((str_filter/project.settings.endFrame) * 100).toFixed(2);
        var percent_complete = Math.max(0.00, Math.min(100.00, percent_div));
        console.log(`${percent_complete}% complete`);
    }
});

Hi, thanks @inlife for making this amazing library, it's extremely useful and I really appreciate all your hard work. Thanks @CobraMachete for that piece of code, it just what I had in mind. I was just wondering if anyone knew the best way to pass the percent_complete var back (or the data stream) to this part of the API setup in my original node app.

project.on('rendering', function(err, project) { });

Tried everything I can think of. Any help would be amazing :)

Thank you @craftedbychris for your feedback, very pleased to hear that :)

As far as I understand your use case is node app, with API connection to master ?
In that case it kinda hard to get such a constant feed of information back to the client from render node via HTTP. This is possible, however it requires a lot of hustle around.

In case of @CobraMachete that was a local client that he just printed info from via console.log. So that was much easier.

Maybe I didnt understand you properly tho, and you have slightly different use case?

Thank you.

Hi @inlife, thanks for the quick reply I appreciate it. Yes that;s right, I have a main node app calling API to render, I modified the code from the - Usage (Render network + node.js API wrapper) example on the homepage.

I'm then running nexrender api-server & nexrender renderer, both on port 8000. Everything is working great, getting videos back as they should be. @CobraMachete's code works but the console log prints to the nexrender window.

Any ideas in the best direction to head to get it back to the node app itself? Would it be best to read the ae log file into the main app and process it there?

Many Thanks :)

Well, i just thought about one quite simple method. You can write the that log in a file to whatever place you want to.

So you could try to do that, and then from main app just look for file, and as soon as it appears just read it in stream, real time.

That way in theory it might work for you. What do you think about that ?

Yes that sounds like the easiest and most direct option I think. I will play around today and let you know what happens.

Thanks for your time @inlife :)

Thank you everyone for the methods given! Much appreciate. 馃
I guess I will try out the data streaming on log file one then.
Thanks again for this awesome library. :)

Hi Everyone, just an update of what I did. It's still a bit of a work in progress. It's fairly simple (but messy), I used createWriteStream to write the percent_complete var to a text file. Then inside the project.on('rendering') function of the API call, I use readFile every half a second to read in the current percentage in the text file until it equals 100 percent. Whilst this happening I stream the variable using socket/IO to the font end and process it accordingly. As I said it's messy, and I'm trying to find a neater way to do it. But it works for now. I probably should just try to socket it straight from the source, but my head nearly imploded trying to implement it, so I gave up. :)

hey, thats a nice job anyway, even tho that sounds funny, still great :D

worker-side rendering progress has been added in the latest pre-release version, closing the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leq382121 picture leq382121  路  6Comments

pdkn picture pdkn  路  5Comments

JamesBotterill picture JamesBotterill  路  4Comments

danielgwilson picture danielgwilson  路  3Comments

mackenly picture mackenly  路  5Comments