Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd August 2019, 06:21   #1  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
Using DeScratch

Hi All, I'm new to this forum , so please forgive my ignorance if I ask silly questions. I have a bunch of VHS and Video 8 tapes to digitize and I would really like to get rid of some of the horizontal dropout streaks from old tapes. I also plan to be converting one of my old 8 mm film projectors so I really need to understand AviSynth. I am a retired electronics technician from the analog world with some programming knowledge from the old Apple 2 days and for the last 10 years , I have been programming PIC chips, so I have a small knowledge of programming languages and scripts.

I've tried using DeScratch with VurtualDub but maybe I'm sticking the .dll file in the wrong folder or something because I do not see any change in the dropouts. I did manage to use a few of the other scripts successfully but I just can't figure out DeScratch. I would really appreciate some help. I've attached two pics of the problem. Thanks very much.

Keith R
Attached Images
  
Keith R is offline   Reply With Quote
Old 2nd August 2019, 10:24   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,422
DeScratch is for longish vertical streaks, so would require at least an eg "Turnleft ... Descratch ... Turnright ...".

attachments take som time to appear, but maybe this is similar example:- https://forum.doom9.org/showthread.p...on+Compensated

and see post #7.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 2nd August 2019, 12:02   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,338
I've had better luck with DeSpot, although it is difficult to tune. Here is the function I made for it to remove VHS dropouts. You will have to read the DeSpot documentation and you will have to alter the settings I used. Also, no matter what, it isn't perfect.

So, without any warranty, here is some code. "Remove_TearsI" is the interlaced front end to Remove_Tears. Since I always keep my VHS captures interlaced, I use this front end.

Code:
function Remove_TearsI(clip source) 
{

ml           = 100 # mask scale
scene_change = 200 # scene change

fields=source.SeparateFields()
even_fields=selecteven(fields)
odd_fields =selectodd(fields)

even_result_fields = RemoveTears(even_fields,ml,scene_change)
odd_result_fields  = RemoveTears(odd_fields, ml,scene_change)

#=================
#Put even and odd fields back together into interlaced video

interleave(even_result_fields,odd_result_fields)
weave()

} # End Function RemoveTearsI

function RemoveTears(clip source, int ml, int scene_change) 
{
show=0
tsmooth=0
p1percent=2
dilate=20
maxpts=0
p2=12
mthres=16
p1=24
pwidth=100
pheight=12
mwidth=7
mheight=5
merode=33
interlaced=false
seg=1
sign=0
ranked=true

super = MSuper(source,hpad=16, vpad=16, pel=2, sharp=1)

vb = MAnalyse(super,isb = true,  blksize=8,overlap=4,search=3,dct=0) # backward vectors 
vf = MAnalyse(super,isb = false, blksize=8,overlap=4,search=3,dct=0) # forward vectors 

cb = MFlow(source,super,vb,thSCD1=scene_change) # next compensated backward 
cf = MFlow(source,super,vf,thSCD1=scene_change) # previous compensated forward

sadf = MMask(super,vf, ml=ml,kind=1,gamma=1, thSCD1 = scene_change)
msadf= sadf.Binarize()           # binary inverted forward SAD mask

sadb = MMask(super,vb, ml=ml, gamma=1, kind=1, thSCD1 = scene_change) # backward SAD mask
msadb= sadb.Binarize() # binary inverted backward SAD mask

msad = Logic(msadf,msadb,"OR") # combined inverted SAD mask
msad = msad.Expand() # expanded inverted SAD mask
msadi = Interleave(msad, msad, msad) # interleaved 3-frame inverted SAD mask

Interleave(cf,source,cb) # interleave forward compensated, source, and backward compensated

DeSpot(show=show,extmask=msadi,tsmooth=tsmooth,p1percent=p1percent,dilate=dilate,maxpts=maxpts,p2=p2,\
       mthres=mthres,p1=p1,pwidth=pwidth,pheight=pheight,mwidth=mwidth,mheight=mheight,merode=merode,\
       interlaced=interlaced,seg=seg,sign=sign,ranked=ranked).SelectEvery(3,1)

}
johnmeyer is offline   Reply With Quote
Old 2nd August 2019, 15:48   #4  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
Thanks John, Hmmm....John Meyer?? Do you play a mean guitar and sing?? O.K. jokes aside, the script looks good, but would you mind just explaining how to use it in simple steps please? Sorry but I did say that this was new to me. Thanks again!

Keith R
Keith R is offline   Reply With Quote
Old 2nd August 2019, 16:40   #5  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,835
I used RemoveDirtMC_SE for remove Tears and it did the job
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd August 2019, 18:15   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,422
Quote:
how to use it in simple steps
With Johns posted script also inserted somewhere into your script [here we just formatted a little, makes it a lot easier to understand and see that it is 2 script functions.
Code:
Function Remove_TearsI(clip source) { # Interlaced
    ml           = 100 # mask scale
    scene_change = 200 # scene change
    fields=source.SeparateFields()
    even_fields=selecteven(fields)
    odd_fields =selectodd(fields)
    even_result_fields = RemoveTears(even_fields,ml,scene_change)  # Calling the Progressive function for each of the interlaced fields
    odd_result_fields  = RemoveTears(odd_fields, ml,scene_change)  # Ditto
    #=================
    #Put even and odd fields back together into interlaced video
    interleave(even_result_fields,odd_result_fields)
    weave()
} # End Function RemoveTearsI


Function RemoveTears(clip source, int ml, int scene_change) { # Progressive
    show=0
    tsmooth=0
    p1percent=2
    dilate=20
    maxpts=0
    p2=12
    mthres=16
    p1=24
    pwidth=100
    pheight=12
    mwidth=7
    mheight=5
    merode=33
    interlaced=false
    seg=1
    sign=0
    ranked=true
    super = MSuper(source,hpad=16, vpad=16, pel=2, sharp=1)
    vb = MAnalyse(super,isb = true,  blksize=8,overlap=4,search=3,dct=0) # backward vectors
    vf = MAnalyse(super,isb = false, blksize=8,overlap=4,search=3,dct=0) # forward vectors
    cb = MFlow(source,super,vb,thSCD1=scene_change) # next compensated backward
    cf = MFlow(source,super,vf,thSCD1=scene_change) # previous compensated forward
    sadf = MMask(super,vf, ml=ml,kind=1,gamma=1, thSCD1 = scene_change)
    msadf= sadf.Binarize()           # binary inverted forward SAD mask
    sadb = MMask(super,vb, ml=ml, gamma=1, kind=1, thSCD1 = scene_change) # backward SAD mask
    msadb= sadb.Binarize() # binary inverted backward SAD mask
    msad = Logic(msadf,msadb,"OR") # combined inverted SAD mask
    msad = msad.Expand() # expanded inverted SAD mask
    msadi = Interleave(msad, msad, msad) # interleaved 3-frame inverted SAD mask
    Interleave(cf,source,cb) # interleave forward compensated, source, and backward compensated
    DeSpot(show=show,extmask=msadi,tsmooth=tsmooth,p1percent=p1percent,dilate=dilate,maxpts=maxpts,p2=p2,\
    mthres=mthres,p1=p1,pwidth=pwidth,pheight=pheight,mwidth=mwidth,mheight=mheight,merode=merode,\
    interlaced=interlaced,seg=seg,sign=sign,ranked=ranked).SelectEvery(3,1)
}

### End Of Johns script functions

AviSource(...) # your source filter. Implicitly assigns clip to special Last variable

# For  Interlaced source
#Return Remove_TearsI()   # Implicitly called with special variable clip Last. The end of script for Interlaced [commented out if not interlaced]

# For  Progressive source

# Below simply taken from inside Johns Remove_TearsI function,
ml           = 100  # mask scale
scene_change = 200  # scene change

RemoveTears(ml,scene_change)   #  Implicitly called with special variable clip Last.   # EDIT: Oops, was Remove_TearsI

Return Last # The end of script for Progressive
The items in red are MVTools arguements, see docs for MvTools.
The Items in Blue, are DeSpot args, see DeSpot [and may not need be changed, although I think that john has a habit of temporarily changing args in-situ for special circumstance).

Also of course need DeSpot and MvTools dlls.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th August 2019 at 14:21.
StainlessS is offline   Reply With Quote
Old 3rd August 2019, 10:40   #7  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
Thanks Guys, I'll have a go at this and report back!

Keith R

Last edited by Keith R; 4th August 2019 at 07:43.
Keith R is offline   Reply With Quote
Old 9th August 2019, 13:20   #8  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
O.K. I tried all of this stuff without success. It's all a bit above my old brain I'm afraid. I did get some other advice from a few other forums. After a lot more trial and error, and loads of frustration (gave up a few times!) I came across RgTools in the AviSynth Wiki. I eventually used a simple script with a few lines to enable the RgTools filter and I fixed my bad video enough to make it more than watchable. I've attached a before and after pic to see. I can tell you that this video was really full of streaks all over and this fix worked. I captured the original footage as an Mpeg 2 file and to use the script in VideoDub 2, I converted the footage to an AVI file. I still need to re-edit the entire clip which I prefer to do in Power Director, but after many weeks of trying to undertand the AviSynth involved scripts and protocols, this works so well for me, and I did not have to get involved with that very steep learning curve.

Here is my .avs script:

LoadPlugin("RgTools.dll")
DirectShowSource("Location and name of your video to fix.avi")
ConvertToYV12()
input=last
AssumeTFF()
RemoveGrain
Clense

I put the RgTools.dll file in the same folder that I saved the above script in. If anyone needs to know the whole setup, then I can post it here. I also ran the deinterlace filter in VirtualDub at the same time and now I will just edit the whole clip properly and stick it on a DVD for my friends. This is so great and will fix most of my bad footage. I can still see the incredible power of AviSynth so I will plug on and try to learn the more advanced stuff later. Thanks for the help guys!

Keith R
Attached Images
 
Keith R is offline   Reply With Quote
Old 10th August 2019, 03:08   #9  |  Link
LemMotlow
Registered User
 
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 268
What the hell do you expect us to do with still images? Don't you know how to make video samples? If you don't, why not ask?

Are they just getting thicker out there, or what?
LemMotlow is offline   Reply With Quote
Old 10th August 2019, 04:39   #10  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,338
Quote:
Originally Posted by LemMotlow View Post
Are they just getting thicker out there, or what?
Probably not, but you are sure getting snarkier.

The guy's a newbie and trying to get his first script to run. True, he didn't post a video clip, but no one asked him for that.
johnmeyer is offline   Reply With Quote
Old 10th August 2019, 06:33   #11  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
Wow.....let me try that again. Lem, no need to get nasty. I am not used to forums that allow big files, and the drop-out streaks are just like dirty heads, damaged tape etc. As John rightly said, I am indeed a newbie and at 69 years of age, I don't learn as fast as I did when I was younger. After I posted the above comments, I found that it is the "Clense" function that removes the streaks. I also found that the overall quality of the video in terms of speed of movement, maybe the word is "dithering", became worse, so as I stated, I still need to learn a lot. Hopefully there are more "patient" folks out there on this forum than LemMotlow. To JohnMeyer and StainlessS, my grateful thanks!

Keith R

Last edited by Keith R; 10th August 2019 at 06:41.
Keith R is offline   Reply With Quote
Old 10th August 2019, 10:32   #12  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,033
Quote:
Originally Posted by Keith R View Post
Hopefully there are more "patient" folks out there on this forum than LemMotlow.
There certainly are. There was another useless post from him a few hours ago. He probably didn't get laid in a while.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 10th August 2019, 14:23   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,422
Oops sorry, edit in prev post#6

Code:
RemoveTears(ml,scene_change)   #  Implicitly called with special variable clip Last.   # EDIT: Oops, was Remove_TearsI
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 10th August 2019, 16:58   #14  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
Thanks guys, for sure there just has to be at least one unhappy character on forums, but it is nice to know that you guys are there to help. So to post a video, do I just stick it on YouTube or Vimeo and post the link here?

Keith R
Keith R is offline   Reply With Quote
Old 10th August 2019, 17:45   #15  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,338
The purpose of uploading a video clip is so people can look at exactly what you are dealing with. I emphasized that word because uploading to YouTube, while easy to do, completely alters the video (they re-encode and do other things when streaming). Also, if you re-encode as part of cutting the clip (so you only have 5-10 seconds to keep the upload small), then you have also altered it.

The easiest thing is to download VirtualDub2 and use it to cut your video down to a short clip. It is generally best to pick a clip that has some actual motion (i.e., no video of grandma sitting in a chair talking). You put the video on the timeline, select "Direct Stream Copy" from the video menu, create your "in/out" points (i.e., where you will cut the video), and then save that clip.

You can then upload that to any site that lets other people download the file. Someone else will have to give you a list of what people are using today. I'm only a couple of years younger than you, and some of my favorites from the past are no longer useful. I think you can still use Mediashare, and you might be able to use Google Drive, although I don't know if they permit widespread sharing.
johnmeyer is offline   Reply With Quote
Old 10th August 2019, 17:53   #16  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,033
Quote:
Originally Posted by Keith R View Post
So to post a video, do I just stick it on YouTube or Vimeo and post the link here?
You should post to a file hosting site such as dropbox or mediafire. The clip must be an unprocessed sample from the original.

If the clip is too big you can cut it, there are several tools to do that for various file types. We would need to know what exactly you're working with in order to suggest a cutting tool.

Edit - John was faster and added an alternative approach. See what works best for you.
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 10th August 2019 at 17:55.
Groucho2004 is offline   Reply With Quote
Old 11th August 2019, 07:36   #17  |  Link
Keith R
Keith R
 
Join Date: Jul 2019
Location: South Africa
Posts: 7
https://youtu.be/AmVsWSWwrck

Thanks Guys, I stuck a YouTube link here in the meantime, just to illustrate the difference. I captured the footage in Mpeg2 using my Power Director 13 software. I'm actually trying to put together a story about our model plane club so instead of running through old tapes, I just dump all of the tapes to a hard drive. I have many hours of footage to look through to create shot lists so I figured that having them in a non-linear format is the best way to do this quickly. Of course what happened here is that I come across footage of family and friends and get side-tracked!

I will try to capture the bad footage again in VirtualDub using a lossless format. So for now, I am really happy about AviSynth and the help on this forum.

Keith R
Keith R is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:00.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.