Skip to main content
arturp97454551
Participating Frequently
May 9, 2017
Answered

Editing clips with ExtendScript

  • May 9, 2017
  • 2 replies
  • 14412 views

hello, you hardworking, knowledgeable people!

I desperately need to automate a big part of the editing process in Premiere.

For the next project we will be recording tons of footage, where the main action on video will be repeating with variations many many times. We then need to split the long recordings into separate chunks. I will be able bring in time markers, for where to make the cuts.

But I've hit a wall when trying to manipulate clips on the timeline with ExtendScript. I can read a bunch of info about the clip, e.g.:

start

end

inPoint

outPoint

(.seconds and .ticks)

But I'm unable to change any of those values. And the only functions I've found deal with selecting a clip i.e. isSelected() and setSelected()

Are there any ways to trim/cut/move, whatever, clips on the timeline using ExtedSctipt scripts, or am I badly out of luck?

And to finish off what I'm trying to do I'll need to do something like "Make Subsequence" with all of the cuts, to separate them into their own videos I can then export, again looking to automate this.

Many thanks!

This topic has been closed for replies.
Correct answer Bruce Bullis

I think I tried what you suggested, but I didn't get anywhere

Please, correct me if I misunderstood

for sake of simplicity say I have this:

I set in/out points on "ImportedClip" at 00:00:01:00 and 00:00:02:00 respectivelly

then I run insertClip() to insert it into "FinalSequence"

Result - I add 1s of footage from "ImportedClip" to "FinalSeqence". As expected.

Next with Sequence:

I set in/out points on "DonorSequence" same as above

I run insertClip(), this time grabbing that sequence and putting it into "FinalSequence"

Result - I add the whole sequence "DonorSequence", and not just the frames between in/out

So using in/out doesn't seem to be the solution at least how I see it. I hope I'm wrong and missing something, or that there's another way to add a section of one sequence into another sequence.


Thanks for the repro case, Arthur! We're tracking the issue as:

DVAPR-4202375, "Sequence in/out points are not respected, when sequence's projectItem is used to insert it as a clip".

I'll keep the list informed of our progress.

2 replies

Known Participant
February 6, 2018

try this

var seq = app.project.activeSequence;

var vTrack = seq.videoTracks[3];

var VinClip = $._PPP_.getClipFromeSequence("1.png", vTrack);

var endTime =VinClip.end;

endTime.seconds = 50;

var startTime =VinClip.start;

startTime.seconds = 10;

VinClip.start = startTime;

VinClip.end = endTime;

getClipFromeSequence: function (name, Track) {

     for (var i = Track.clips.numItems - 1; i >= 0; i--) {

          var clip = Track.clips;

          if (clip.name == name) {

               return clip;

          }

     }

     return 0;

}

i can trim clip on the timeline .

Aecorn
Inspiring
February 6, 2018

This is cool, thanks, im getting some stuff happening!

I realized that the ORDER in which you paste on attributes onto clips affects how they change in the timeline...
(Not very intuitive.)
But this seems to copy edit-info well from one clip to the next (debugging now).

         var clip1 = app.project.activeSequence.videoTracks[0].clips[0];

        var clip2 = app.project.activeSequence.videoTracks[1].clips[0];

        if (clip1.start.seconds > clip2.end.seconds){

            clip2.end = clip1.end;

            clip2.start = clip1.start;

        }else{

            clip2.start = clip1.start;

            clip2.end = clip1.end;

            }

        clip2.inPoint = clip1.inPoint;

        clip2.outPoint = clip1.outPoint;

        clip2.duration = clip1.duration;

Inspiring
May 9, 2017

Hi,

as andymees has already stated as reply to your original post, mimicking in-timeline editing is not possible through ExtendScript as of today, but you can try to mimic classical 3-point editing through a script if your marker information is of such quality that you can calculate the time values for the source clips, referring to the latest PPro Panel version. Your mileage will vary here.

The other way round would be to perform this even outside of Premiere with (shell) scripts, again depending on what source data you have, and create FCP XML sequences that you can import to Premiere afterwards. This might also help with your batch encoding requirements.

Erik

arturp97454551
Participating Frequently
May 10, 2017

Hi e.d.!

Thanks for helping out! you gave me some ideas, so I'll try to see where I can take them.

In the meantime, on PProPanel "insert or append to active sequence" uses .insertClip() function, this may be useful, but Premiere throws an error that it "is not a function".

That's with the latest unmodified PProPanel, and Premiere 2015.4 (v10.4.0(30))

Any ideas?

Edit: Decided to grab Premiere 2017, and sure enough it does support insertClip() function. BTW, I'm using this super handy extension "PropertyExplorer", incredibly useful as well

Inspiring
May 10, 2017

It has just been implemented with v2017.1, it's not available in previous versions. Something to keep in mind when writing the manifest file.