Is Adobe Media Encoder scriptable with ExtendScript?

Adobe media encoder is 'officially' not scriptable but we can use extend script API for scripting AME. Below functions are available through extend script

1.Adding a file to batch

Encode progress

host = App.GetEncoderHost (); 

enc = EHost.CreateEncoderForFormat ( "QuickTime");

flag = Enc.LoadPreset ( "HD 1080i 29.97, H.264, AAC 48 kHz"); 
an if (flag) { 
f = enc.encodeEncodeProgress 
= function (progress) { 
$ .writeln (progress); 
} 
eHost. enc.encode ("/ Users / test / Desktop / 00000.MTS", "/Users/test/Desktop/0.mov"); 
} else { 
alert ("The preset could not be loaded "); 
} 

encode end

ehost = App.GetEncoderHost (); 
enc = EHost.CreateEncoderForFormat ( "QuickTime"); 
flag = Enc.LoadPreset ( "HD 1080i 29.97, H.264, AAC 48 kHz"); 
an if (flag) { 
f = enc.onEncodeFinished 
= function (success) { 
if (success) { 
alert ("Successfully encoding has ended "); 
} Else { 
Alert (" failed to encode "); 
} 
} 
EHost.RunBatch (); 
} Else { 
Alert (" preset could not be read "); 
} 

2.Start batch

eHost = app.getEncoderHost (); 

eHost.runBatch (); 

3.Stop batch

eHost = app.getEncoderHost ();

eHost.stopBatch (); 

4.Pause batch

eHost = app.getEncoderHost (); 

eHost.pauseBatch ();

5.Getting preset formats

EHost = App.GetEncoderHost (); 

List = EHost.GetFormatList (); 

6.getting presets

eHost = app.getEncoderHost (); 

enc = eHost.createEncoderForFormat ("QuickTime"); 

list = enc.getPresetList (); 

and many more...

The closest bits of info I've found are: http://www.openspc2.org/book/MediaEncoderCC/

The latter resource is actually good, if you can read japanese, or at least use the Chrome built-in translate function, then you can see it has resources such as this one:

http://www.openspc2.org/book/MediaEncoderCC/easy/encodeHost/009/index.html

We can perform almost all basic functionalities through script.


I had a similar question about Soundbooth.. I haven't tried scripting Adobe Media Encoder though, it doesn't show up in the list of applications I could potentially connect to and script with the ExtendScript Toolkit.

I did find this article that might come in handy if you're on a Windows. I guess using something similar written in AppleScript could do the job on a OSX. I haven't tried it, but this Sikuli thing looks nice, maybe it could help with the job.

Adobe Media Encoder doesn't seem to be scriptable. I was wondering, for batch converting, could you use ffmpeg ? There seem to be a few scripts out there for that, if you google for ffmpeg batch flv.

HTH, George


The official stance at the moment is "no", but if you open the Adobe Extend Script Toolkit, and set the target app to Media Encoder, you will see in the Data Browser that a few objects and methods are already exposed in the app object, like app.getFrontend(), app.getEncoderHost() etc. There is no official documentation though, and no support, so you are free to experiment with them at your own risk.

You can use the ExtendScript reflection interface like this:

a = app.getFrontend()
a.reflect.properties
a.reflect.methods
a.reflect.find("addItemToBatch").description

But as far as I can see, no meaningful information can be found this way beyond list of methods and properties.

More about the ExtendScript reflect interface can be found in the JavaScript Tools Guide CC document.


Year 2021

Yes, AME is scriptable in ExtendScript. AME API doc can be found at https://ame-scripting.docsforadobe.dev/index.html. The API methods can be invoked locally inside AME or remotely through BridgeTalk.

  1. addCompToBatch and other alternatives in the API doc seem to be safe to use. This is working:
    app.getFrontend().addCompToBatch(project, preset, destination);

The method requires project to be structured so that 1 and only 1 comp is at the root of the project.

  1. encoder.encode – references of which can be found in Web, supposed to support encode progress callbacks - is not available in AME 2020 and 2021. As a result, this is not working:
    var encoder = app.getEncoderHost().createEncoderForFormat(encoderFormat);
    var res = encoder.loadPreset(encoderPreset);
    if(res){
        encoder.encode(project, destination);  //  error: encode is not a function
    }

The method seems to have been removed in AME 2017.1, according to the post reporting the issue https://community.adobe.com/t5/adobe-media-encoder-discussions/media-encoder-automation-system-with-using-extendscript/td-p/9344018