Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Premiere Pro Scripting: Set In and Out Points of Clip

Engaged ,
May 12, 2019 May 12, 2019

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:

D0NFMRQ.png

(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.

TOPICS
SDK
3.7K
Translate
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 , May 13, 2019 May 13, 2019

I recommend setting the in/out points of the projectItem, before you insert a clip into the sequence.

Translate
Community Expert ,
May 12, 2019 May 12, 2019

Moved to Premiere Pro SDK

Translate
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 ,
May 13, 2019 May 13, 2019

I recommend setting the in/out points of the projectItem, before you insert a clip into the sequence.

Translate
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
Engaged ,
May 13, 2019 May 13, 2019

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.

Translate
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
Participant ,
Nov 04, 2024 Nov 04, 2024
LATEST

This works great on items like Adjustment Layers, but fails with Motion Graphics Template Media

Is there a workaround for that?

Translate
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