Log in

View Full Version : Avisynth script to remove grain, spots, lines, scratches and dirt.


knack_liek
20th January 2021, 12:10
I am new to the world of Avisynth coding, but I have managed to create (by reading guides to find and download the various necessary plugins), through AvsPmod, a script for removing grain, dirt, lines, scratches and spots.
I did a lot of research to make sure that I have included in the source code sheet everything necessary for the script to work in the correct order, also thanks to the powerful AvsPmod debugging tool.
However, I see no difference in the output of the scripted video file.
Did I write something wrong or is the script missing some basic commands (I attach the script I write below)?
Let me know!



import("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtMC.avs")
DirectShowSource("videosource", fps= 29.97, convertfps=true)
ConvertToYV12(matrix="rec709")
RemoveDirt(20,false)


DirectShowSource("videosource", fps= 29.97, convertfps=true)
ConvertToYV12(matrix="rec709")
RemoveGrain()
TurnRight()
RemoveGrain()
TurnLeft()


DirectShowSource("videosource", fps= 29.97, convertfps=true)
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\despot.dll")
ConvertToYV12(matrix="rec709")
DeSpot(p1=35, p2=14, mthres=25)


DirectShowSource("videosource", fps= 29.97, convertfps=true)
ConvertToYV12(matrix="rec709")
even = SelectEven().RemoveDirt(80, false)
odd = SelectOdd().RemoveDirt(80, false)
Interleave(even, odd).RemoveDirt(80, false)

videoh
20th January 2021, 15:15
Should be like below. Every time you re-source the file, you lose the previous work. Source the file only once.

import("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtMC.avs")
DirectShowSource("videosource", fps= 29.97, convertfps=true)
ConvertToYV12(matrix="rec709")

RemoveDirt(20,false)

RemoveGrain()
TurnRight()
RemoveGrain()
TurnLeft()

DeSpot(p1=35, p2=14, mthres=25)

even = SelectEven().RemoveDirt(80, false)
odd = SelectOdd().RemoveDirt(80, false)
Interleave(even, odd).RemoveDirt(80, false)

hello_hello
20th January 2021, 17:43
knack_liek,
FYI, DirectShowSource is probably a "last resort" source filter. It's often not frame accurate (if you jump to a specific frame number you mightn't land on the same frame each time) . Even the DirectShowSource page on the wiki suggests the same. http://avisynth.nl/index.php/DirectShowSource
You're also at the mercy of having system codecs doing the decoding.

For DVD and mpeg2 video: http://avisynth.nl/index.php/DGDecode
For most file types:
http://avisynth.nl/index.php/FFmpegSource
or
http://avisynth.nl/index.php/LSMASHSource