Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add imported files into sequences using Premiere Pro's ExtendScript connection

I'm trying to create a script in ExtendScript for Premiere Pro that will load-in specified video files, clip them at specified start and stop times, place them into a sequence and then export the resulting movie.

I understand that Adobe doesn't have an official documentation about scripting for Premiere Pro, so I've been working from the data browser (in the ExtendScript Toolkit, or ESTK) and a collection of handy class references I've found here.

I have successfully loaded in the CSV file that specifies the needed info and also know how to import the video files and create a new sequence (as explained here). The trouble I'm having now is getting the imported files clipped correctly and placed into the sequence. I see that the activeSequence has methods like setInPoint and setOutPoint, but that doesn't seem to result in the correct trimming upon export.

Here is my code with comments to show flow of overall script:

#target premierepro

var myDir = "G:\\directoryWithVideoFiles\\";
// defined "indexOf" subfunction here
// ***** begin main body of script *****
// (dataRuns has fields runName, startVideo, startTime, stopVideo, stopTime)
// Import video files listed in dataRuns
var vidFiles = new Array;
for (i=0; i<dataRuns.length; i++) {
    if (indexOf.call(vidFiles,myDir + dataRuns[i].startVideo + '.MPG') == -1) {
        vidFiles.push(myDir + dataRuns[i].startVideo + '.MPG');
        }
    if (indexOf.call(vidFiles,myDir + dataRuns[i].stopVideo + '.MPG') == -1) {
        vidFiles.push(myDir + dataRuns[i].stopVideo + '.MPG');
        }
    app.project.createNewSequence(dataRuns[i].runName,'');
    }
app.project.importFiles(vidFiles);
// at this point, for each run (called runName) I need to:
// - take a clip of the startVideo from the startTime to the end of the video
// - take a clip of the stopVideo from the start of the video to the stopTime
// - put clip 1 at the beginning of the associated sequence, & clip 2 right after
// - export the sequence as a new video file
like image 580
adara Avatar asked Oct 07 '13 20:10

adara


People also ask

How do I add a file to a sequence?

In order to add a file click the “Add files” button at the timeline toolbar or click the empty frame in the timeline. Select a file in the open dialog and it will be added to the end of the timeline. If you want to change the order of the frames, use the corresponding buttons on the toolbar.


1 Answers

Rather than setting in/out points on the active sequence why not load your raw video into the source window instead, and set the in/out points there, and then build up the final version inside the active sequence.

Copying the clip from Source to sequence can be done many ways and should be pretty easy.

So yea, my advice would be try using source rather than the sequence for clipping. Might have better luck.

like image 140
sawa Avatar answered Oct 12 '22 11:10

sawa