Copy link to clipboard
Copied
Suppose I have a 2-minute long media file and an empty timeline for the currently active sequence. Now, suppose I want to write a Premiere Pro script that will put that media file at the beginning of the timeline, but it should start playing 45 seconds into the clip and end exactly 10 seconds later (at 55 seconds into the clip). It would be the equivalent of this:
(In this image, we see that the footage is 2 minutes long, the first 45 seconds of the footage are trimmed off, and it only plays for 10 seconds).
I would like to achieve this through scripting, but I'm not sure. I tried something of this order, but it did nothing more than simply put all 2 minutes of the clip into the sequence timeline:
var file1 = "C:\\Path\\test.mxf"
var backsBin = app.project.rootItem.createBin("Backs")
app.project.importFiles([file1], false, backsBin);
var thisTrack = app.project.activeSequence.videoTracks[0];
var projItem = backsBin.children[0];
thisTrack.insertClip(projItem, 0); // second arg is time in seconds to insert at
thisTrack.clips[0].inPoint.seconds = 45
thisTrack.clips[0].outPoint.seconds = 55
What is wrong with my code, and what can be done to fix it? It seems like there's no way to set in and out points, as those last two lines don't seem to do anything. I am on Windows 10, PPro CC 2017.1.2 for reference.
I recommend setting the in/out points of the projectItem, before you insert a clip into the sequence.
Copy link to clipboard
Copied
Moved to Premiere Pro SDK
Copy link to clipboard
Copied
I recommend setting the in/out points of the projectItem, before you insert a clip into the sequence.
Copy link to clipboard
Copied
Your solution works in CC 2019, but not in CC 2017 (it appears setInPoint() and setOutPoint() don't exist for a project item in CC 2017). Thanks.