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

Export to AME and start right away using JSFL from Adobe Animate

Participant ,
Mar 20, 2023 Mar 20, 2023

Copy link to clipboard

Copied

Using some JSFL code that @JoãoCésar posted.I want to export a folder of .FLA files to Adobe Media Encoder (ame) and start the ame right away. At the moment my .jsfl sends it to the ame fine but the user has to start the queue.

 

var uri = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf('/')); // get the directory path of the currently executing script
var source = uri + "/_source";
var files = FLfile.listFolder(source + "/*.fla", "Files.");
var total = files.length;
var dom, i;

try
{
for (i = 0; i < total; i++)
{
fl.openDocument(source + "/" + files[i]);
dom = fl.getDocumentDOM();
dom.exportVideo(source + "/" + files[i].slice(0, -4) + ".mov", true, false, true, dom.timelines[0].frameCount);
dom.close(false);

// Get the path of the output file
var outputFile = source + "/" + files[i].slice(0, -4) + ".mp4";

// Add the output file to the encoding queue and start the encoding job
var queue = ame.getQueue();
var enc = queue.createEncoder("my_encoder");
enc.setSettingsPreset("H.264");
enc.setOutputFile(outputFile);
queue.queueIn(AMEFile(outputFile));
queue.startEncoding();
}
}
catch(error)
{
fl.trace(files);
fl.trace(error);
fl.trace("___________");
}

TOPICS
ActionScript , Import and export

Views

211

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 ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

Hi.

 

Sorry for the late reply.

 

Did you manage to find a solution?

 

Please let us know.

 

Regards,

JC

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
Participant ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

Hey,

No i've tried a lot of things but i can't seem to figure it out, unless it's not possible? I've slimmed down the JSFL to closer to your example but this looks in a folder called 'fla' and loads everything automatically.

 

function main()
{
var uri = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf('/')) + "/fla"; // get the directory path of the 'data' folder
var files = FLfile.listFolder(uri + "/*.fla", "Files.");
var total = files.length;
var dom, i, source;

try
{
for (i = 0; i < total; i++)
{
source = uri + "/" + files[i];
fl.openDocument(source);
dom = fl.getDocumentDOM();
dom.exportVideo(source.slice(0, -4) + ".mov", true, false, true, dom.timelines[0].frameCount);
dom.close(false);
}
}
catch(error)
{
fl.trace(files);
fl.trace(error);
fl.trace("___________");
}
fl.quit(); // Close Adobe Animate after the code has finished running
}

main();

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
Participant ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

Just to clarify this works perfectly but i want the media encoder to start automatically. At the moment it just puts it in the queue paused.

 

I know i could auto encode the folder but this will be used on various machines and it won't be possible to set that up.

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 ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

There's a confusion here. This ame API doesn't exist in the current JSAPI in Animate.

 

Adobe Media Encoder is actually opening because of the exportVideo call and it only adds the exported videos to the queue.

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
Participant ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

Ah ok, so it's no possible?

when you go to export video in adobe animate there is an option to start queue immediately- I wondered if it might be possible via JSFL. 

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 ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

Not that I know... According to the JSAPI documentation, it's only possible to send an exported video to AME and that's it.

 

Maybe you can try an indirect way to communicate with AME using an external script or something, but I guess you would have to ask in the AME forum about this possibility.

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
Participant ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

Thanks so much for taking the time to reply and for the original JSFL script 🙂

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 ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

LATEST

You're welcome.

 

I wish I could have helped you more.

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