01-12-2011, 09:13 AM
|
|
Free Member
|
|
Join Date: Dec 2010
Posts: 390
Thanked 73 Times in 56 Posts
|
|
Simulates SLP VHS recording. Besides being a special effect, can be used to test various plugins that clean up recordings, in a scientific way.
Code:
#VCR line jitter simulator by jmac698
#requires both gscript and grunt
colorbars(pixel_type="YUY2").trim(0,10)
pointresize(width,height*4)#get line resolution by working around min height 4 limitations
h=height
splitlines(4)#split to lines of height 2 - note the jitter function requires height>=4
jitter
#return last
MergeLines(h)#merge until height=h, note why do I need blankclip(height=480)?
blur(1).blur(1).blur(1)
pointresize(width,height/4)
temp=last
u=temp.utoy
v=temp.vtoy
u=u.bilinearresize(30,height).bilinearresize(320,height)#it's actually better than this, placement of transitions is finer
v=v.bilinearresize(30,height).bilinearresize(320,height)
ytouv(u,v,temp)
function SplitLines(clip c, int n) {
Assert(c.height%n == 0, "Clip height not a multiple of 'n'")
Assert(!(c.IsYV12() && n%2==1), "'n' must be even for YV12 clips")
nStrips = c.height/n
c = c.ChangeFPS(nStrips*Framerate(c)).AssumeFPS(c) # Repeat each frame 'nStrips' times
BlankClip(c, height=n) # template for ScriptClip result
GScriptClip("c.Crop(0, (current_frame%nStrips)*n, 0, n)", args="c, nStrips, n")
}
function MergeLines(clip c, int h) {
n=h/c.height #n is number of frames to merge, e.g. 480 split to 2line has n=240
c.SelectEvery(n)
GScript("""
for (i=1, n-1) {
stackvertical(c.SelectEvery(n, i))
}
""")
}
function shift(clip v, int sx, int sy) {
v#shift a video sx, sy pixels, sx<0 is left, sy<0 is down
pointresize(width*2,height*2)#to allow 1 pixel shifts in YV12
sx=sx*2
sy=sy*2
l=(sx<0)?-sx:0
r=(sx<0)?0:sx
t=(sy<0)?0:sy
b=(sy<0)?-sy:0
crop(l,t,-r,-b)
addborders(r,b,l,t)
bilinearresize(v.width,v.height)
}
function jitter(clip v) {#note: a good tape could typically be +-3 without a TBC, distribution is not realistic
ScriptClip(v,"""
shift(rand(6)+4,0)
""")
}
|
Someday, 12:01 PM
|
|
Ads / Sponsors
|
|
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
02-12-2018, 06:17 AM
|
|
Site Staff | Video
|
|
Join Date: Dec 2002
Posts: 14,375
Thanked 2,604 Times in 2,216 Posts
|
|
I still haven't tried this.
I've always tried to make VHS look better, so making video look worse just feels wrong.
|
Thread Tools |
Search this Thread |
|
|
All times are GMT -5. The time now is 06:18 PM
|