12 Replies Latest reply on Jan 21, 2011 11:09 AM by lloydalvarez

    batch processing green screen videos




      I'm working on a project where I will need to automate the processing of 1 min videos shot in front of the same greenscreen in a video booth.


      Is it posable to automate actions in AE like you can in photoshop?


      What I'd like to automate is


      1. open a file

      2. apply a greenscreen effect

      3. insert a image or as a layer below it for a background

      4. then set it to encode as an mp4


      If AE can't do this do you know of any other program that can. I've tried to play around with doing it in Photoshop CS3 extended, but I'm not having a lot of luck



        • 1. Re: batch processing green screen videos
          ninteknohardcore Level 1

          When I had to apply to same key to a number of clips I just copy pasted  the effects and bg layers... I had to do about 50 and it was quick  work...would be nice to have Photoshop type actions though most deF.


          There is a batch processing script available on aescripts.com but I'm not sure if it can add a bg layer

          • 2. Re: batch processing green screen videos
            Mylenium Most Valuable Participant

            You would have to write a script and then the limiting factor still is that scripts can modify existing render queue items, but not create new ones.



            • 3. Re: batch processing green screen videos
              Dave LaRonde Level 6

              I don't know if it will be as cut and dried as you hope.  The reason: I doubt that the footage will be consistently exposed from shooting session to shooting session.  It may not even be consistently exposed from subject to subject during the same session.


              The type of camera being used will also make a crucial difference in the color resolution of the image.  You don't say anything about the camera, codec or process that will be used to acquire this footage.  Since you mentioned Photoshop CS3, I presume you'd be using AE 8... you won't be able to use long-gop acquisition codecs, for example.

              • 4. Re: batch processing green screen videos
                Todd_Kopriva Level 8

                One approach would be to create a composition that has a foreground layer and the background layer in it, apply the effects as needed to the foreground layer, and then duplicate the composition (in the Project panel) a gazillion times. Then go into each composition and replace the source for the foreground layer with each of the foreground clips that you have. Then just drag the whole bunch of compositions to the render queue. You can set your default output module template up so that when you add things to the render queue, they have the output settings that you want.


                If you had to do a lot of these as a regular part of your job, you might want to set up a script for large parts of this, but it may not be worth the hassle if you just have several to do in one go now.


                Of course, all of this depends on the fact that your color keying effect settings don't need to be changed from one instance to the next. I have never known that to be true for any color keying job.

                • 5. Re: batch processing green screen videos
                  Ian9114 Level 1

                  I wrote a script this year to do almost exactly what you are asking for.  I had batches of 100 or so greenscreen videos that needed the same settings applied to all of them.  (no, this wasn't the best key ever, but it worked)  To use it you would have to be comfortable editing the script to suit your project.


                  In my project I had a comp to use as a template that included a background solid, greenscreen video with keylight and a mask applied, a lower 3rd graphic, and a text layer whose source was pulled from the name of the composition.


                  Again, I did not have the time to make it very automatic, so it would require you to be comfortable with scripting to go in and change some values.  You will also need to know how to create a preset for whatever effects (color keyer, etc.) you are using on your video layer.


                  I have it on my home machine, so if you are interested I can post it up here later tonight.



                  • 6. Re: batch processing green screen videos
                    Todd_Kopriva Level 8

                    Ian, I'm sure that someone reading this thread would get value from your example. Thanks for offering to post it.

                    • 7. Re: batch processing green screen videos
                      Ian9114 Level 1

                      Here is the script I made for my project.  It's pretty rough and all the input is typed into variables, but it's a start.  One of these days I'll get around to filling this out.


                      You can download it here:






                      // ij_batchSetupComps script by Ian Johnson
                      // version 0.3
                      // v0.3 - Template for eventual full batch comp setup script.
                      //This work is licensed under the Creative Commons Attribution 3.0 Unported License.
                      //To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
                      //or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.


                      // USER VARIABLES
                      var rendSettingsTemplate = "Best Settings";  // Exact name of render settings
                      var outputModuleTemplate = "PhotoJPEG 100 w Audio";  // Exact name of output module
                      var outputPath = "D:\\FILE PATH TO OUTPUT FOLDER";  //
                      var colorKeyPresetPath = "COLOR KEY FILE PATH.ffx"


                      // function to find a Comp or other footage item by name
                      function findItem(itemName) {
                          for (var i=1; i <= app.project.numItems; i++) {
                              if (app.project.item(i).name.toUpperCase() == itemName.toUpperCase()) {
                                  return app.project.item(i);


                      // create undo group


                      var selectedItems = app.project.selection;  // selected footage items to use
                      var refComp = findItem("_referenceComp");  // our template comp to base the new comps on
                      var dumpFolder = findItem("02_final comps");  // folder to group new comps under


                      // These variables hold the layers from the template that we want to reuse.
                      var origText = refComp.layer(1);
                      var origLowerThird = refComp.layer(2);
                      var garbageMatte = refComp.layer(3).mask.mask(1).value;  // mask to be applied to greenscreen video layer


                      // Loop through all the selected items and perform required tasks
                      for (var i=0; i < selectedItems.length; i++) {
                          // name of the current video
                          var nameString = selectedItems[i].name;
                          // by default the new comp's name is the same as the video layer.  If you need to alter the name, do it here and set the value of compName
                          var compName = nameString;
                          // make a new comp w/ white background
                          // height, width, aspect ratio, and frame rate match the footage file
                          var newComp = app.project.items.addComp(compName, selectedItems[i].width, selectedItems[i].height, selectedItems[i].pixelAspect, selectedItems[i].duration, selectedItems[i].frameRate);
                          newComp.parentFolder = dumpFolder;
                          newComp.bgColor = [1,1,1];
                          // add footage with effects and mask
                          var footageLayer = newComp.layers.add(selectedItems[i]);
                          var presetFile = new File(colorKeyPresetPath);
                          if (footageLayer.mask.canAddProperty("mask")) {
                          // add lower third and text to new comp
                          // add to render queue
                          var newRQItem = app.project.renderQueue.items.add(newComp);
                          // get render settings templates
                          var myRSTemplates = app.project.renderQueue.item(1).templates;
                          var foundRSTemplate = false;
                          // loop through render settings templates and find the one that matches the one we want
                          for (var j=0; j < myRSTemplates.length; j++) {
                              if (myRSTemplates[j] == rendSettingsTemplate) {
                                  foundRSTemplate = true;
                          // apply render settings
                          if (foundRSTemplate) {
                          } else {
                              alert("Could not find Render Setting: " + rendSettingsTemplate);


                          // get output modules
                          var myOMTemplates = app.project.renderQueue.item(1).outputModules[1].templates;
                          var foundOMTemplate = false;


                          // loop through output module templates and find the one that matches the one we want
                          for (var j=1; j <= myOMTemplates.length; j++) {
                              if (myOMTemplates[j] == outputModuleTemplate) {
                                  foundOMTemplate = true;


                          // apply output module template
                          if (foundOMTemplate) {
                          } else {
                              alert("Could not find Output Module: " + outputModuleTemplate);


                          // set output name and path
                          var outputFile = new File(outputPath + newComp.name);
                          newRQItem.outputModules[1].file = outputFile;
                      } // close for loop


                      // un-comment the next line to automatically render everything when the script is complete


                      // end undo

                      • 8. Re: batch processing green screen videos
                        runmedia007 Level 1

                        Thanks a lot for the information, I'll have a play with that script ans sees how it goes



                        • 9. Re: batch processing green screen videos
                          Ian9114 Level 1

                          No problem.  Let me know if you have any questions and I'll try to help you do what you need.

                          • 10. Re: batch processing green screen videos

                            Ian, you are a star my friend!

                            I came across this thread looking for a batch script similar to what the OP was looking for, and using Ian's script I managed to get this to work exactly how I needed it to work!

                            I needed to open about 120 AVCHD rushes from a panasonic GH2, apply a bunch of denoise filters and output them as a lossless intermediate for editing. I modified the script slightly to fit my presets, settings and output modules and it works amazingly! PM me if you want this script

                            • 11. Re: batch processing green screen videos
                              Ian9114 Level 1

                              Wow!  I'm really glad this helped you.

                              It's amazing the amount of tedium you can eliminate by taking a little time to script.

                              • 12. Re: batch processing green screen videos
                                lloydalvarez Level 1

                                For a more professional batch processing script, check out BatchProcessor:  http://aescripts.com/batchprocessor/


                                It makes it very easy to batch process footage while adding an animation preset to each item