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 25th September 2014, 06:30   #21  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
The first script hello_hello posted didn't have proper quoted argument names in the function definition, which is how Avisynth defines an optional argument. By quoting them, you can call it without passing everything. The limit = default(limit,6) without limit being quoted is obviously an error.
foxyshadis is offline   Reply With Quote
Old 25th September 2014, 06:50   #22  |  Link
flashmaster
Banned
 
Join Date: Sep 2014
Location: https://t.me/pump_upp
Posts: 10
i have tried this
function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}
...it loads up on vituraldub no problem only thing is there is no changes..so now what ? i have seen clips where all the dirt and pops go away...but for me nothing.

so far the only way i have i have cleaned up old film is frame by frame and thats over 1,300 frames for about 1min of film and treating each frame has if i am cleaning old photos..but this takes almost a day and next month i will have 25min film to do.

but at the looks of things..i have tried it all...i have copy and paste and i have tried fiddling with numbers and nothing...the only thing works for me in avisynth is the basic scripts thats on the wiki site other then nothing else works just either an error or no changes

at some point i will give up and face facts that this will not work
flashmaster is offline   Reply With Quote
Old 25th September 2014, 09:06   #23  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Please post a complete script that you say does nothing.
manono is offline   Reply With Quote
Old 25th September 2014, 09:40   #24  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
flashmaster,
You really need to be fairly specific as to what you're doing otherwise you'll find most of the time is spent playing 20 questions. Posting your entire script might help. I'm not sure what "loads up on VirtualDub" means.

The script you copied specifies the functions and default values etc, but it won't do anything if you just copy and paste it into a script for encoding. You need to follow it with RemoveDirt(), so if you're going to copy and paste it into a script, you'd need to end up with something like this:

Quote:
function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}

RemoveDirt()
You could create an avsi file containing the script, as I mentioned in a previous post, and put the avsi script in the Avisynth plugins folder. That way, all you'd need to add to your script is RemoveDirt() with any optional values you might want to use.

Keep in mind there's a few RemoveDirt scripts, so if you do create an avsi file with a function RemoveDirt and put it in the Avisynth plugins folder, don't put more than one in their at a time.

Anyway, my next post contains step by step instructions for getting the above script to work..... I hope.

Last edited by hello_hello; 25th September 2014 at 09:46.
hello_hello is offline   Reply With Quote
Old 25th September 2014, 09:43   #25  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
@TurboPascal7
here are some buggy sample scripts.

first, the working one

Code:
lwlibavvideoSource("xxx")
super=msuper ()
vectors=super.manalyse (multi=true,delta=6)
mdegrainn (super,vectors,6)
buggy script ver 1
Code:
lwlibavvideoSource("xxx")
super=msuper ()
vectors=super.manalyse (multi=true,delta=6)
mdegrainn (super,vectors,tr=6) 
#the script returns "Script error: Invalid arguments to function 'mdegrainn'" while "tr=6" works with no error in mcompensate
buggy script ver 2
Code:
super=msuper ()
vectors=manalyse (super=super,multi=true,delta=6) #manalyse (super,multi=true,delta=6) works
mdegrainn (super,vectors,6) 
#the script returns "Script error: manalyse does not have a named argument "super"", but it's clearly written in MVtools2 document that the first parameter of manalyse is "clip super"
I'm using AVS+ 0.1 (r1576, x86) and MVTools 2.6.0.5
feisty2 is offline   Reply With Quote
Old 25th September 2014, 09:45   #26  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
flashmaster,
copy the text below and paste it into a new text file. Save it as RemoveDirt.txt and then change the extension to RemoveDirst.avsi (or simply call it RemoveDirst.avsi in the first place). Copy it to your Avisynth plugins folder. I'm running XP so the folder location would be "C:\Program Files\AviSynth 2.5\plugins".

Quote:
function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}
There's so many version of plugins floating around it can get confusing.
http://home.arcor.de/kassandro/prere...eGrain-1.0.rar
http://home.arcor.de/kassandro/prere...GrainT-1.0.rar

Download both the above, unzip them and copy every file inside with an SSE2 at the end of it's name to your Avisynth plugins folder. I honestly can't remember if they're all required but it can't hurt.

When that's done, add this to a script you're using for encoding:

RemoveDirt()

If all went well......
If you get an error along the lines of "no function named RemoveDirt" then the avsi script you created isn't being auto-loaded for some reason, or you've done something wrong.

There's a slightly modified version of the above script. You can copy and paste the text below again and use it to create a file called RemoveSpots.avsi which you'd copy to your Avisynth plugins folder and add to a script like this:

RemoveSpots()

Quote:
function RemoveSpots(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return corrected
}
Both work quite well for removing blemishes in individual frames. I think the second one blurs a little less. I can't remember though as I haven't used them for a while. Keep in mind both have a tendency to blur detail where's there's motion. Pretty much all filtering is some sort of compromise between the result you want and one you don't.

Last edited by hello_hello; 25th September 2014 at 10:05.
hello_hello is offline   Reply With Quote
Old 25th September 2014, 09:54   #27  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
feisty2,
In this case the problem seemed to be the script not having proper quoted argument names, as foxyshadis suggested. When I changed it to this, the error messages went away.

Quote:
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=limit,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=limit,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)
}

function RemoveDirtMC(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.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
Mind you I'm still not sure I understand it correctly. Should RemoveDirt() or RemoveDirtMC() be added to a script? Or either?
I experimented with it a little and couldn't seem to get any action out of it unless I cranked up the limit value quite a bit:

RemoveDirt(limit = 60)

flashmaster,
If you want to try the above script it also requires mvtools.dll be in the Avisynth plugins folder.
http://avisynth.org.ru/mvtools/mvtools-v1.11.4.5.zip
hello_hello is offline   Reply With Quote
Old 25th September 2014, 10:21   #28  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
"Mxx" is the format of mvtools2, mvtools 1.x script would be "MVxx" format
you don't need old mvtools 1
see #785 at http://forum.doom9.org/showthread.php?t=168856&page=40
you can run that script with mvtools2 and other modern filters
feisty2 is offline   Reply With Quote
Old 25th September 2014, 10:28   #29  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 308
Quote:
Originally Posted by feisty2 View Post
@TurboPascal7
here are some buggy sample scripts.

I'm using AVS+ 0.1 (r1576, x86) and MVTools 2.6.0.5
Fun fact: non-optional arguments cannot be used with name=value syntax. If I'm not wrong, the Avisynth API treats named arguments as being optional so there's no way to have a named but non-optional argument for a C/C++ plugin.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!
colours is offline   Reply With Quote
Old 25th September 2014, 10:37   #30  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
but they don't seem "non optional" in the document, they are written with the same format as other normal parameters inside the function list
feisty2 is offline   Reply With Quote
Old 25th September 2014, 10:59   #31  |  Link
TurboPascal7
Registered User
 
TurboPascal7's Avatar
 
Join Date: Jan 2010
Posts: 270
Quote:
Originally Posted by feisty2 View Post
but they don't seem "non optional" in the document, they are written with the same format as other normal parameters inside the function list
Then you need to complain to the author of said documentation about it being misleading instead of saying that mvtools is buggy when it's not.
__________________
Me on GitHub | AviSynth+ - the (dead) future of AviSynth
TurboPascal7 is offline   Reply With Quote
Old 25th September 2014, 17:43   #32  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by feisty2 View Post
"Mxx" is the format of mvtools2, mvtools 1.x script would be "MVxx" format
you don't need old mvtools 1
see #785 at http://forum.doom9.org/showthread.php?t=168856&page=40
you can run that script with mvtools2 and other modern filters
Ahhhhh.... I just assumed the original mvtools was required as it's one of the plugins included here, but there's several scripts, so maybe one of the other scripts needs it?
I'll confess you did help me to conclude mvtools was required given you posted about it being buggy directly below the script I posted.

Cheers.

While I was encoding some old video I thought I'd try some spot removal. There's a zip file at the bottom of this post with some samples.

Re-encode.mkv is a re-encode only. No filtering.

QTGMC.mkv is a re-encode while running QTGMC in progressive mode. That's my benchmark against which I often compare other filters.
QTGMC(InputType=1) was added to the script.

RemoveSpots.mkv is an encode using the RemoveSpots script here (second script).
RemoveSpots() was all that was added to the script.

RemoveDirt.mkv is an encode using the RemoveDirt script here.
RemoveDirt() was all that was added to the script.

RemoveDirty.mkv is an encode using the RemoveDirty script below. It's the RemoveDirtMC script with a name change so I could put them all in the plugins folder.
RemoveDirty(limit=12) was added to the script.

QTGMC leaves the most spots behind but also tends to improve the quality in other areas rather than reduce it. As many of us know, it's very slow.

RemoveDirt blurs to much for me but it did remove all the spots.

RemoveSpots blurs less than RemoveDirt and seems to do a pretty good job.

RemoveDirty is the script below which was originally RemoveDirtMC. I'm guessing the idea is it removes dirt where there's no motion, but not so much where there is motion to cut down on the blurring? Or something like that?

Quote:
function RemoveDirty(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=limit,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=limit,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)
}

function RemoveDirtMC(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.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
I made the samples in the zip file for my own little comparison, but thought while I was at it I might upload them too. How well they'll apply to fixing old film transfers, I have no idea. The source was 720x576 and resized to 640x480 each time. If anybody's got a better script......
No doubt each of the scripts could be tweaked for better results. I just used the default settings for each, except for the last one. I seemed to need to bump it up a bit.

samples.zip 20.2MB

Last edited by hello_hello; 25th September 2014 at 17:49.
hello_hello is offline   Reply With Quote
Old 25th September 2014, 17:56   #33  |  Link
flashmaster
Banned
 
Join Date: Sep 2014
Location: https://t.me/pump_upp
Posts: 10
thanks hello_hello i have tried all 3 of your scripts and amazing no errors but also i see no changes..nothing at all, on virtualdub both screen views are the same
flashmaster is offline   Reply With Quote
Old 25th September 2014, 18:16   #34  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,576
Quote:
Originally Posted by flashmaster View Post
on virtualdub both screen views are the same
What makes you think that they are supposed to be different? Second panel will only reflect the difference made by internal vdub filters and not related to avisynth in any way.
Keiyakusha is offline   Reply With Quote
Old 25th September 2014, 18:18   #35  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by flashmaster View Post
thanks hello_hello i have tried all 3 of your scripts and amazing no errors but also i see no changes..nothing at all, on virtualdub both screen views are the same
As requested several times - Post your complete script.
Groucho2004 is offline   Reply With Quote
Old 25th September 2014, 18:59   #36  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by flashmaster View Post
thanks hello_hello i have tried all 3 of your scripts and amazing no errors but also i see no changes..nothing at all, on virtualdub both screen views are the same
If you're putting an Avisynth filter in an Avisynth script, then you open the script with VirtualDub, the filter will be applied to the video when it's opened.

ie You put a filter in a VirtualDub script which turns the entire frame purple, you open the script with VirtualDub, you'll see a purple frame. As far as VirtualDub's concerned, that's the original video.
Or try adding this to a script: ColorBars() If you put it at the end you should see nothing but colour bars when you open the script.

You're making it too hard to help you. You need to post a detailed description of what you're doing. What does "trying the scripts" involve? I mentioned why they may be having no effect here, but you haven't replied to say if that's what you're doing.

Try MeGUI instead of VirtualDub. I mentioned it here.
Use the File/Open menu and follow the prompts. Eventually the script creator will open with a preview. MeGUI creates a basic script for you but it's easy to modify the script manually. You can switch between the original unfiltered video and the video with the script applied using the Preview button.

I quite often use MPC-HC to compare scripts. You need to change the setting to view "all files" to see scripts when you use the File/Open menu. I've also put a shortcut to MPC-HC in the Windows SendTo folder, so to open a script I can right click on one and select SendTo/MPC-HC. Often I'll create a simple script with virtually no filtering, then another with filtering, maybe a third etc.... then I use 3 instances of MPC-HC to open them all at the same time. You can open them as if they were the original video and run them full screen etc. I have my PC connected to my TV so I use the TV for viewing scripts in full screen mode before encoding.

Anyway.... please explain exactly what you're doing as it's impossible to help otherwise. The easier you make it for someone to help you.....
Maybe also explaining which scripts and/or plugins you have in the Avisynth plugins folder might help.

Last edited by hello_hello; 25th September 2014 at 19:09.
hello_hello is offline   Reply With Quote
Old 26th September 2014, 15:43   #37  |  Link
flashmaster
Banned
 
Join Date: Sep 2014
Location: https://t.me/pump_upp
Posts: 10
well i am truly giving up..avisynth just does not work on my pc, had days of help from anther form with links, scrips, tips and i tried all..he even showed me how he had cleaned up some frames with the script he gave me. no matter what i do i can't load up removedirt or removespots i have tried dll, avs and avsi but all have errors
flashmaster is offline   Reply With Quote
Old 26th September 2014, 16:38   #38  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
Quote:
Originally Posted by flashmaster View Post
well i am truly giving up..avisynth just does not work on my pc, had days of help from anther form with links, scrips, tips and i tried all..he even showed me how he had cleaned up some frames with the script he gave me. no matter what i do i can't load up removedirt or removespots i have tried dll, avs and avsi but all have errors
"it doesn't work on my PC" isn't a thing. Computers do not magically decide not to run certain software. Of course it works on your PC, you're just doing it wrong. Furthermore, you're making it impossible for other people to help you by refusing to explain what exactly you're doing. If we knew what you were doing, we could tell you what you were doing wrong and what you should do instead, but we're not telepaths and "it has errors" tells us absolutely nothing. These problems are all your own fault.

Last edited by TheFluff; 26th September 2014 at 16:46.
TheFluff is offline   Reply With Quote
Old 26th September 2014, 18:12   #39  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
"It doesn't work on my PC" is obviously nonsense, given it'd appear from the tiny bit of information we've been given, you've been able to create a basic script and open it in VirtualDub. If that's the case, then Avisynth works. You posted a screenshot of AvsPmod showing a preview of a script, and another screenshot of an Avisynth error message regarding a function in a script. Therefore, Avisynth is working. You've just not managed to get the plugins to load/work, but given you won't provide the slightest detail regarding what you've tried, giving up does seem like the sensible choice at this point.

I've no idea how much time you spent trying to sort the problem via the other forum you referred to, but if it's anything like the time you've put into posting here..... writing detailed posts gets frustrating pretty quickly when the person asking for help won't even make the effort to answer a single question.
hello_hello is offline   Reply With Quote
Old 27th September 2014, 03:48   #40  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by hello_hello View Post
...but given you won't provide the slightest detail regarding what you've tried, giving up does seem like the sensible choice at this point.
I'm inclined to agree. He resolutely refuses to provide the information asked for. And it's usually a good idea to walk before you run. Learn to use AviSynth for basic stuff before jumping into fairly advanced scripting.
Quote:
Originally Posted by hello_hello View Post
I've no idea how much time you spent trying to sort the problem via the other forum you referred to, but if it's anything like the time you've put into posting here.....
http://forum.videohelp.com/threads/3...-with-avisynth

They're having the same problem over there.
manono 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 11:50.


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