#1  
01-12-2011, 09:13 AM
jmac698 jmac698 is offline
Free Member
 
Join Date: Dec 2010
Posts: 387
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)
  """)
}


Attached Images
File Type: jpg vcr simulator.jpg (14.7 KB, 22 downloads)
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
02-12-2018, 06:17 AM
lordsmurf's Avatar
lordsmurf lordsmurf is online now
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,510
Thanked 2,449 Times in 2,081 Posts
I still haven't tried this.
I've always tried to make VHS look better, so making video look worse just feels wrong.

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this a fake AVT8710 timebase corrector? TylerDurden389 Restore, Filter, Improve Quality 10 06-22-2020 03:02 PM
Avisynth script to fix offset interlacing? lordsmurf Restore, Filter, Improve Quality 4 02-10-2018 05:34 PM
How NOT to do SEO: fake URL takedown requests admin Web Development, Design 2 10-12-2017 07:49 AM
Did I buy a fake camcorder? intbal Videography: Cameras, TVs and Players 8 03-31-2016 04:18 PM
Avisynth script for QTGMC, encode x264 - no video after deinterlace? mo418 Capture, Record, Transfer 18 09-16-2015 01:06 PM

Thread Tools



 
All times are GMT -5. The time now is 10:01 AM