Oswald Bastable
6th July 2006, 02:20
I'm something of a newbie at this, but an inveterate researcher before I usually ask questions. I can't figure out why a script works correctly in one case, but not in another. Either I've done something wrong in my additions (and I believe I may know where, though I'm not positive), or there's something I'm missing.
The setup:
I've been developing a script to clean up some old B&W film, specifically some Three Stooges shorts, using filters like removedirt, removegrain, despot and others as you will see. The problem came up when I tried to apply the script to 3 different trimmed parts of a short, as each part needed to be cropped differently before being resized and rejoined.
The original script is as follows:
LoadPlugin("D:\DVD\AviSynth\plugins\DGDecode.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\Decomb.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\despot.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removedirt.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removegrain.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\msharpen.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\descratch.dll")
MPEG2Source("Uncivil Warriors.d2v")
AssumeTFF()
Telecide(guide=1)
Decimate()
#Crop(0,0,-16,-8)
removedirt(grey=true,pthreshold=10,mthreshold=150)
removegrain()
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
descratch()
msharpen(threshold=100,strength=150)
#LancZosResize(640,480)
greyscale()
The crop and resize are commented out here because I ended up running the script on the short and saving as an uncompressed .avi, then doing the trim, crop and resize in a second script when compressing to xvid. I should also mention that I believe my problem may be with the despot portion and the way I had to adapt it for my attempt to do all in one script. I found the despot example in another thread and tried it, and it seemed to do what I wanted.
The adapted script including trim, etc. that I put together is as follows:
LoadPlugin("D:\DVD\AviSynth\plugins\DGDecode.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\Decomb.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\despot.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removedirt.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removegrain.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\msharpen.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\descratch.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\depan.dll")
video=MPEG2Source("Uncivil Warriors.d2v").AssumeTFF().Telecide(guide=1).Decimate()
Open=video.Crop(38,24,-58,-24).Trim(0,924).removedirt(grey=true,pthreshold=50,mthreshold=150,athreshold=100).removegrain().descratch().msharpen(threshold=100,strength=150).LancZosResize(640,480).greyscale()
function mydespot {
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
}
Main=video.Crop(0,0,-16,-8).Trim(925,27992).removedirt(grey=true,pthreshold=10,mthreshold=150).removegrain().descratch().msharpen(threshold=100,strength=150).LancZosResize(640,480).greyscale()
function mydespot {
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
}
Close=video.Crop(32,24,-40,-24).Trim(27993,0).removedirt(grey=true,pthreshold=10,mthreshold=150).removegrain().descratch().msharpen(threshold=100,strength=150).LancZosResize(640,480).greyscale()
function mydespot {
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
}
return Open+Main+Close
The open, main and close refer to the opening credits, main short and closing credits. When I run the first script on the whole short, everything comes out looking quite good. When I run the second one, some of the single frame spots that I believe removedirt should be removing, remain. I think those spots may have actually been removed by despot, and that's where my problem is, but I'm not sure because other defects that removedirt alone wouldn't deal with (stuff that's two or three frames long) is still cleaned up.
In putting the second script together, I kept getting function argument errors on the despot section, until I turned it into a function, but I'm not sure I've done it correctly...except that it does seem to work for many of the problems I have it in there for.
I just can't figure out why single frame defects that are removed with the first script, aren't with the second and I'm hoping someone can point out my error. As an example, in the opening credits on frame 421, a single white spot appears in a specific place on that frame (it's definitely not there on frames 420 or frame 422), and it's removed by the first script, but not by the second. There are other examples I found as well.
I'm sure there are other ways I could tighten this script up, but as I mentioned at the outset, I'm a bit of a newbie here and more interested in what works at this point, rather than elegance or speed.
Many thanks and sorry for the long windedness. :)
The setup:
I've been developing a script to clean up some old B&W film, specifically some Three Stooges shorts, using filters like removedirt, removegrain, despot and others as you will see. The problem came up when I tried to apply the script to 3 different trimmed parts of a short, as each part needed to be cropped differently before being resized and rejoined.
The original script is as follows:
LoadPlugin("D:\DVD\AviSynth\plugins\DGDecode.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\Decomb.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\despot.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removedirt.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removegrain.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\msharpen.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\descratch.dll")
MPEG2Source("Uncivil Warriors.d2v")
AssumeTFF()
Telecide(guide=1)
Decimate()
#Crop(0,0,-16,-8)
removedirt(grey=true,pthreshold=10,mthreshold=150)
removegrain()
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
descratch()
msharpen(threshold=100,strength=150)
#LancZosResize(640,480)
greyscale()
The crop and resize are commented out here because I ended up running the script on the short and saving as an uncompressed .avi, then doing the trim, crop and resize in a second script when compressing to xvid. I should also mention that I believe my problem may be with the despot portion and the way I had to adapt it for my attempt to do all in one script. I found the despot example in another thread and tried it, and it seemed to do what I wanted.
The adapted script including trim, etc. that I put together is as follows:
LoadPlugin("D:\DVD\AviSynth\plugins\DGDecode.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\Decomb.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\despot.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removedirt.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\removegrain.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\msharpen.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\descratch.dll")
LoadPlugin("D:\DVD\AviSynth\plugins\depan.dll")
video=MPEG2Source("Uncivil Warriors.d2v").AssumeTFF().Telecide(guide=1).Decimate()
Open=video.Crop(38,24,-58,-24).Trim(0,924).removedirt(grey=true,pthreshold=50,mthreshold=150,athreshold=100).removegrain().descratch().msharpen(threshold=100,strength=150).LancZosResize(640,480).greyscale()
function mydespot {
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
}
Main=video.Crop(0,0,-16,-8).Trim(925,27992).removedirt(grey=true,pthreshold=10,mthreshold=150).removegrain().descratch().msharpen(threshold=100,strength=150).LancZosResize(640,480).greyscale()
function mydespot {
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
}
Close=video.Crop(32,24,-40,-24).Trim(27993,0).removedirt(grey=true,pthreshold=10,mthreshold=150).removegrain().descratch().msharpen(threshold=100,strength=150).LancZosResize(640,480).greyscale()
function mydespot {
i=last
d=depanestimate(trust=3)
depaninterleave(i,data=d)
despot(p1=30,p2=15,pwidth=702,pheight=276,mthres=20,motpn=true,dilate=1,seg=1)
selectevery(3,1)
}
return Open+Main+Close
The open, main and close refer to the opening credits, main short and closing credits. When I run the first script on the whole short, everything comes out looking quite good. When I run the second one, some of the single frame spots that I believe removedirt should be removing, remain. I think those spots may have actually been removed by despot, and that's where my problem is, but I'm not sure because other defects that removedirt alone wouldn't deal with (stuff that's two or three frames long) is still cleaned up.
In putting the second script together, I kept getting function argument errors on the despot section, until I turned it into a function, but I'm not sure I've done it correctly...except that it does seem to work for many of the problems I have it in there for.
I just can't figure out why single frame defects that are removed with the first script, aren't with the second and I'm hoping someone can point out my error. As an example, in the opening credits on frame 421, a single white spot appears in a specific place on that frame (it's definitely not there on frames 420 or frame 422), and it's removed by the first script, but not by the second. There are other examples I found as well.
I'm sure there are other ways I could tighten this script up, but as I mentioned at the outset, I'm a bit of a newbie here and more interested in what works at this point, rather than elegance or speed.
Many thanks and sorry for the long windedness. :)