22 Replies Latest reply on May 11, 2017 1:00 PM by arturp97454551

    Editing clips with ExtendScript

    arturp97454551 Level 1

      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!

        • 1. Re: Editing clips with ExtendScript
          e.d. Level 3

          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

          • 2. Re: Editing clips with ExtendScript
            arturp97454551 Level 1

            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

            • 3. Re: Editing clips with ExtendScript
              e.d. Level 3

              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.

              • 4. Re: Editing clips with ExtendScript
                sberic Level 2

                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!

                • 5. Re: Editing clips with ExtendScript
                  arturp97454551 Level 1

                  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

                  1 person found this helpful
                  • 6. Re: Editing clips with ExtendScript
                    sberic Level 2

                    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?

                    • 7. Re: Editing clips with ExtendScript
                      arturp97454551 Level 1

                      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()?

                      • 8. Re: Editing clips with ExtendScript
                        Bruce Bullis Adobe Employee

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

                        • 9. Re: Editing clips with ExtendScript
                          Bruce Bullis Adobe Employee

                          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?

                          • 10. Re: Editing clips with ExtendScript
                            arturp97454551 Level 1

                            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!

                             

                            • 11. Re: Editing clips with ExtendScript
                              Bruce Bullis Adobe Employee

                              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

                              • 12. Re: Editing clips with ExtendScript
                                sberic Level 2

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

                                • 13. Re: Editing clips with ExtendScript
                                  Bruce Bullis Adobe Employee

                                  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

                                  • 14. Re: Editing clips with ExtendScript
                                    sberic Level 2

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

                                    • 15. Re: Editing clips with ExtendScript
                                      Bruce Bullis Adobe Employee

                                      I'm not sure in which documentation that should be, other than in the documentation link I provided...?

                                       

                                      As for why the recommended approach ("Just let Add-Ons handle the sync, through the CC Desktop app")...I have no idea. They have an active forum here, as well...

                                      • 16. Re: Editing clips with ExtendScript
                                        arturp97454551 Level 1

                                        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.

                                        • 17. Re: Editing clips with ExtendScript
                                          Bruce Bullis Adobe Employee

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

                                          • 18. Re: Editing clips with ExtendScript
                                            arturp97454551 Level 1

                                            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)

                                            1 person found this helpful
                                            • 19. Re: Editing clips with ExtendScript
                                              sberic Level 2

                                              Bruce Bullis wrote

                                               

                                              I'm not sure in which documentation that should be, other than in the documentation link I provided...?

                                              I think this documentation in particular could benefit from having that information added to it. That's the documentation that's linked when you visit the extension page, click on "Where to find it", expand "Troubleshooting checklist", and click "Troubleshooting guide"...

                                              • 20. Re: Editing clips with ExtendScript
                                                Bruce Bullis Adobe Employee

                                                Agreed, that makes sense.

                                                • 21. Re: Editing clips with ExtendScript
                                                  Bruce Bullis Adobe Employee

                                                  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.

                                                  • 22. Re: Editing clips with ExtendScript
                                                    arturp97454551 Level 1

                                                    Brilliant! Thanks for the help!

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