• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Adding a second output in Extendscript for Media Encoder

Community Beginner ,
Apr 04, 2017 Apr 04, 2017

Copy link to clipboard

Copied

Hi,

I am using Extendscript to automate rendering from After Effects projects.

In the Extendscript toolkit, or through BridgeTalk, I can make the following work with AME cc:

var fnt = app.getFrontend();

var ech = app.getEncoderHost();

var exp = app.getExporter();

//The comp to be rendered

var cmp = "F:\\ProjectsAE\\AEProject.aep";

//AME presets to be used (I had to copy the epr files from their original location to a simple path for this to work)

var pst = "C:\\AMEPresets\\AVC-Intra Class100 1080 50i.epr";

var pst2="C:\\AMEPresets\\PAL DV Widescreen.epr";

//Output files without extensions

var out = "F:\\ProjectsAE\\Render\\AEProject_Onair";

var out2="F:\\ProjectsAE\\Render\\AEProject_Preview";

//This adds onair preset/output

fnt.addCompToBatch(cmp,pst,out);

//This adds preview preset/output for the same comp

fnt.addCompToBatch(cmp,pst2,out2);

//This starts rendering

ech.runBatch();

//This deletes the queue

//exp.removeAllBatchItems();

The problem is that two render items are added in the batch, one for each output preset.

I'd like to add both output presets to the same render item, so both can render simultaneously instead of one after another.

Is there an extendscript method to do so?

Is there some kind of documentation for AME extendscript?

The last "extendscript is unsupported for AME" messages date back from 2 years ago. Is anything supported by now?

Even if it's preliminary or beta, I'd love to know how to use it. Especially the syntax for the other addToBatch commands.

Chris

Views

3.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , May 26, 2017 May 26, 2017

Yes! AME scripting is now officially supported. No documentation, of course—wouldn't want you to think we'd gone soft.

Write me directly (day job = b b b at adobe dot com) with a description of the workflow(s) you'd like to support, and I can provide better guidance.

Votes

Translate

Translate
Community Expert ,
Apr 11, 2017 Apr 11, 2017

Copy link to clipboard

Copied

Chris,

I'm in the same situation as you, and an Adobe rep just recently confirmed that Media Encoder scripting is currently unsupported. I posted a question on this exact issue, and the word from Bruce Bullis is that there is no current function to send multiple output modules in Encoder from Premiere or After Effects.

I've been digging around in ESTK, like I assume you have, and have found several methods such as .addItemToBatch() and .addCompToBatch(), but nothing allowing multiple output modules. I also don't see any way to specify which After Effects comp you want to export when selecting an .aep file, it currently just grabs the first comp it finds, have you found a solution to this?

Bruce Bullis​ anything you can add to this conversation and or are you guys planning to support AME scripting in the near future?

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 11, 2017 Apr 11, 2017

Copy link to clipboard

Copied

We cannot comment on the feature set of unannounced versions of Adobe products.

With that in mind, I'd appreciate the community's patience in awaiting substantive reply, closer to (or soon after) NAB.

PS: Many scripters export the active Comp to a new .aep before rendering it, and some archive that .aep with the output file...in which case, the comp-to-be-rendered is determined DETERMINATE. [shakes fist emptily at auto-correct's insensitivity to Epistemology...].

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 11, 2017 Apr 11, 2017

Copy link to clipboard

Copied

Thats understandable. Appreciate your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2017 May 26, 2017

Copy link to clipboard

Copied

Bruce-

Following up on your post here,  now that we are post-NAB, any more thoughts on Media Encoder scripting? 

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 26, 2017 May 26, 2017

Copy link to clipboard

Copied

Yes! AME scripting is now officially supported. No documentation, of course—wouldn't want you to think we'd gone soft.

Write me directly (day job = b b b at adobe dot com) with a description of the workflow(s) you'd like to support, and I can provide better guidance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 16, 2017 May 16, 2017

Copy link to clipboard

Copied

Hi Justin,

About the need to have only one comp in the root of your project:

My solution is to have all working comps in subfolders, and copy only the one you need to send to AME in the root folder, using a predefined name:

This is my extendscript (simplified)

//Important: To work with AME, The render comp MUST be the only comp in the root folder

//Only the first comp found will be rendered!

//Remove any existing rendercomp in the root folder (there can be only one!)

var oldComp = findCompInProject("AMERenderComp"); //This is not a standard function, I created my own!

if(oldComp!=null) oldComp.remove();

//Copy this comp, move it to the root folder and rename

var theComp = findCompInProject("Comp_to_be_rendered");

var dupComp = theComp.duplicate();

if(dupComp!=null) {

     dupComp.parentFolder = app.project.rootFolder; //built-in FolderItem object for the root folder

     dupComp.name = "AMERenderComp"; //Rename

     SaveFile = new File("SaveProject.aep");

     app.project.save(SaveFile); //Save this as the file to be sent to AME

}

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 16, 2017 May 16, 2017

Copy link to clipboard

Copied

Thanks for posting that Chris! I ended up using a similar method by consolidating all items into a subfolder with the master comp in the root. My temporary workaround for rendering one comp while maintaining the project's folder structure was to put all the consolidate methods in an undo group, save as a new .aep file specifically for the AME Render, and then undo the group and re-save to the original project file so you can continue working. I wish we could automate the "Save As Copy" in Extendscript, but for now this is the best method I could come up with. Best!

In case anyone else is interested in my workaround:

Consolidate as a separate file, save as export .aep, and then re-save over the original to preserve your project.

     // 1. Create Temp Consolidated File For Rendering //

          var projFile = new File(File.decode(app.project.file));

          var tempFolder = new Folder(projFile.path.toString() + "/AME_temp"); var dateStamp = new Date(); dateStamp = dateStamp.getTime();

          var tempProjFile = new File(tempFolder.toString() + "/" + app.project.file.name.toString() + aItem.name.toString() + "[" + dateStamp.toString() + "].aep");

          app.project.save(); app.project.save(tempProjFile); // Save Original File then Save Temp File

          app.beginUndoGroup("AME Export");

          app.project.reduceProject(aItem); // Reduce

          aItem.parentFolder = app.project.rootFolder; // Move active comp to Root for AME to recognize

          var allItems = app.project.items;

          var assetsBin = app.project.items.addFolder("-Assets");

          for (var i = 1; i < allItems.length; i++) {

              if(allItems.name != assetsBin.name && allItems.name != aItem.name)

                  allItems.parentFolder = assetsBin;

          }

          app.endUndoGroup();

          app.project.save();

          app.executeCommand(16); // Executes undo function to restore original

          app.project.save(projFile);  //Save Consolidated File

And then to Send to AME:

        // 2. Create Export Command for AME //

        var bodyText = "";     var myFile = tempProjFile.fsName;

        // Loop for each preset and add command to bodyText //

        for (var i = 0; i < myDestination.length; i++) {

          bodyText += "ameFront.addCompToBatch('" + myFile.toString() + "', '" + myPreset + "', '" + myDestination + "');";

        }

        var fileString = "var ameFront = app.getFrontend();" + bodyText;

       

        // 3. Send Command to AME for Export //

         var bt      = new BridgeTalk();

         bt.target   = 'ame';

         bt.body = fileString;

         bt.send();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

Interesting idea of using an undo group.

I don't really trust the "reduce project" feature. Some expression errors pop up in some templates, so I don't use it.

For "Save a Copy..." try this one: (tested OK in AE 2017)

app.executeCommand(2166);

It will pop up the dialog to save a project as a copy.

fyi: It has been posted here before, but the SBLECC (Secret Black List of ExecuteCommand Codes) can be found on

https://www.provideocoalition.com/after-effects-menu-command-ids

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

Good point on avoiding reduce project! I hadn't considered expressions getting broken in the process. I'll probably just remove that part as it's not vital to my process anyway.

I did try executeCommand, however I need the process to be fully automated, I don't want the user to have to fill out the save dialog every time they want to export to AME. That's why I'm using the workaround.

That list is great, for reference you can find any executeCommand() ID number by simply searching for it with the JS Console in ESTK using app.findMenuCommandId()

Example:

app.findMenuCommandId("Save")

Result: 5

Best!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2024 Jul 10, 2024

Copy link to clipboard

Copied

LATEST

Hi, is there a way to immediately start rendering in the media encoder when calling it from AE? And also track the progress of the render in order to import the render file back into AE?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines