VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. Member TeNSoR's Avatar
    Join Date
    Mar 2014
    Location
    Hungary, Debrecen
    Search PM
    Hello!

    I need to remove these white spots in this DVD. I tried "RemoveSpotsMC2x" but didn't remove it, any idea?

    Code:
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\DGDecode.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\mt-masktools-25.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\mvtools2.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\nnedi3.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtS.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\RemoveGrainS.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\RepairSSE2.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\masktools2.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\RgTools.dll")
    
    
    
    
    Import("C:\Program Files (x86)\AviSynth\plugins\Srestore.avs")
    Import("C:\Program Files (x86)\AviSynth\plugins\RemoveSpotsMC.avs")
    
    
    Import("C:\Program Files (x86)\AviSynth\plugins\QTGMC-3.32.avs")
    
    SetMTMode(5, 3)
    SetMemoryMax(512)
    
    
    MPEG2Source("D:\VIDEO\VIDEO_TS\Test01.d2v", cpu=0)
    
    SetMTMode(2)
    
    AssumeTFF()
    QTGMC( Preset="Fast", Sharpness=0.3, EdiThreads=1) 
    Srestore(frate=25)
    AssumeFPS(23.976)
    Greyscale()
    a=last
    e=a.SelectEven().RemoveSpotsMC2x()
    o=a.SelectOdd().RemoveSpotsMC2x()
    Interleave(e,o)
    Crop(2, 0, -2, -8)
    Click image for larger version

Name:	vlcsnap-00015.png
Views:	613
Size:	505.1 KB
ID:	40009
    Image Attached Files
    Quote Quote  
  2. Maybe it's too big for RemoveSpotsMC. RemoveDirtMC gets rid of it:

    MPEG2Source("test.d2v")
    QTGMC()
    Srestore()
    RemoveDirtMC(last, 55, false)


    I forget what it needs besides the function itself. Probably the same as RemoveSpotsMC. The error message will tell you. Here's the function:
    Image Attached Files
    Quote Quote  
  3. Member TeNSoR's Avatar
    Join Date
    Mar 2014
    Location
    Hungary, Debrecen
    Search PM
    Originally Posted by manono View Post
    Maybe it's too big for RemoveSpotsMC. RemoveDirtMC gets rid of it:

    MPEG2Source("test.d2v")
    QTGMC()
    Srestore()
    RemoveDirtMC(last, 55, false)


    I forget what it needs besides the function itself. Probably the same as RemoveSpotsMC. The error message will tell you. Here's the function:
    Thanks so much, manono! I will try
    Quote Quote  
  4. Try keeping the limit argument of RemoveDirtMC() as low as possible. The higher it gets the more likely you are to see artifacts (smearing or blurring during motion, removal of spots that are supposed to be there, etc.). Of course, if you set it very low fewer spots will be removed. So you need to strike a balance between spot removal and artifacts.

    If you want to spend the time, after calling RemoveDirtMC(), you can locate individual frames with remaining spots and replace them with the frame before, the frame after, or a motion interpolated frame.
    Quote Quote  
  5. Member TeNSoR's Avatar
    Join Date
    Mar 2014
    Location
    Hungary, Debrecen
    Search PM
    Originally Posted by jagabo View Post
    Try keeping the limit argument of RemoveDirtMC() as low as possible. The higher it gets the more likely you are to see artifacts (smearing or blurring during motion, removal of spots that are supposed to be there, etc.). Of course, if you set it very low fewer spots will be removed. So you need to strike a balance between spot removal and artifacts.

    If you want to spend the time, after calling RemoveDirtMC(), you can locate individual frames with remaining spots and replace them with the frame before, the frame after, or a motion interpolated frame.
    Thanks, jagabo for replying, sorry, but how to replace the individual frames with remaining spots with the frame before?
    Also I didn't find this filter "RemoveGrainTSSE2.dll"
    Quote Quote  
  6. I believe the RemoveGrainT link at the bottom of this page is the one you want:
    http://avisynth.nl/index.php/Removegrain

    You can use ReplaceFramesMC() to replace individual frames or several frames in a row. It replaces the frames with motion interpolated frames from the surrounding frames.

    Code:
    ######################################################
    
    function ReplaceFramesMC(clip Source, int N, int "X")
    {
     # N is number of the 1st frame in Source that needs replacing. 
     # X is total number of frames to replace, 1 if not specified
     #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation
     
     X = Default(X, 1)
    
     start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
     end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
     
     start+end
     AssumeFPS(1) #temporarily FPS=1 to use mflowfps
      
     super = MSuper(pel=2, hpad=0, vpad=0, rfilter=4)
     backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
     forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
     backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
     forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
     backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
     forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
     MBlockFps(super, backward_3, forward_3, num=X+1, den=1, mode=0)
    
     AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
     Trim(1, framecount-1) #trim ends, leaving replacement frames
      
     Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
    }
    
    ######################################################
    This is a slight variation of someone else's function with a different name -- RX() I think it was.

    You call it like:

    Code:
    ReplaceFramesMC(100) # replace frame 100
    ReplaceFramesMC(205,3) # replace three consecutive frames: 205, 206, and 207
    Beware that this type of motion interpolation doesn't always work well. It sometimes leads to weird distortions.

    I have two other functions for replacing a frame with a copy of the frame before or the frame after:

    Code:
    ######################################################
    
    function ReplaceFrameNext(clip Source, int N)
    {
      # Replace frame at N with frame at N+1
      # N is the frame to replace
      # with frame at N+1
    
      loop(Source, 0, N, N)
      loop(last, 2, N, N)
    }
    
    ######################################################
    
    function ReplaceFramePrev(clip Source, int N)
    {
      # Replace frame at N with frame at N-1
      # N is the frame to replace
      # with frame at N-1
    
      loop(Source, 0, N, N)
      loop(last, 2, N-1, N-1)
    }
    
    ######################################################
    I recently saw an easier way to do this. I think there is a built in function now. But I don't remember what it is.
    Quote Quote  
  7. Member TeNSoR's Avatar
    Join Date
    Mar 2014
    Location
    Hungary, Debrecen
    Search PM
    Originally Posted by jagabo View Post
    I believe the RemoveGrainT link at the bottom of this page is the one you want:
    http://avisynth.nl/index.php/Removegrain

    You can use ReplaceFramesMC() to replace individual frames or several frames in a row. It replaces the frames with motion interpolated frames from the surrounding frames.

    Code:
    ######################################################
    
    function ReplaceFramesMC(clip Source, int N, int "X")
    {
     # N is number of the 1st frame in Source that needs replacing. 
     # X is total number of frames to replace, 1 if not specified
     #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation
     
     X = Default(X, 1)
    
     start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
     end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
     
     start+end
     AssumeFPS(1) #temporarily FPS=1 to use mflowfps
      
     super = MSuper(pel=2, hpad=0, vpad=0, rfilter=4)
     backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
     forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
     backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
     forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
     backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
     forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
     MBlockFps(super, backward_3, forward_3, num=X+1, den=1, mode=0)
    
     AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
     Trim(1, framecount-1) #trim ends, leaving replacement frames
      
     Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
    }
    
    ######################################################
    This is a slight variation of someone else's function with a different name -- RX() I think it was.

    You call it like:

    Code:
    ReplaceFramesMC(100) # replace frame 100
    ReplaceFramesMC(205,3) # replace three consecutive frames: 205, 206, and 207
    Beware that this type of motion interpolation doesn't always work well. It sometimes leads to weird distortions.

    I have two other functions for replacing a frame with a copy of the frame before or the frame after:

    Code:
    ######################################################
    
    function ReplaceFrameNext(clip Source, int N)
    {
      # Replace frame at N with frame at N+1
      # N is the frame to replace
      # with frame at N+1
    
      loop(Source, 0, N, N)
      loop(last, 2, N, N)
    }
    
    ######################################################
    
    function ReplaceFramePrev(clip Source, int N)
    {
      # Replace frame at N with frame at N-1
      # N is the frame to replace
      # with frame at N-1
    
      loop(Source, 0, N, N)
      loop(last, 2, N-1, N-1)
    }
    
    ######################################################
    I recently saw an easier way to do this. I think there is a built in function now. But I don't remember what it is.
    Much appreciated!
    Quote Quote  
  8. Member TeNSoR's Avatar
    Join Date
    Mar 2014
    Location
    Hungary, Debrecen
    Search PM
    Excuse me, jagabo, Can I put these codes together or just one of them

    Code:
    ReplaceFramesMC(100) # replace frame 100
    ReplaceFramesMC(205,3) # replace three consecutive frames: 205, 206, and 207
    Also, How can I call this code :

    Click image for larger version

Name:	Screen.PNG
Views:	1413
Size:	26.2 KB
ID:	40037

    Thank you!
    Quote Quote  
  9. Originally Posted by TeNSoR View Post
    Excuse me, jagabo, Can I put these codes together or just one of them

    Code:
    ReplaceFramesMC(100) # replace frame 100
    ReplaceFramesMC(205,3) # replace three consecutive frames: 205, 206, and 207
    You can call the function as many times as needed.


    Originally Posted by TeNSoR View Post
    Also, How can I call this code :

    Image
    [Attachment 40037 - Click to enlarge]
    As with any AviSynth function, include them in the body of your code, or save them as an AVS file and import them into your script, or save them as an AVSI file in AviSyth's plugins folder and they'll automatically import every time AviSynth is started. Then call them with:

    Code:
    ReplaceFrameNext(123) # replace frame 123 with a copy of frame 124
    ReplaceFramePrev(234) # replace frame 234 with a copy of frame 233
    Call them as many times as needed.
    Quote Quote  
  10. You can also use ReplaceFramesMC over just a part of a frame by cropping off what you don't want interpolated. For the frame in your sample, something like this works:

    Yadif(Mode=1)#or QTGMC or your favorite bobber
    SRestore()
    A=Last
    B=ReplaceFramesMC(250,2)###the crud in your sample
    B=B.Crop(450,0,0,-400)
    Overlay(A,B,450,0)


    That way, parts that might be moving and which might get artifacted by frame interpolation (Dharmendra moving), aren't affected.
    Quote Quote  
  11. Member TeNSoR's Avatar
    Join Date
    Mar 2014
    Location
    Hungary, Debrecen
    Search PM
    Originally Posted by manono View Post
    You can also use ReplaceFramesMC over just a part of a frame by cropping off what you don't want interpolated. For the frame in your sample, something like this works:

    Yadif(Mode=1)#or QTGMC or your favorite bobber
    SRestore()
    A=Last
    B=ReplaceFramesMC(250,2)###the crud in your sample
    B=B.Crop(450,0,0,-400)
    Overlay(A,B,450,0)


    That way, parts that might be moving and which might get artifacted by frame interpolation (Dharmendra moving), aren't affected.
    This is amazing! Thank you, guys!
    Quote Quote  



Similar Threads

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