Question

I have a video file in which part of the video file has been set to the wrong aspect ratio (by "part" I mean a particular rectangular area of the video, NOT a particular timespan). Is it possible to use AviSynth to resize just this area of the video?

I'm familiar with the concept of avisynth and some very basic scripting, but am unsure if something like this is possible.

Thanks, Alex

Was it helpful?

Solution

First use a few "Crop" commands to break it into the pieces that are correctly sized and incorrectly sized.

Then use "BicubicResize" (Or really whatever resize method you want) to fix the aspect ratio of the piece you are interested in.

Finally, put the pieces you cropped apart using "StackHorizontal" and "StackVertical"

For example, if the original source is 100x100 pixels, and the top left 50x50 pixels is actually squished into 25x50 pixels, you could do:

A = AviSource("MyVideo.av")
TopLeft = A.Crop(0,0,24,49)  ## This is the region that should take up 50x50 pixels
TopRight = A.Crop(50,0,99,49)
Bottom = A.Crop(0,50,99,99)

TopLeft = TopLeft.BicubicResize(50,50) ## Resize to the correct size

Top = StackHorizontal(TopLeft, TopRight)
Final = StackVertical(Top, Bottom)

Final
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top