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

Editing clips with ExtendScript

Community Beginner ,
May 09, 2017 May 09, 2017

Copy link to clipboard

Copied

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!

TOPICS
SDK

Views

9.6K

Translate

Translate

Report

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 11, 2017 May 11, 2017

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.

Votes

Translate

Translate
Engaged ,
May 09, 2017 May 09, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Community Beginner ,
May 10, 2017 May 10, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 10, 2017 May 10, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Enthusiast ,
May 10, 2017 May 10, 2017

Copy link to clipboard

Copied

arturp97454551  wrote

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

Two quick questions:

  1. Is the insertClip() function you're talking about an ExtendScript API? If so, what class of object is it on?
  2. What is the PropertyExplorer extension? Do you have a link you could share?

Thanks!

Votes

Translate

Translate

Report

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
Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Hi sberic!

insertClip() is avalable if you dig into:

app.project.activeSequence

and then either .audioTracks[number of track you want] or .videoTracks[number of track you want]

then you can go .insertClip(clip you want to add, timestamp for the clip to start from)

But you can see all that from the "InsertOrAppend" function in latest PProPanel

Here's the link to the extension, it's a free odd on:

https://creative.adobe.com/addons/products/1170#.WRQJd-V96bg

the beauty of it is that you can start typing things like "app.project".. and get a list of all available objects/properties, then maybe add one of them and go deeper  and if you tick the "Method list" checkbox, you will also get any available functions

Votes

Translate

Translate

Report

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
Enthusiast ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Hi arturp97454551​!

Thanks so much for adding this information. It is extremely helpful. It seems that Adobe has not done a complete job in keeping the documentation (internal or otherwise) up-to-date. Without looking at the Property Explorer panel, I would guess that it iterates over types and uses the Reflection class to list what's possible...

Bruce Bullis​, is there any initiative at Adobe to wrangle the current state of APIs and provide documentation? Examples (PProPanel) are good, but they are not great for searchability. The api_doc.html is woefully out-of-date (and, honestly, the format would be better as a TypeScript declaration file than an HTML file - I have a workable version of this locally if you're interested). What's more, is that the ExtenScript Toolkit Object Model Viewer which has a decent view into feature support is also out-of-date. I dug around a little and it appears that it's driven by XML files with declarations (at least some appear to be). They are, however, also incomplete.

Given the number of requests like "Is feature X doable?" in the forums, it seems as though updated documentation would save everybody time. At the very least you could point to the documentation and say: "See the documentation. That is what is supported." It would also help others in the forum help each other as someone may now a round-about way to solve a given issue with the available APIs.

At the very least, could you add my vote to an "Improve Documentation, please!" ticket?

Votes

Translate

Translate

Report

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
Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Glad it could be useful to you, sberic!

And now on to my followup "is feature X doable" questions?

Question 1:

Any way to nest segments of a sequence in another?

I'll explain:

with createSubClip() i can split a piece of imported footage into as many sections as I want (and I can set In and Out points for each of them separately, which is great), and then bring them into my sequence using insertClip() no problem. Or alternatively just use insertClip(), it seems to respect In and Out points if they were set prior. That great.

But if I want to do something similar with a sequence? So in this scenario I have a long sequence, it has effects and audio set as I need it. Now I want to "insert" only a part of this sequence into another. I'm out of ideas. All I can do is insert the sequence in it's entirety.  so any help is much appreciated.

Question 2 (if there's no easy way to do question 1):

I also tried looking at how how "modifyProjectMetadata" function in PProPanel does it's thing. Hoping that I can force the beginning and end of an project item with setProjectMetadata(). But was unsucessfull, and not sure if it will work (there are a bunch of values that may need changing).

In the meantime, before doing it all in code, is there a straightforward way to export getProjectMetadata() as .xml. Fiddle with it manually and then import it back as setProjectMetadata()?

Votes

Translate

Translate

Report

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 11, 2017 May 11, 2017

Copy link to clipboard

Copied

1. Sequences are projectItems, and you pass projectItems to track.insert()...

2. I suppose you could export it to an .xml file, but why not just get-then-modify that metadata, in memory?

Votes

Translate

Translate

Report

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
Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

1. and can we specify start and end points for projectItems when doing track.insert()?

2. mainly because I'm not that fast of a coder and could test my ideas a little faster this way

Many thanks!

Votes

Translate

Translate

Report

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 11, 2017 May 11, 2017

Copy link to clipboard

Copied

1. I think so; you'll need the in/outs set for the master clip first. https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/Premiere.jsx#L1310

Votes

Translate

Translate

Report

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
Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Lazy testing request: Could you send me your project and test script?

Votes

Translate

Translate

Report

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
Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

No problem, thanks. Heres a gdrive link:

PremiereScriptShare - Google Drive

should be as dead simple as I can make it.

one folder with the project, one folder with extension (also tiny, and literally few lines of code)

(grabbed some random 1min fire video to keep download size tiny as well)

Votes

Translate

Translate

Report

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 11, 2017 May 11, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Brilliant! Thanks for the help!

This might be the last piece of the puzzle I need to do what I want.

Votes

Translate

Translate

Report

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
Community Beginner ,
Jan 18, 2018 Jan 18, 2018

Copy link to clipboard

Copied

Hi is this fixed in PPro Version 12 // CC 2018? Because when I am trying it, it's not working. In/Out points are not respected for sequences, and as I am not able to create subclips from type CLIP, only from FILE, my project just came to a full hold.

Is there any workaround? This small bug just killed our project...

Votes

Translate

Translate

Report

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 ,
Jan 18, 2018 Jan 18, 2018

Copy link to clipboard

Copied

Not fixed yet; it's scheduled to be addressed before our next major release.

I'm unaware of any work-around (other than pre-rendering the sequence to a file).

Votes

Translate

Translate

Report

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
Community Beginner ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

Interesting detail: When I set in/out points on the projectItem manually it is inserted correctly (with the manual in/out points), but if I set in/out via ExtendScript, the projectItem is not changed at all and so it's not inserted correctly. So instead of the insertClip function not respecting the in/out points, it seems that the in/out points of the sequence/projectItem are not set via the set-functions for in/out points.

A workaround would have been to create Subclips from the Sequence, as the PProPanel example seems to suggest as possible.

BUT there's a bug (or more of a wrong assumption) in the addSubClip() function.

It checks:

if ((projectItem.type == ProjectItemType.CLIP)   || (projectItem.type == ProjectItemType.FILE))

But a subClip can not be created from a projectItem of type CLIP in Premiere CC 2018 (neither in code nor in the UI). Premiere gives an "Bad argument" error for the createSubClip function when executed on a projectItem of type CLIP. Can somebody please update the code in the repository to spare other devs some precious hours of trying something that is not possible in Premiere?

Votes

Translate

Translate

Report

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 ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

>...the in/out points of the sequence/projectItem are not set via the set-functions for in/out points.

Please send me the actual code, on which you're basing that assertion. [b b b  at  adobe dot com]

Votes

Translate

Translate

Report

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
Explorer ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Adding my two cents to this, since this seems to be what Im after as well.

Trying to add clips to the timeline with custom InPoints and OutPoints.


Been trying for a couple of hours now...
Tried my way around qe.sourceWindow and qe.source.player etc. but changes to inPoint dont seem to travel along when inserting clips from project.
Tried tracking the clip that is inserted, and manipulating it after its added to the timeline, but it seems that setInPoint() is not a function to be used with videoTracks.clips

Any hints on manipulating the clip inPoints and outPoints would be appreciated. Before/After inserting into sequence.

Getting inPoints of clips in the timeline seem to be working fine though...

         var editIn = foundVideo.start.seconds;

         var clipIn =  foundVideo.inPoint.seconds;

          vTrack1.insertClip(projectItem, editIn);

          //(search for clip = insertedVideo)

          insertedVideo.setInPoint(clipIn);

Votes

Translate

Translate

Report

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 11, 2017 May 11, 2017

Copy link to clipboard

Copied

> Improve documentation

We hear you, and are looking into it.

There are hundreds of panels in use today, developed with zero documentation, but it could certainly  be easier.

Votes

Translate

Translate

Report

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
Enthusiast ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

arturp97454551  wrote

Here's the link to the extension, it's a free odd on:

https://creative.adobe.com/addons/products/1170#.WRQJd-V96bg

the beauty of it is that you can start typing things like "app.project".. and get a list of all available objects/properties, then maybe add one of them and go deeper  and if you tick the "Method list" checkbox, you will also get any available functions

How did you install it? I'm not able to do so.

  1. Turned on File Syncing in the Creative Cloud app - nope.
  2. Downloaded the Extension Manager CC and attempted to install it that way - nope.

No luck either way...

Votes

Translate

Translate

Report

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 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Never, ever use Extension Manager CC to install extensions, for any Adobe app released on or after May 2015. That includes the CC 2015 release.


I was able to successfully download and install the .zxp using ExManCmd.

Adobe Exchange

Votes

Translate

Translate

Report

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
Enthusiast ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Bruce Bullis wrote

Never, ever use Extension Manager CC to install extensions, for any Adobe app released on or after May 2015. That includes the CC 2015 release.


I was able to successfully download and install the .zxp using ExManCmd.

Adobe Exchange

Ahh, I had not seen the line about supported versions for the Extension Manager. Didn't work either way, and I've deleted it from my machine.

Thanks for the heads up about the ExManCmd utility. Why is that not in the documentation? Why does the recommended way not work? In my case, I see absolutely nothing: no error, nor even a location that I expect to see the file when I try to browse for it on the web interface for my account...

Votes

Translate

Translate

Report

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