10 Replies Latest reply on Feb 18, 2011 8:39 PM by Todd_Kopriva

    Cropping to Visible Alpha of Multiple Frames

    Kwangle Level 1

      Hi All,

       

      I have set up some footage that has had its background removed via chroma key and I have added a drop shadow on the resultant 'cut out' footage. Now I want to crop the frame so that the minimum area that is needed to contain the footage and the drop shadow can be output with an alpha channel - ie any areas that are fully transparent on ALL the frames is cropped away.

       

      There is a method in Photoshop where Cmd/Ctrl clicking on a layer selects the transparency of that layer which can then be cropped, removing all the invisible area that surrounds the image and contains no image data. Is there a way to do this in AE for multiple frames, without going through the nigh-impossible task of trying to estimate the area needed for a moving image that has a soft and transparent shadow without cropping the edges of the image off?

       

      Once I have got the area I need, how would I go about applying the crop?

       

      I'm new to AE, so I may be asking the impossible, but any advice would be greatly appreciated!

        • 1. Re: Cropping to Visible Alpha of Multiple Frames
          Mylenium Most Valuable Participant

          There is a method in Photoshop where Cmd/Ctrl clicking on a layer selects the transparency of that layer which can then be cropped

           

          *yikes* I hope you are aware of the Image --> Trim feature in PS... And that is the answer to your problem as well - contain it in an action, run a batch. Doesn't solve your animation probelm, though. In a sequence, there will always be "wasted" areas due to the differences in teh frames. Therefore the proper thing to do would be to run through the sequence and set AE's limited region to cover the maximums, then use Composition --> Crop to Region of Interest and conventionally export from AE with Alpha.

           

          Mylenium

          1 person found this helpful
          • 2. Re: Cropping to Visible Alpha of Multiple Frames
            Kwangle Level 1

            Thanks for that.

             

            So are you talking about exporting the frames from AE as an image sequence and them importing them into PS to run a batch on them? I can see that working but it is a bit long- winded. I could import the images into PS and them flatten the image to get a composite image that could be cropped down to just the frame area that contains image data, but I doubt PS would allow import of 5000 frames to corresponding layers.

             

            Yes I realise that every frame will have different amounts of empty space but I want to crop to a rectangular space that contains all the image area of every frame, but none of the empty space that doesn't appear on any frame. The resulting frames will be the same size, and some will have space surrounding the image but it is better than having frames with a load of empty space that does nothing on any of the frames, if you see what I mean.

             

            If the method you suggest is intended to work within AE, can you be more specific please?

            • 3. Re: Cropping to Visible Alpha of Multiple Frames
              Mylenium Most Valuable Participant

              but I doubt PS would allow import of 5000 frames to corresponding layers.

               

              Why not? People have doen crazier things and the Frames to Layers script should not care. It may just take a while. If all else fails, you can always try in multiple chunks in multiple documents and manually merge them later....

              If the method you suggest is intended to work within AE, can you be more specific please?


              Region of Interest

               

              If this is for one of those notorious transparent website overlays, you would still have a specific size requirement due to how it is embedded and keeping it "tight" is probably wasted effort, even more so as it only has minor impact on compression, anyways.

               

              Mylenium

              • 4. Re: Cropping to Visible Alpha of Multiple Frames
                Kwangle Level 1

                Well importing 5000 frames at 896 x 576 pixels each would take a long time and I'm not sure PS would have enough RAM to do that. In terms of practicality this seems non-viable. Breaking it down to batches, of say, 100 frames would still be a lot of trouble.

                • 5. Re: Cropping to Visible Alpha of Multiple Frames
                  Mylenium Most Valuable Participant

                  I think you are overthinking and overcomplicating matters. PS uses swap files and as long as you have enough harddrive space, you can throw documents at it until the machine explodes. No problem here. I just tested this on my machine and the only obstacle I encountered is the script imposing the old 500 frames limit, so well, it may take 10 runs to get this done, but it should not take more than 10 minutes...

                   

                  Mylenium

                  • 6. Re: Cropping to Visible Alpha of Multiple Frames
                    Kwangle Level 1

                    Thanks. Interesting, but that is sort of the opposite of what I actually wanted. The Region of Interest feature still has to be manually set by the user but I still dont know the right position for the ROI becuase I would have to take into account the content of many hundreds of frames. What I want is a way of accurately defining a ROI based on the content of all my frames so no content is cropped.

                     

                    Anyone got any more ideas?

                    • 7. Re: Cropping to Visible Alpha of Multiple Frames
                      Mylenium Most Valuable Participant

                      I really don't follow you. What's so complicated about it? Define the ROI, scrub a few frames, see if it still fits, extend/contract it as needed, move on. If you inspect ten or twenty frames of a 5000 frame sequence, each spaced 100 frames apart, there is a reasonable chance you will have covered all max boundaries. I still think you are trying to be über-scientific here.

                       

                      Mylenium

                      • 8. Re: Cropping to Visible Alpha of Multiple Frames
                        Kwangle Level 1

                        I wouldn't be asking if it were that simple.

                         

                        It is a shot of someone being interviewed but they are moving around quite a lot and fairly randomly. Also there is a very pale soft drop shadow I have added so it is very hard to tell the exact point where that becomes 0% opaque so it is very difficult to find the region I need to crop without chopping the edge off something. I want to import the video into Flash with an alpha channel, so am trying to restrict the size of the frame as much as possible as the file size has to be as small as possible.

                         

                        I'm guessing there is no way to do what I want easily within AE - that's fine, but I'm not relishing having to manually define a region by eye with guides for 5000 frames which seems to be what you are suggesting. I'm new to AE so just seeing if there is a mechanism that does what I want - seemingly there isn't.

                        • 9. Re: Cropping to Visible Alpha of Multiple Frames
                          Dave LaRonde Level 6

                          I'm having difficulty visualizing why you feel this is necessary.  If you pulled a key and added a drop shadow to it, it isn't really necessary to crop the footage for further use in AE or in an editing application.  In fact, it could be detrimental, as some NLE's try to fit footage to the resolution being used in the edit timeline, which distorts the keyed footage.

                           

                          You can render your comp as a Quicktime movie in the Animation codec, which supports alpha channels and is lossless.  Because of the run-length encoding Animation uses, files with large areas of transparency can be downright compact.

                           

                          An alternative: Quicktime's PNG codec.  If you happen to have Final Cut Pro 7 installed on your AE machine, you can also render in ProRes 4444.

                          • 10. Re: Cropping to Visible Alpha of Multiple Frames
                            Todd_Kopriva Level 8

                            I agree with Dave and his confusion over why you think that you need to do this.