Skip to main content
Sugarbank
Participating Frequently
December 7, 2016
Question

Save current AE composition as Jpg and process via Terminal Script

  • December 7, 2016
  • 4 replies
  • 1143 views

Hi guys,

I'm delving into running a MacOSX terminal script I have from within AE as a plugin.

Once the effect is applied to a layer or adjustment layer...

1) I need to write out data for the frame the user is currently looking at in the composition view as a jpg or png (not as a render que item just receiving the buffer through the SDK)

2) process this data as jpeg/png in my Terminal script in the background (thnk something like imagemagik etc.)

3) send the newly filtered image back to the after effects composition view though the SDK

I want this to all happen in the background and I'll be linking sliders from AE to send variables to my Shell script etc.

I'm pretty newbie i'm sorry but could any genius out there point me in the right direction to an SDK sample or know of a way that I can actually write out the data received by the SDK as jpeg, then receive an updated jpeg and write it back to the users composition view?

Thanks in advance guys:)

Cheers

This topic has been closed for replies.

4 replies

Sugarbank
SugarbankAuthor
Participating Frequently
May 10, 2017

Hi Kevin,

yes this was very helpfull thanks:)

Kevin J. Monahan Jr.
Legend
January 31, 2017

Hi Sugarbank,

Sorry for this problem. Did any of these responses help you out? Let us know if you resolved your issue.

Thanks,

Kevin

Kevin Monahan - Sr. Community and Engagement Strategist – Adobe Pro Video and Audio
Sugarbank
SugarbankAuthor
Participating Frequently
December 10, 2016

Yep, I'm using third party software that runs in the background.

Any ideas how this can be done?Seems like a simple approach but actually could be quite tricky.

Inspiring
December 10, 2016

I've no idea whether this will work, but here goes!

In your Render or SmartRender function write the input buffer out to disk using a JPEG or PNG library. Then use AEGP_ExecuteScript (part of AEGP_UtilitySuite) to run a simple ExtendScript that can use the system.callSystem() method to run your external process. The script itself is just a pointer to an A_char array you can build at render time from your params.

For example, you'd want the script to look something like this:

{

   system.callSystem("GraphicsProcessor -o123 -x456 -y789 path/to/my/temp/render.jpg");

}

The script will call the command line with your GraphicsProcessor command, and wait for it to finish. It will then pass the return string from GraphicsProcessor (if there is one) back to AEGP_ExecuteScript as an AEGP_MemHandle, which you can lock to read the result in your plugin. AFAIK there's no way to directly call the command line from a plugin (but I'm probably wrong!).

Then I guess it's just a matter of reading the processed jpg back from disk, decoding it and writing it to the output buffer.

This is risky of course because the command line function might not finish and your script, and plugin will be waiting forever for it to complete.

Good luck!

December 19, 2016

Christian wrote: "AFAIK there's no way to directly call the command line from a plugin (but I'm probably wrong!)."

FYI: there are various ways to directly call the command line from a plugin.

Aside from OS specific functions, there is a "system" function as part of C++ for a cross-platform approach:

http://www.cplusplus.com/reference/cstdlib/system/

Sugarbank
SugarbankAuthor
Participating Frequently
December 7, 2016

I guess basically what i'm after is sending the composition view to an external app and then reading that back in again.

But my external app needs the current composition view as a jpeg or png

Inspiring
December 9, 2016

Just out of interest, why can't you process your buffer directly in the plugin? Are you using third party software that can only be run from the command-line?