# Avisynth script by J. Beale, Nov. 2005 www.bealecorner.com # Rename script to end with .AVS prior to use # Objective: reduce noise near dark level prior to MPEG2 encode # brightest pixels (here, above level 150) are completely unfiltered # source: downconverted HDV exported from Vegas 6c via DebugMode Frameserver Orig = AVISource("C:\video\noisy.avi") Y1 = ConvertToYUY2(Orig) Sclip = TemporalCleaner(Y1, 4, 6) Mask = Levels(Sclip,16,0.7,150,16,255,coring=false) # black where smoothing should happen #Greyscale(Mask) # useful for viewing Mask to judge threshold setting # Overlay (clip, clip overlay, int ''x'', int ''y'', clip ''mask'', float ''opacity'', string ''mode'', bool ''greymask'', string ''output'', bool ''ignore_conditional'', bool ''pc_range'') Overlay(Sclip, Y1, 0,0, Mask) # darker areas in Mask make Y1 more transparent & replaced by Sclip filtered pixels #=========================================================== # ConverttoYV12() # Histogram(mode="levels") # Hist() requires YV12 format # ColorYUV(levels="PC->TV") # just in case this is needed # === below are misc. notes for other noise reducing filters # Trim(1800,0) # deletes the first n frames # FluxSmooth([clip], int temporal_threshold, int spatial_threshold) # FluxSmooth(10,5) is good for clean DV clips (VX2k) # ConvertToYUY2(interlaced=true) # SpatialSoften(clip clip, int radius, int luma_threshold, int chroma_threshold) # TemporalSoften(clip clip, int radius, int luma_threshold, int chroma_threshold # [, int scenechange] [, int mode]) # Good initial values: TemporalSoften(4,4,8,15,2) # Sclip= FluxSmooth(Y1,10,3) # FluxSmooth(Y1,200,200) # hugely exaggerated values # TemporalCleaner (clip, int "ythresh", int "cthresh")