avisynth cut out square

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
avisynthrocks
Joined: Sun Mar 29, 2009 1:04 pm
Org Profile

avisynth cut out square

Post by avisynthrocks » Sun Mar 29, 2009 1:18 pm

Anyone know how I can cut out a square of video and put it in the lower left hand corner of another video.
For example:
Image
Here is a short clip of the movie: http://www.megaupload.com/?d=WYNK939Q (I would have put the youtube link, but it gets blocked).

You see how they took the guy's head from another video and put it in square at bottom of this video?

Is there any easy way to do this with AviSynth?
If not, does anyone know of an open source or freeware alternative?

Thanks in advance.

avisynthrocks
Joined: Sun Mar 29, 2009 1:04 pm
Org Profile

Re: avisynth cut out square

Post by avisynthrocks » Sun Mar 29, 2009 1:51 pm

Sorry for the double post. I don't know how to edit in this forum.

The video should be fine using fair use and I doubt Google would have complaints with that video being uploaded. Please don't report it :D

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: avisynth cut out square

Post by Zarxrax » Sun Mar 29, 2009 2:56 pm

You can crop it to a square, then resize it down to the size you want it to be. Then use AddBorders to pad the sides with black so it is the same size as the video you want to overlay on top of. Finally, use the Overlay command to overlay it.

avisynthrocks
Joined: Sun Mar 29, 2009 1:04 pm
Org Profile

Re: avisynth cut out square

Post by avisynthrocks » Sun Mar 29, 2009 6:46 pm

I understand what you mean by resizing it and adding borders, but how do I use Overlay to do this???

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: avisynth cut out square

Post by Zarxrax » Sun Mar 29, 2009 7:48 pm

Actually it's much simpler than I thought. The 2 clips dont need to be the same size at all. So you can simply do something like this:

vid1 = AVISource("video.avi")
vid2 = vid1.Crop(0,0,64,64)
vid1.Overlay(vid2,vid1.width-64,vid1.height-64)

The first line loads a video and stores it in variable "vid1".
2nd line takes video one, crops it down to only 64 pixels tall and wide, and stores that clip as "vid2"
The final line tells it to overlay vid2 on top of vid 1. I used "vid1.width-64" and "vid1.height-64" to place the overlay--exactly in the bottom right corner.

avisynthrocks
Joined: Sun Mar 29, 2009 1:04 pm
Org Profile

Re: avisynth cut out square

Post by avisynthrocks » Sun Mar 29, 2009 8:46 pm

It works!

Thanks for your help Zarxrax.

Locked

Return to “AviSynth Help”