177

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
adara
  • 1,871
  • 1
  • 12
  • 6
  • 2
    please add your code or jsfiddle example also. – Anup Oct 17 '13 at 04:49
  • 6
    @Anup I've added my code to the main question. As you can see, I am not interacting with HTML, and I have no need of a video player. I have read through all the documentation you linked for Video.js, and I'm almost certain it will not do what I need. – adara Oct 17 '13 at 13:19
  • 3
    @adara, ah you said the word "video"!!! Let me paste this **CLEARLY UNRELATED** jQuery plugin link [here](http://stackoverflow.com). That should fix the **ADOBE PREMIERE XML SCHEMA WRITER** using ExtendScript!!!! – Xeoncross Aug 11 '14 at 20:23

1 Answers1

2

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.

sawa
  • 559
  • 2
  • 4