VideoHelp Forum
+ Reply to Thread
Page 2 of 4
FirstFirst 1 2 3 4 LastLast
Results 31 to 60 of 113
Thread
  1. Originally Posted by jmac698 View Post
    I'll see if your decomet plugin works before trying to encode a lossless AVI. I tried to download it from here but it says the file is not available. Does that page contain the most recent update of that extension?
    Quote Quote  
  2. Originally Posted by VideoFanatic View Post
    I'll see if your decomet plugin works before trying to encode a lossless AVI.
    It requires that you capture the same video twice, under the assumption that the comets will be in different places in each capture. Do you have or can you make 2 caps? And you'll also have fun with the AviSynth_C.dll. Here's the function:

    #Requires Decomet and avisynth_c plugins
    #Usage: adjust avisynth_install_dir for your isntallation, for example C:\Program Files (x86)\AviSynth 2.5\
    #and install the plugins
    #About Decomet
    #Decomet by jmac698 attempts to find the clean pixels based on two, separately recorded copies of an analog tape with certain defects
    #I am calling these defects comets due to their appearance, but some call them dropouts. Dropouts are usually brief white lines appearing randomly in the video.
    #These white lines also occur in the headswitching area, in the last few lines of a video
    #Finally, another type of defect with black lines, may occur on light to dark transitions (edges). One way to see them, is to play S-VHS tapes in a
    #non-S-VHS playback deck.
    #How it works
    #The two videos are compared, and in light regions, the darker pixel from the two clips is kept
    #likewise, in darker regions, the lighter pixel is kept. The process fails when the comets are too close to normal video.
    #The plugin could be improved by being more sophisticated in it's detection of comets, however even at this simple stage, it
    #does improve real videos.
    avisynth_install_dir="C:\Program Files\AviSynth 2.5\"
    plugin1_fn="avisynth_c.dll"
    Cplugin1_fn="Decomet.dll"
    LoadPlugin(avisynth_install_dir+plugin1_fn)
    LoadCPlugin(avisynth_install_dir+Cplugin1_fn)

    clean=colorbars(width=360, height=240, pixel_type="YUY2")#Clean clip
    clip1=addcomets(clean)#noisy clip1
    clip2=addcomets(clean)#a different noisy clip2
    decomet(clip1,clip2)
    stackhorizontal(clip1.subtitle("Original 'A'"),clip2.subtitle("Original 'B'"),last.subtitle("Decomet cleaned version"))

    function whiteline(clip template) {
    template.blankclip(width=template.width/4, height=1,color_yuv=$EB8080)
    }

    function blackline(clip template) {
    template.blankclip(width=template.width/4, height=1,color_yuv=$108080)
    }

    function addcomets(clip v){
    #Add three, randomly positioned, white and black lines to an existing video
    v
    w=width
    h=height
    overlay(whiteline,x=rand(w*3/4),y=rand(h))
    overlay(blackline,x=rand(w*3/4),y=rand(h))
    overlay(whiteline,x=rand(w*3/4),y=rand(h))
    overlay(blackline,x=rand(w*3/4),y=rand(h))
    overlay(whiteline,x=rand(w*3/4),y=rand(h))
    overlay(blackline,x=rand(w*3/4),y=rand(h))
    }

    And here are the needed Decomet.dll and AviSynth_C.dll:
    Image Attached Files
    Quote Quote  
  3. I think VideoFanatic's source is a DVD. If he's capturing tape he can use a median of three function too:

    https://forum.videohelp.com/threads/340963-Best-quality-and-speed-video-denoisers-2011?...=1#post2122313

    That will reduce some other noise a bit too.

    DePulse(h=280, l=200, d=30) worked fairly well without damaging the picture too much. You can probably get it working better by playing with the arguments.
    Last edited by jagabo; 14th Aug 2013 at 17:48.
    Quote Quote  
  4. Yes, my plugin works for 2 passes of recording an original video tape. If you can record 3 passes, the median method works as well. 5 passes is even better, but then it starts looking a bit soft. Median quickly reduces impulse noise, which is the technical term for this, it also reduces guassian noise as well, which would be noise added by the playback system.

    For one copy only, I find depulse works fairly well. It's farily sophisticated in the pattern it searches for to find lines.
    Quote Quote  
  5. Member
    Join Date
    Feb 2010
    Location
    canada
    Search PM
    What are comets? Are they like spots?
    Quote Quote  
  6. Originally Posted by hizzy7 View Post
    What are comets? Are they like spots?
    Comets are short black or white horizontal lines.
    Click image for larger version

Name:	comets.jpg
Views:	994
Size:	36.2 KB
ID:	19377
    They appear in different places each time you play the tape. In second (or more) generation tapes they may be recorded on the tape and appear every time you play the tape.
    Quote Quote  
  7. Jagabo your RemoveSpotsMC works very well. Thanks. For videos with long line comets (stubborn to remove) I use this:

    Code:
    RemoveSpotsMC(last, 0)  RemoveSpotsMC(last, 0)  RemoveSpotsMC(last, 0) 
    
    Separatefields() RemoveSpotsMC(last, 0)  RemoveSpotsMC(last, 0)   Weave()
    It completely removes all the comets and I can't see any major problems caused by the script. Is there any way I can just do 1 pass and adjust the strength instead of doing several passes which is slower to encode?

    Also I just wanted to make sure if the following is safe to use on interlaced video?:
    RemoveSpotsMC(last, 0)
    Last edited by VideoFanatic; 18th Aug 2013 at 03:53.
    Quote Quote  
  8. I'm back with the hope someone can help me sort it out , i got an error for RemoveSpotMc
    I don't know what "_Use_Vdub_" means (line 61).

    I have downloaded the removespots.avsi and edited all necessary lines (plugins/ vdub filter) in the script but as you can see it's not working
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  9. Originally Posted by VideoFanatic View Post
    Is there any way I can just do 1 pass and adjust the strength instead of doing several passes which is slower to encode?
    You could try repeating the call to RemoveSpots within RemoveSpotsMC.
    Quote Quote  
  10. Originally Posted by jagabo View Post
    Originally Posted by VideoFanatic View Post
    Is there any way I can just do 1 pass and adjust the strength instead of doing several passes which is slower to encode?
    You could try repeating the call to RemoveSpots within RemoveSpotsMC.
    Are you talking to me or themaster? Either way, could you give an example please as I'm not sure what you mean.
    Quote Quote  
  11. I just realized that I have two versions of RemoveSpotsMC. The one I posted earlier and this one:

    Code:
    #
    #
    # File: RemoveSpots.avsi
    #
    # RemoveSpots and moution compensated RemoveSpots functions
    #
    # Functions:
    #
    #   function NullClip(clip clp)
    #
    #   function RemoveSpots(clip clp, int "limit", bool "_grey")
    #   function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
    #
    #   function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
    #
    #   function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
    #
    #   function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
    #
    #   function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
    #
    #
    
    
    
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\DEFLICKER_25_DLL_20040816\deflicker.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\DESPOT_3_6_1\despot.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V2_0A48\mt_masktools-25.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V1_5_8\masktools.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depan.dll")
    #LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depanestimate.dll")
    
    #(_use_VDub_ == true) ? LoadVirtualDubPlugin("C:\PROGRAM FILES\VIRTUALDUB 1.9.11\PLUGINS\spotremover.vdf", "SpotRemover", 11) : NOP()
    
    
    
    function NullClip(clip clp)
    {
      return BlankClip(clp, length=0)
    }
    
    
    
    # =============================================================================
    # 
    #
    function RemoveSpots(clip clp, int "limit", bool "_grey")
    {
      _grey   = Default(_grey, false)
      limit   = Default(limit, 16)
      
      clmode  = 17
    
      clensed = Clense(clp, grey=_grey, cache=4)
      sbegin  = ForwardClense(clp, grey=_grey, cache=-1)
      send    = BackwardClense(clp, grey=_grey, cache=-1)
      alt     = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=limit, modeU = _grey ? -1 : limit)
      restore = Repair(clensed, clp, mode=limit, modeU = _grey ? -1 : limit)
      clp     = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
                                    dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
      
      return clp
    }
    
    
    function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
    {
      _grey   = Default(_grey, false)
      limit   = Default(limit, 16)
      Vectors = Default(Vectors, 1)
    
      Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
    
      super   = MSuper(clp, pel=2, sharp=2)
      bvec3   = (Vectors == 3) ? MAnalyse(super, isb=true,  delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      bvec2   = (Vectors >= 2) ? MAnalyse(super, isb=true,  delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      bvec1   = MAnalyse(super, isb=true,  delta=1, blksize=8, overlap=4, truemotion=true)
      fvec1   = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
      fvec2   = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      fvec3   = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      backw3  = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
      backw2  = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
      backw1  = MFlow(clp, super, bvec1)
      forw1   = MFlow(clp, super, fvec1)
      forw2   = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
      forw3   = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
    
      clp     = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
                (Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
                                 interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
    
      clp     = RemoveSpots(clp, limit=limit, _grey=_grey)
    
      clp     = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
                (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
                                 SelectEvery(clp, 7, 3)
    
      return clp
    }
    
    
    
    # =============================================================================
    #
    # SpotRemover() function VirtualDub
    #
    function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
    {
      # Constant
      #
      TypeMax = 4
      
      # Variables
      #
      type    = Default(type, 1)
      show    = Default(show, false)
      Vectors = Default(Vectors, 2)
    
      type    = (type < 1) ? 1 : (type > TypeMax) ? TypeMax : type
      Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
      
      # create auxialiary smooth clip for easier motion detection
      #
      filter  = clp.DeFlicker(noise=6).Blur(1.58)
    
      # this is for internal use by MVtools functions. MVtools' version must be 2.0 or higher.
      #
      super   = MSuper(clp, pel=2, sharp=2)
      superfi = MSuper(filter, pel=2, sharp=2)
    
      # calculate the motion vectors
      #
      bvec3   = (Vectors == 3) ? MAnalyse(superfi, isb=true,  delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
      bvec2   = MAnalyse(superfi, isb=true,  delta=2, blksize=8, overlap=4, search=3, truemotion=true)
      bvec1   = MAnalyse(superfi, isb=true,  delta=1, blksize=8, overlap=4, search=3, truemotion=true)
      fvec1   = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
      fvec2   = MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
      fvec3   = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
    
      # create 6 additional clips: two predicted backward and two predicted forward
      #
      backw3  = (Vectors == 3) ? MCompensate(clp, super, bvec3) : NullClip(clp)
      backw2  = (Vectors >= 2) ? MCompensate(clp, super, bvec2) : NullClip(clp)
      backw1  = MCompensate(clp, super, bvec1)
      forw1   = MCompensate(clp, super, fvec1)
      forw2   = (Vectors >= 2) ? MCompensate(clp, super, fvec2) : NullClip(clp)
      forw3   = (Vectors == 3) ? MCompensate(clp, super, fvec3) : NullClip(clp)
    
    #  clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
    #                            MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
      clpdeg = clp
    
      # combine the 5 frames (2 + 1 + 2), the central one undergoes the degrain filter
      # combine the 3 frames (1 + 1 + 1), the central one undergoes the degrain filter
      # combine the 7 frames (3 + 1 + 3), the central one undergoes the degrain filter
      #
      clp     = (Vectors == 1) ? interleave(backw1, clpdeg, ff1) : \
                (Vectors == 2) ? interleave(backw2, backw1, clpdeg, forw1, forw2) : \
                                 interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
    
      # run SpotRemover over each block of 5 (3, 7) frames
      # removing spots only, no smoothing
      # !!! change to DSD:0 to turn the debug mode off
      # !!! change to DSD:1 to turn the debug mode on
      #
      # SSI - Smooth Strength Intensity
      # SSC - Smooth Strength Color
      # SKW - Smooth Kernel Width
      # SLI - Smooth Locking level for Intensity
      # SLC - Smooth Locking level for Color
      # SLD - Smooth Locking Debug
      # DLS - Detect Level for Spot detection
      # DLC - Detect Level for Clearance
      # DPC - Detect Perimeter Clearance
      # DSF - Detect Spot Fullness factor
      # DSD - Detect Spot Debug
      # MTX - Motion Table X (columns)
      # MTY - Motion Table Y (columns) 
      # MTL - Motion Table Level to flag cells
      # MDX - Motion Distance X
      # MDY - Motion Distance Y
      # MIH - Motion Interrupted History
      # CBR - Color BRightness
      # CCO - Color COntrast
      # CSA - Color SAturation
      # CBA - Color Balance
      # CSR - Color Shift Red
      # CSB - Color Shift Blue
      # FCI - Frame Control Interlaced
    
      clp = clp.ConvertToRGB32()
      clp = (type == 1) ? (show == false) ? \
      clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:0 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : \
      clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:1 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : clp
      clp = (type == 2) ? (show == false) ? \
      clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
      clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
      clp = (type == 3) ? (show == false) ? \
      clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
      clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
      clp = (type == 4) ? (show == false) ? \
      clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
      clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
    
    #  clp     = clp.ConvertBackToYUY2()
      clp     = clp.ConvertToYV12()
    
      # discard extra frames, keep only the central one
      #
      clp     = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
                (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
                                 SelectEvery(clp, 7, 3)
    
      # compensate for the SpotRemover lag. We will loose the last frame in the movie, but the audio will be in sync
      #
    #  clp     = clp.Trim(1, 0)   # Maybe not needed
    
      # enhance the contrast (optional)
      #
    #  clp     = clp.ColorYUV(gain_y=0, off_y=10, gamma_y=0, cont_y=80, cont_u=0, cont_v=0)
    
      return clp
    }
    
    global Width2  = 768
    global Height2 = 576
    
    # =============================================================================
    #
    # DeSpot() function
    #
    function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
    {    
      # Constants
      #
      _thSCD1 = 400
    
      Vectors = Default(Vectors, 3)
      Show    = Default(Show, 0)
    
      Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
      Show    = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
    
      filter  = DeFlicker(clp, border=150, percent=70, lmin=5, lmax=240)
    
      super   = MSuper(clp, pel=2, sharp=2)
      superfi = MSuper(filter, pel=2, sharp=2)
      bvec3   = (Vectors == 3) ? MAnalyse(superfi, isb=true,  delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      bvec2   = (Vectors >= 2) ? MAnalyse(superfi, isb=true,  delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      bvec1   = MAnalyse(superfi, isb=true,  delta=1, blksize=8, overlap=4, truemotion=true)
      fvec1   = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
      fvec2   = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      fvec3   = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      backw3  = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
      backw2  = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
      backw1  = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
      forw1   = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
      forw2   = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
      forw3   = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
    
    #  clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
    #                            MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
      clpdeg  = clp
    
      clp     = (Vectors == 1) ? Interleave(backw1, clpdeg, forw1) : \
                (Vectors == 2) ? Interleave(backw2, backw1, clpdeg, forw1, forw2) : \
                                 Interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
    
      clp     = clp.Deflicker(percent=99, lag=5, scene=15, info=false)
    
    
    
      # ==== ??????? ?????? ????? ====
      clp     = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
    
      # ==== ??????? ????? ????? ====
      clp     = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
                           pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
    
      # ==== ????????? ????? ? ???? ====
      clp     = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
     
      clp     = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
                           pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
                           blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
    
      # ==== ????????? ?????????? ????? ====
      clp     = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
                           blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
    
      # ==== ?????, ???????? ? ??????? ? ?????????, ???????? ??????? ???????? ====
      clp     = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
                           pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
    
      # ====================================
      clp     = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
                           motpn=true, fitluma=true, mark_v=255)
    
      clp     = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
                           motpn=true, mark_v=255)
    
      clp     = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
                           color=true, motpn=true, mark_v=255)
    
      clp     = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
                           color=true, motpn=true, mark_v=255)
     
      clp     = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
                           color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
     
      clp     = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
                           color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
                           blur=2, ranked=true, interlaced=false, mark_v=255)
     
      clp     = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
                           color=true, motpn=true, mark_v=255)
    
      clp     = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
                           show=Show, mark_v=255)
    
      clp     = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
    
      clp     = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
                           p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
                           motpn=true, fitluma=true, blur=1, mark_v=255)
    
      clp     = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
                           mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
    
      clp     = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
                           merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, \
                           blur=1, mark_v=255)
    
      clp     = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
                           merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
    
    
    
    
    
      # big black spots
    #  clp     = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, mark_v=255)
    
      # thin white lines
    #  clp     = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, mark_v=255)
      
      # thick hair lines (avoid real hair)
    #  clp     = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, mark_v=255)
    
      # lines contacting motion, avoid motion areas
    #  clp     = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, mark_v=255)
    
      # small dots and dust
    #  clp     = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, mark_v=255)
    
      # Long horizontal scratches
    #  clp     = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
    
      # Small compact spots
    #  clp     = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
    
    
    
    
    
      clp     = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
                (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
                                 SelectEvery(clp, 7, 3)
    
      return clp
    }
    
    # =============================================================================
    #
    # DeSpot() function
    #
    function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
    {    
      # Constants
      #
      _thSCD1 = 400
      _ml     = 100
    
      Vectors = Default(Vectors, 1)
      Show    = Default(Show, 0)
    
      Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
      Show    = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
    
      filter  = FFT3Dfilter(clp, sigma=6, plane=4, bw=32, bh=32, ow=8, oh=8, bt=3)
             
      super   = MSuper(clp, pel=2, sharp=2)
      superfi = MSuper(filter, pel=2, sharp=2)
      bvec3   = (Vectors == 3) ? MAnalyse(superfi, isb=true,  delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      bvec2   = (Vectors >= 2) ? MAnalyse(superfi, isb=true,  delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      bvec1   = MAnalyse(superfi, isb=true,  delta=1, blksize=8, overlap=4, truemotion=true)
      fvec1   = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
      fvec2   = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      fvec3   = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
      backw3  = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
      backw2  = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
      backw1  = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
      forw1   = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
      forw2   = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
      forw3   = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
    
      sadb    = MMask(clp, bvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
      sadf    = MMask(clp, fvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
      msadb   = MT_Binarize(sadb, 20, upper=true)
      msadf   = MT_Binarize(sadf, 20, upper=true)
      msad    = MT_Logic(msadf, msadb, "or")
      msad    = MT_Expand(msad)
      msadi   = Interleave(msad, msad, msad)
    
      clp     = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
                (Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
                                 Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
    
    
    
      # ==== ??????? ?????? ????? ====
      clp     = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
    
      # ==== ??????? ????? ????? ====
      clp     = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
                           pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0, extmask=msadi)
     
      # ==== ??????? ????? ???? ????? (???????? ???????? ?????)  ====
      clp     = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=24, interlaced=false, median=false, p1=15, p2=13, \
                           pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
     
      # ==== ?????, ???????? ? ??????? ? ?????????, ???????? ??????? ???????? ====
      clp     = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
                           pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
     
      # ==== ????????? ????? ? ???? ====
      clp     = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
                           blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
     
      clp     = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
                           pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
                           blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
     
      # ==== ??????? ?????????????? ?????? ====
      clp     = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=100, pheight=2, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
                           blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
     
      # ==== ????????? ?????????? ????? ====
      clp     = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
                           pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
                           blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
     
      # ====================================
      clp     = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
                           motpn=true, fitluma=true, extmask=msadi)
    
      clp     = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
                           motpn=true, extmask=msadi)
    
      clp     = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
                           color=true, motpn=true, extmask=msadi)
    
      clp     = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
                           color=true, motpn=true, extmask=msadi)
     
      clp     = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
                           color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, extmask=msadi)
     
      clp     = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
                           color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
                           blur=2, ranked=true, interlaced=false, extmask=msadi)
     
      clp     = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
                           color=true, motpn=true, extmask=msadi)
    
      clp     = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
                           show=Show, extmask=msadi)
    
      clp     = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, \
                           extmask=msadi)
    
      clp     = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
                           p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
                           motpn=true, fitluma=true, blur=1, extmask=msadi)
    
      clp     = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
                           mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, \
                           extmask=msadi)
    
      clp     = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
                           merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
                           mark_v=255, extmask=msadi)
    
      clp     = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
                           merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255, \
                           extmask=msadi)
    
    
    
    
    
      # big black spots
    #  clp     = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, extmask=msadi)
    
      # thin white lines
    #  clp     = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, extmask=msadi)
      
      # thick hair lines (avoid real hair)
    #  clp     = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, extmask=msadi)
    
      # lines contacting motion, avoid motion areas
    #  clp     = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, extmask=msadi)
    
      # small dots and dust
    #  clp     = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, extmask=msadi)
    
      # Long horizontal scratches
    #  clp     = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
    
      # Small compact spots
    #  clp     = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
    
    
    
    
    
      clp     = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
                (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
                                 SelectEvery(clp, 7, 3)
    
      return clp
    }
    I believe I commented out the references to VirtualDub's SpotRemover plugin from the original script because I didn't have that filter.
    Quote Quote  
  12. Thanks jogabo, now it's working

    Well i have compared with the script i use to get rid of these comets and mine is working better (it's a Didée's script that i have adapted), you can try it:
    separatefields()
    #DeGrainMedian(limitY=0,limitUV=220,mode=3,norow=t rue,interlaced=true)
    a=last
    #clense(reduceflicker=false).merge(last,0.5).clens e(reduceflicker=false)
    mot=removegrain(20,0).DepanEstimate(range=2)
    take2=a.depaninterleave(mot,prev=2,next=2,subpixel =2)
    clean1=take2.DeGrainMedian(limitY=255,limitUV=5,mo de=3,norow=true,interlaced=false).selectevery(5,2)

    sup1 = clean1.minblur(1).removegrain(11,0)
    \ .mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
    \ .msuper(pel=2,sharp=0)
    sup2 = a.msuper(pel=2,levels=1,sharp=2)
    ###### Good mvtools values, Do not change, checked##########
    bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
    bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
    fv21=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)
    fv22=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)

    interleave(a.mcompensate(sup2,fv22),a.mcompensate( sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensat e(sup2,bv22))
    TMedian2().mergeluma(RemoveSpotsMC(),0.1).selectev ery(5,2)

    sup3 = last.msuper(pel=2,sharp=2)
    bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
    bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
    bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
    fv31=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
    fv32=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
    fv33=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=3,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
    last.mdegrain1(sup3,bv31,fv31,thSAD=499) #,
    weave()
    ################################################## ###############
    function EdgeCleaner(clip c, float "strength", bool "rep", int "rmode", int "smode", bool "hot", bool "fix") {

    strength = default(strength, 8.0)
    rep = default(rep, true)
    rmode = default(rmode, 17)
    smode = default(smode, 0)
    hot = default(hot, false)
    fix = default(fix, true)

    c = (c.isYV12()) ? c : c.ConvertToYV12()
    strength = (smode==0) ? strength : strength+4

    main = c.aWarpSharp(strength,1)
    main = (rep) ? Repair(main,c,rmode) : main

    mask = c.mt_edge("prewitt",4,32,4,32).mt_invert().mt_conv olution()

    final = (!hot) ? mt_merge(c,main,mask) : Repair(mt_merge(c,main,mask),c,2)
    final = (fix) ? Overlay(final,c.ConvertToRGB24().Crop(0,1,-c.width+1,-c.height+2),x=0,y=1) : final
    final = (smode != 0) ? mt_merge(final,c,c.StarMask(smode)) : final

    return final

    }

    function StarMask(clip c, int "mode") {

    mode = default(mode, 1)

    clean = (mode==1) ? c.RemoveGrain(17) : Repair(c.Deen("a3d",4,12,0),c,15).RemoveGrain(21)
    diff = (mode==1) ? mt_makediff(c,clean) : NOP

    final = (mode==1) ? diff.Greyscale().Levels(40,0.350,168,0,255).remove grain(7,-1).mt_edge("prewitt",4,16,4,16) : \
    Subtract(mt_merge(clean,c,c.mt_edge("roberts",0,2, 0,2).mt_expand(mode=mt_circle(1)).mt_invert()),c). mt_edge("roberts",0,0,0,0).mt_deflate()

    return final

    }



    function MinBlur(clip clp, int r, int "uv")
    {
    uv = default(uv,3)
    uv2 = (uv==2) ? 1 : uv
    rg4 = (uv==3) ? 4 : -1
    rg11 = (uv==3) ? 11 : -1
    rg20 = (uv==3) ? 20 : -1
    medf = (uv==3) ? 1 : -200

    RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
    \ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=u v2)
    \ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20),U=uv2,V=uv2)
    \ : mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
    RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
    \ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U= uv2,V=uv2)
    \ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U= uv2,V=uv2)
    DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
    clp.mt_makediff(DD,U=uv,V=uv)
    return(last)
    }



    # median of 5 clips from Helpers.avs by G-force
    Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
    {
    chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
    #MEDIAN(i1,i3,i5)
    Interleave(input_1,input_3,input_5)
    chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
    m1 = selectevery(3,1)
    #MAX(MIN(i1,i3,i5),i2)
    m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_L ogic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
    #MIN(MAX(i1,i3,i5),i4)
    m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_L ogic(input_5,"max",chroma=chroma).MT_Logic(input_4 ,"min",chroma=chroma)
    Interleave(m1,m2,m3)
    chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
    selectevery(3,1)
    chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
    pointresize(last.width, last.height*2).ConverttoRGB32(matrix="rec601",inte rlaced=false).pointresize(last.width, last.height)
    LoadVirtualDubPlugin("C:\Program Files (x86)\VirtualDub\plugins\Camcorder_Color_Denoise_sse2.vdf", "CCD", 1)

    CCD(10,1) # de 0 ŕ 100 # Défaut =30 / Nickel pour smpte
    pointresize(last.width, last.height*2).converttoyv12(matrix="rec601",inter laced=false).pointresize(last.width, last.height)
    Return(last)
    }

    function TMedian2(clip c) {
    Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }


    function RemoveDirt(clip input, int limit, bool _grey)
    {
    clensed=input.Clense(grey=_grey, cache=4)
    alt=input.RemoveGrain(2)
    return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=li mit,noisy=4, grey=_grey)

    # Alternative settings
    # return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=li mit,noisy=12,grey=_grey,show=true)
    # return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_ grey,show=false)
    }
    RemoveSpotsMc only (2pass)
    http://www.hostingpics.net/viewer.php?id=339333Removespotsmc2pass.jpg
    My script:
    http://www.hostingpics.net/viewer.php?id=399354themaster1.jpg

    It requires:
    mvtools2.dll, DeGrainMedian.dll, RemoveGrain.dll, DePanEstimate.dll, DePan.dll, RemoveDirt.dll,RemoveSpotsMc.avsi and also Camcorder_Color_Denoise_sse2.vdf vdub filter)
    original script here:
    http://forum.doom9.org/showpost.php?p=1483709&postcount=10
    Last edited by themaster1; 19th Aug 2013 at 07:04.
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  13. I'd like to try your script. I have all the filters installed that you mentioned. In my RemoveSpotsMC.avsi file I have the following:

    Code:
    function RemoveSpotsMC(clip,int limit, bool "_grey")
    {
      _grey=default(_grey, false)
      limit = default(limit,6)
      i=MSuper(clip,pel=2)
      bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
      fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
      backw = MFlow(clip,i,bvec)
      forw  = MFlow(clip,i,fvec)
      clp=interleave(backw,clip,forw)
      clp=clp.RemoveSpots()
      clp=clp.SelectEvery(3,1)
      return clp
    }
    When I load your script in AvsPmod I get the following error message:

    Script error: there is no function named "MT_L".
    (New File, line 109)
    (New File, line 127)
    (New File, line 24)

    Line 24 is this: TMedian2().mergeluma(RemoveSpotsMC(),0.1).selectev ery(5,2)
    Line 109 is this: m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_L ogic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
    Line 127 is this: Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }

    Is Tmedian an extension? I can't find it anywhere on Google.
    Last edited by VideoFanatic; 19th Aug 2013 at 16:13.
    Quote Quote  
  14. Does anyone know why I'm seeing interlacing artifacts on my 720 x 470i video when using RemoveSpotsMC? I first encode to a lossless AVI in VirtualDub using this script:

    Code:
    setmtmode(5,9)
    Mpeg2Source("E:\2 = New\\Dec 6 test.d2v", CPU=6)
    setmtmode(2)
    
    RemoveSpotsMC(last, 0)
    Then I encode the AVI to h264 with this script:

    Code:
    setmtmode(5,9)
    AVISource("e:\2 = New\Dec 6 test just Daa3 scripts to lossless.avi")
    setmtmode(2)
    
    McTemporalDenoise(settings="medium", interlaced=true) 
    
    AssumeTFF() 
    QTGMC(Preset="Super Fast") 
    Vinverse() AddGrainC(var=1.0,uvar=1.0) 
    SeparateFields() SelectEvery(4,0,3) Weave()
    Quote Quote  
  15. Originally Posted by VideoFanatic View Post
    Does anyone know why I'm seeing interlacing artifacts on my 720 x 470i video when using RemoveSpotsMC?
    Probably because that filter isn't interlace aware.
    Quote Quote  
  16. Is there anything I can do to prevent artefacts? It seems to not handle camera flashes very well and the frame rate doesn't look as smooth as it originally did.

    I tried this but it doesn't prevent the problems:

    Code:
    Separatefields() RemoveSpotsMC(last, 0) RemoveSpotsMC(last, 0) Weave()
    Quote Quote  
  17. Yes, SeparateFields should work. Though, I'm not sure what will happen if a flash only lasts for one field -- it may remove the flash. And rather than calling RemoveSpotsMC multiple times try calling RemoveSpots multiple times within RemoveSpotsMC. For example, make your own variation of RemoveSpotsMC called RemoveSpotsMC2x that calls RemoveSpots twice.
    Quote Quote  
  18. Could you post a script for that please as I don't know how to do that.
    Quote Quote  
  19. If you're still using the old RemoveSpotsMC:

    Code:
    function RemoveSpotsMC2x(clip,int limit, bool "_grey")
    {
      _grey=default(_grey, false)
      limit = default(limit,6)
      i=MSuper(clip,pel=2)
      bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
      fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
      backw = MFlow(clip,i,bvec)
      forw  = MFlow(clip,i,fvec)
      clp=interleave(backw,clip,forw)
      clp=clp.RemoveSpots().RemoveSpots()
      clp=clp.SelectEvery(3,1)
      return clp
    }
    All that's changed is the name of the function and the second call to RemoveSpots.
    Quote Quote  
  20. Originally Posted by VideoFanatic View Post
    Themaster, I can't see anything in those screen shots as they are too small!
    Frame 175:

    Click image for larger version

Name:	themaster1.jpg
Views:	793
Size:	197.9 KB
ID:	19416
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  21. Themaster could you help with this at all?

    Jagabo I tried your massive script. It reminded me that that script was the one I tried long ago which I couldn't get working. All I did was comment out the SpotRemover load plugin line and it worked.

    Upon viewing my OP video in AvsPmod it completely removed all comets with just one mentioning of RemoveSpotsMC(last, 0). However once I viewed a different video (mentioned below) on my TV I could see that it removes a lot of detail as well so I don't think it's a suitable script to use unless you know of a way to get it working?

    Examples:
    Different source video from my OP with more movement so you can see problems if there are any
    Massive RemoveSpots.avsi script (used RemoveSpotsMC(last, 0) in avs file)
    Small RemoveSpotsMC2x.avsi script (used RemoveSpotsMC2x(last, 0) Separatefields() RemoveSpotsMC2x(last, 0) Weave() and two mentionings of RemoveSpots() in avsi file.


    With either script I had to encode the RemoveSpotsMC(last, 0) script in VirtualDub to a lossless AVI as it wouldn't work in other encoders. Then I converted to h264.

    Anyway, I'm happy with the small RemoveSpotsMC2x script and 3 mentionings of RemoveSpots() inside it. In my Avs file I do this:

    Code:
    RemoveSpotsMC2x(last, 0) 
    Separatefields() RemoveSpotsMC2x(last, 0) Weave()
    As you can see if you were to test on my OP video, I still needed 2 passes of RemoveSpotsMC2x. Doing it via the above method removed the most comets.

    RemoveSpotsMC2x(last, 0) has almost no effect unless used while the video is interlaced so using it after QTGMC was pointless.

    One weird issue I noticed was on frame 452. If I add another pass of RemoveSpots() in the Avsi file then instead of removing more of the comets it actually makes more comets!? Which is why I didn't have more than 3 passes in the avsi file. Why would that happen and is there any way to fix that so I can have more passes?

    Anyway I'm happy with the results I've got from the RemoveSpotsMC2x script. There's a minor issue with the framerate (any idea how to fix that?) which I don't know how to describe - maybe you can see it in the video?
    Quote Quote  
  22. Originally Posted by VideoFanatic View Post
    Themaster could you help with this at all?
    The script he uploaded has extra space characters (forum bugs) that you'll have to remove.
    Quote Quote  
  23. I removed the spaces but I still got the error message. Themaster1 would you mind copying your script to Pastebin.com so I can make sure I have the correct script without bugs?

    Jagabo in my script I do the below. Is there any way to put that in the avsi file to make the script run faster and with less artifacts caused by a 2 pass?

    Code:
    RemoveSpotsMC2x(last, 0)  Separatefields() RemoveSpotsMC2x(last, 0) Weave()
    Quote Quote  
  24. Why can't you fix the script yourself? AviSynth tells you exactly what the problem is. It even gives you the line and column number (hint: turn on the Status Bar in Notepad). I also had to comment out the LoadVirtualDubPlugin() line and the CCD() line because I don't have that VirtualDub plugin.
    Quote Quote  
  25. I'm not very good at proofreading. I thought I removed all the spaces but I missed some. I get this error message now:
    Script error: Invalid arguments to function "RemoveSpotsMC", New file line 24

    Line 24 is this:
    Code:
    TMedian2().mergeluma(RemoveSpotsMC(),0.1).selectevery(5,2)
    I'm not sure how to fix that?

    In my RemoveSpotsMC.avsi file I have this:

    Code:
    function RemoveSpotsMC(clip,int limit, bool "_grey")
    {
      _grey=default(_grey, false)
      limit = default(limit,6)
      i=MSuper(clip,pel=2)
      bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
      fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
      backw = MFlow(clip,i,bvec)
      forw  = MFlow(clip,i,fvec)
      clp=interleave(backw,clip,forw)
      clp=clp.RemoveSpots()
      clp=clp.SelectEvery(3,1)
      return clp
    }
    Quote Quote  
  26. Originally Posted by VideoFanatic View Post
    Line 24 is this:
    Code:
    TMedian2().mergeluma(RemoveSpotsMC(),0.1).selectevery(5,2)
    I'm not sure how to fix that?
    You still have to have stuff inside those empty parentheses. Does this work:

    TMedian2().mergeluma(RemoveSpotsMC(Last,0),0.1).selectevery(5,2)
    Quote Quote  
  27. Originally Posted by VideoFanatic View Post
    I removed the spaces but I still got the error message. Themaster1 would you mind copying your script to Pastebin.com so I can make sure I have the correct script without bugs?
    Download it from here:
    http://www.mediafire.com/?a1j9aqnw0to9rv6

    video:
    http://www.mediafire.com/?f1ca0ykegij1hpz

    for your video you should move the chroma up so add this:
    MPEG2Source("D:\Black Comets.d2v", cpu=0)
    separatefields
    A=Last
    B=A.Greyscale()
    Overlay(B,A,X=0,Y=-2,Mode="Chroma") # changer juste valeurs Y ou X
    [...script...]
    Last edited by themaster1; 20th Aug 2013 at 07:32.
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  28. How can I use the following script on part of a video instead of the whole video?:

    Code:
    RemoveSpotsMC2x(last, 0) 
    Separatefields()
    RemoveSpotsMC2x(last, 0)
    Weave()
    This doesn't work:
    Code:
    filtered=RemoveSpotsMC2x(last, 0). Separatefields(). RemoveSpotsMC2x(last, 0). Weave() ReplaceFramesSimple(last,filtered,Mappings="[27321 36948]")
    This doesn't work either:

    Code:
    trim(27321, 36948). RemoveSpotsMC2x(last, 0). Separatefields(). RemoveSpotsMC2x(last, 0). Weave()
    Quote Quote  
  29. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by VideoFanatic View Post
    How can I use the following script on part of a video instead of the whole video?:

    Code:
    RemoveSpotsMC2x(last, 0) 
    Separatefields()
    RemoveSpotsMC2x(last, 0)
    Weave()
    This doesn't work:
    Code:
    filtered=RemoveSpotsMC2x(last, 0). Separatefields(). RemoveSpotsMC2x(last, 0). Weave() ReplaceFramesSimple(last,filtered,Mappings="[27321 36948]")
    This doesn't work either:

    Code:
    trim(27321, 36948). RemoveSpotsMC2x(last, 0). Separatefields(). RemoveSpotsMC2x(last, 0). Weave()
    What does "doesn't work" mean? You're getting an error message? Nothing is happening?

    The first parameter in the RemoveSpotsMC function is "clip". Your code sets that parameter to "last". The next parameter in the function is "limit", which you have set to "0" (the default is "6"). I don't know what setting the limit to 0 would do.

    Code:
    AviSource (or whatever source)
    source=last
    a=source.Trim(0,27320) # <- the first part of the video
    b=source.Trim(27321, 36948). RemoveSpotsMC2x(). Separatefields(). RemoveSpotsMC2x(). Weave()
    c=source.Trim(36949,0) # <- the last part of the video
    filtered = a + b + c   # <- re-join the three parts
    return filtered
    Last edited by sanlyn; 21st Mar 2014 at 10:13.
    Quote Quote  
  30. Before discussing that issue further, I have a bit of an emergency regarding the Comet Removal script on the whole file (720 x 480i). I'm getting interlacing artefacts when viewing a Bluray on my PS3. Yet when I view the same video on the PS3 Media server or a Media Player (not the Bluray just the TS file) I don't see interlacing artefacts. Here's a 7 sec clip of the original MPEG2.

    Below is the script to remove comets (I know this short clip doesn't have many but it's just an example so you can see what the script does to the video). I make an uncompressed AVI with this script. Then I convert to h264 and use McTemporalDenoise and QTGMC and I reinterlace after QTGMC.

    Code:
    setmtmode(5,9)
    Mpeg2Source("E:\2 = New\7 secs.d2v", CPU=6)
    setmtmode(2)
    
    AssumeTFF() # Tried with and without this line but there was no difference
    
    RemoveSpotsMC2x(last, 0) Separatefields() RemoveSpotsMC2x(last, 0) Weave()
    
    Daa3()
    
    Overlay(last, last, y=-4, mode="chroma")
    
    Tweak(Hue=20, Sat=0.4, Bright=0, Cont=1.0,  Coring=False)
    
    Crop(16,0,-14,-18)
    AddBorders(16,10,14,8, $000000)
    Here's the RemoveSpots.avsi file.

    It's definately something in this script that's the problem because when I convert to AVI with no script at all then convert the AVI to H264 using the script below, I don't get interlacing artefacts.

    Code:
    McTemporalDenoise(settings="medium", interlaced=true) 
    AssumeTFF() QTGMC(Preset="Super Fast") 
    SeparateFields() SelectEvery(4,0,3) Weave()  
    
    Overlay(last, last, y=-4, mode="chroma")
    
    Tweak(Hue=20, Sat=0.4, Bright=0, Cont=1.0,  Coring=False)
    
    Crop(16,0,-14,-18)
    AddBorders(16,10,14,8, $000000)
    Last edited by VideoFanatic; 12th Sep 2013 at 16:18.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!