开发者

How can I use AviSynth to resize a region of a video

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 particu开发者_StackOverflowlar 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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜