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("___________");
}
Copy link to clipboard
Copied
Hi.
Sorry for the late reply.
Did you manage to find a solution?
Please let us know.
Regards,
JC
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();
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.
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.
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.
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.
Copy link to clipboard
Copied
Thanks so much for taking the time to reply and for the original JSFL script 🙂
Copy link to clipboard
Copied
You're welcome.
I wish I could have helped you more.