Log in

View Full Version : How to script this...


Soulhunter
12th January 2005, 22:41
How to script a "matrix-intro-style" filter ???

Source:
http://img24.exs.cx/img24/8374/source1rm.png

Result:
http://img24.exs.cx/img24/382/result22pc.png


Tia n' Bye

Manao
12th January 2005, 23:52
function rec_add_horizontal_bar(clip c, int bar_height)
{
h = height(c)

bar = c.blankclip(height = bar_height)
full_bar = bar.yv12lut(y=-255,u=-255,v=-255)
null_bar = bar.yv12lut(y=-0,u=-0,v=-0)
double_bar = stackvertical(full_bar, null_bar)

result = h >= 2 * bar_height ? double_bar : double_bar.crop(0,0,0,h-2*bar_height)

return h <= 2 * bar_height ? result : stackvertical(result, rec_add_horizontal_bar(c.crop(0,0,0,-2*bar_height), bar_height))
}

function matrix_style(clip c, int bar_height)
{
overshoot1 = c.yv12lut(yexpr = "x 255 / 0.3 ^ 255 *", u = -128, v = -128)
greenish_mask_y1 = c.yv12lut(yexpr = "x 4 / 64 +", y = 3, u = 1, v = 1).lanczosresize(width(c) / 2, height(c) / 2)
greenish1 = ytouv(greenish_mask_y1, greenish_mask_y1, overshoot1)

overshoot2 = c.yv12lut(yexpr = "x 255 / 0.5 ^ 255 *", u = -128, v = -128)
greenish_mask_y2 = c.yv12lut(yexpr = "x 2 /", y = 3, u = 1, v = 1).lanczosresize(width(c) / 2, height(c) / 2)
greenish2 = ytouv(greenish_mask_y2, greenish_mask_y2, overshoot2).blur(1.5).blur(1.5)

mask = c.rec_add_horizontal_bar(bar_height)

return maskedmerge(greenish1, greenish2, mask, y=3, u=3, v=3)
}
Call it with bar_height = 2. The green is a little faded, though

Paky
16th January 2005, 21:57
How can i use this script?

Soulhunter
16th January 2005, 22:07
@ Paky

- Copy n' paste the code above in a new text file

- Change the extension from ".txt" to ".avs"

- Import this new avs to ya own ones

- Call it via Matrix_Style()

Import("C:\stuff\MatrixStyle.avs")
AviSource("C:\stuff\Random.avi")
Matrix_Style(2)

@ Manao

Btw, whats with the new version ???

-> Tomorrow was yesterday... :D


Bye

Paky
16th January 2005, 22:52
@Soulhunter

Great, it works very well , thanks :D