Log in

View Full Version : Offset_video.avsi v1.0 - 10/Feb/2020


ClubM
10th February 2020, 12:35
Fellow members.

Just out of appreciation for all of the awesome functions you guys have wrote and shared and to all the people who contribute with fun stuff.
I wanted to share something back.
Here is a avsi plugin script i wrote myself i call it offset_video.
Hope it can be useful for someone.

This function allows you to offset the video horizontal or vertical and the pixels that get cut off are placed on the opposite side.
It accepts negative and positive feedback.

limitation: the offset has to be mod2.

function offset_video(clip clp, int x, int y)
{
x = Default(x, 0)
y = Default(y, 0)

clip_width = Width(clp)
clip_height = Height(clp)

x = (clip_width >= abs(x)) ? x : 0
y = (clip_height>= abs(y)) ? y : 0

x_lft_pixel_count = x > 0 ? x : clip_width-abs(x)
x_rgt_pixel_count = x > 0 ? clip_width-x : abs(x)

y_top_pixel_count = y > 0 ? clip_height-y : abs(y)
y_bot_pixel_count = y > 0 ? y : clip_height-abs(y)

clp = x !=0 ? Eval("""
clipA = clp.Crop(x_lft_pixel_count, 0, 0, 0, align=False)
clipB = clp.Crop(0, 0, -x_rgt_pixel_count, 0, align=False)
return StackHorizontal(clipA, clipB)
""") : clp

clp = y !=0 ? Eval("""
clipA = clp.Crop(0, y_top_pixel_count, 0, 0, align=False)
clipB = clp.Crop(0, 0, 0, -y_bot_pixel_count, align=False)
return StackVertical(clipA, clipB)
""") : clp

return clp
}