5 Replies Latest reply on Apr 12, 2017 1:51 PM by Bruce Bullis

    Extract thumbnails / images from an external program

    tempelorg

      I need to get still images from certain positions in a certain sequence, and then post process them, using Python code.

       

      I've already written an external application that can do that, by parsing the prproj files, calculating the positions in the source videos and then extracting the images using ffmpeg. But that is not fool-proof, as I have to deal with complicated cases, such as time-shifting effects. Overlay and fading effects do not work with this method, either.

       

      I'd rather use the SDK's ability to create screen shots, as then I only have to specify the timeline position and get a perfectly rendered image back.

       

      I like to avoid having to rewrite my fairly complex program entirely in JS or C++.

       

      Instead, is there a way that an external program could invoke the SDK functions, maybe by writing a stub plugin that I can then talk to from my external app?

       

      For instance, would it be possible to have this plugin run once at start of Premiere, and then it would create a background thread or a socket, and put itself to sleep. Then my external app would wake it up and then pass the command and parms over the socket or other means, such as a file?

       

      Or can I use scripting to invoke a plugin?

       

      Any ideas?

       

      (I'm targeting Mac OS X currently, but would eventually also need a solution for Windows)

        • 1. Re: Extract thumbnails / images from an external program
          Bruce Bullis Adobe Employee

          Parsing our project file formats has never been supported, and never will be. It's almost guaranteed to break out from under you in future versions. PProPanel's exportCurrentFrameAsPNG() does what you want, without parsing the project file.

           

          A panel can force itself open upon launch (though not many users appreciate that behavior), and listen to a socket connection, for external messages.

           

          Why do you need to trigger this behavior, externally? Why not just have a panel with an Extract Images button?

          • 2. Re: Extract thumbnails / images from an external program
            Bruce Bullis Adobe Employee

            Also...Find Any File is an indispensable tool...thanks! 

            • 3. Re: Extract thumbnails / images from an external program
              tempelorg Level 1

              Yep, I find it quite useful, too

              • 4. Re: Extract thumbnails / images from an external program
                tempelorg Level 1

                Hi Bruce, thanks for trying to help me with this.

                 

                I understand that I get no support for parsing the prproj files, and I need no help there, anyway.

                 

                I also understand exportCurrentFrameAsPNG - that's what I was referring to when I talked about extracting still images.

                 

                As to why I cannot simply do it all from a plugin: My external app deals with multiple project files at once. That's why I had to start parsing the proj file, as I'm mainly extracting the sequence names from it, and some other informational data. And I'm not worried about that breaking any time soon. And even if it does - my app is made for one particular customer who doesn't mind my updating the app if that becomes a necessity. There's no way around this anyway, since AFAIK, Premiere's plugin structure does not let me parse multiple project files anyway, right?

                 

                If Premiere would support AppleScript better (I only realize now how little it does), I'd go that way.

                 

                So, that's why I have an external app. It handles opening the various projects in Premiere (fortunately, at least that works), and then I have to instruct the user to perform certain steps manually, even if it's only clicking on a button. I like to have these steps performed automatically in a plugin, at the request of my app, hence my question here.

                 

                Now, after browsing the various header files of the SDK, I found PrSDKDeferredProcessingSuite.h, and now I wonder if I could simply use that to automate my procedure:

                 

                I'd invoke QueueDeferredProcessing() with a delay of maybe 1 second at the time the plugin gets initialized. In the handler function, I'd check for a command file at a certain location, and if that's present, process it. After that check, I'd invoke QueueDeferredProcessing, getting another callback a while later, and so on.

                 

                Would that work? Would I be able to perform the call to exportCurrentFrameAsPNG form that deferred function call, or would that not work due to me being called in the wrong state to make such calls, as it's only meant to work with particular deferrable operations?

                • 5. Re: Extract thumbnails / images from an external program
                  Bruce Bullis Adobe Employee

                  >Premiere's plugin structure does not let me parse multiple project files anyway, right?

                   

                  There are no C++ plug-ins which can do so, but (JavaScript-based) panels can open and parse any project they like.

                   

                  > If Premiere would support AppleScript better (I only realize now how little it does), I'd go that way.

                   

                  Rather than OS-specific scripting, PPro provides an ExtendScript API; the best place from which to invoke that API is from within a panel.

                  You're right that you could run into state issues.