Premiere + javascript automation.

New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I need to make automated video creation using javascript from small videos.

The main problem is that i can't find any proper documentation...

For example this will receive error:

 

folder = new Folder('C:\Users\dangerd\Desktop\Test');
var tempFiles = folder.getFiles(function(f) { return f instanceof File; });

 

 While this works well: (folderPath variable is somehow defined)

 

new Folder('C:\Users\dangerd\Desktop\Test');
var tempFiles = folderPath.getFiles(function(f) { return f instanceof File; });

 

 okay, that's weird...

So next question, how i can import all files from specified directory and put them into timeline with simple transitions between them and export video?

TOPICS
How to, SDK

Views

149

Likes

translate

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 , Mar 23, 2021 Mar 23, 2021
The first snippet ("this will receive error") works fine, here. > how i can import all files from specified directoryIn the above example, you would call importFiles(), passing in an array of file paths...which you can obtain, in your example, via tempFiles[a].fsName (where 'a' is less than the number of items in the tempFiles array).>...put them into the timeline Here's how to insert: https://github.com/Adobe-CEP/Samples/blob/63f176a4903b9be9e6aa73133ae689a3904f78c8/PProPanel/jsx/PPRO/Premiere.jsx#L1655...

Likes

translate

Translate

Translate
Adobe Employee ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

The first snippet ("this will receive error") works fine, here.


> how i can import all files from specified directory

In the above example, you would call importFiles(), passing in an array of file paths...which you can obtain, in your example, via tempFiles[a].fsName (where 'a' is less than the number of items in the tempFiles array).

>...put them into the timeline 

Here's how to insert: https://github.com/Adobe-CEP/Samples/blob/63f176a4903b9be9e6aa73133ae689a3904f78c8/PProPanel/jsx/PPR...

> with simple transitions

There's no method for applying transitions, within PPro's supported public DOM.

 

Likes

translate

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 ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

DangerD5E05_0-1616513275303.png

First snippet doesn't works, it shows 0 files while second returns videos count

Likes

translate

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 ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I've confirmed that this snippet works correctly. 

var folder = new Folder('/Users/bbb/Desktop/testtest');

var tempFiles = folder.getFiles(function(f) { return f instanceof File; });

for (var a = 0; a < tempFiles.length; a++) {
    var pathToThisFile = tempFiles[a].fsName;
}

 

Likes

translate

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 ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Will you plan to add transition setting using javascript?

I need to automate full video creation without user interaction at all.

Currently i'm using MLT framework, but it's very limited...

 

P.S. It doesn't work for me anyway (v.15 build 41) maybe i need to update it...

DangerD5E05_1-1616581664585.png

 

 

Likes

translate

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 ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

> Will you plan to add transition setting using javascript?

 

Yes, applying transitions via ExtendScript has been a requested feature, for some time. It's unlikely to be implemented until after we've moved PPro's API to UXP.


> P.S. It doesn't work for me anyway (v.15 build 41) maybe i need to update it...
Updating isn't the issue; there have been no recent changes to the API. 

On line 1, you might try double backslashes for the path to work correctly; C:\\Users\\Dangerd\\...

Sorry, I have no idea what the MLT framework is. 🙂

Likes

translate

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