logo Sign In

@ laserschwert - need you to explain something

Author
Time
could you explain a little more about using this sangnom filter in avisynth.

I use stuff like dust, decomb, msharpen etc but those are all single line command filters. I don't understand anything you posted about this

my ANH is prone to a number of jaggies from the decomb IVTC process using Donald Grafts filter. this sangnom filter seems quite nice and there is a similar thread over at Doom9 but both yourself and this thread do this

LoadPlugin("E:\Programme\AviSynth2\plugins\bak\MaskTools.dll")

v1=AviSource("e:\zion_rec.avi").SeparateFields.SelectEvery(10,0,1,2,3,4,5,6,9).Weave.AssumeFPS(23.976)
v2=AviSource("e:\zion_rec.avi").SeparateFields.SelectEvery(10,0,1,2,3,4,5,6,9).Weave.AssumeFPS(23.976).crop(4,0,0,0).AddBorders(0,0,4,0, color=$FFFFFF).blur(.5)

v3 = overlay(v1,v2, opacity=0.2, mode="Darken")

v4 = v3.Crop(0,102,-0,-102).Lanczos4Resize(720,600)

v4a=v4.SangNom(order=0)
v4b=v4.SangNom(order=1)

v5 = v4a.ConvertToYV12.overlay(v4b, opacity=0.5).LimitedSharpen
v6 = v5.Levels(0,1.236,224,0,255).Lanczos4Resize(720,376).AddBorders(0,52,0,52)

Return v6

and I don't understand this vbusiness at all what's the point of v3,v4,v5 etc if you stack all the commands in a certain order anyway, am I supposd to paste this into the avs file?

also, I've already got an IVTC's interim so all I need to do is anti alias using the sangnom filter.

am I better doing this?

LoadPlugin("p:\avsfilters\sangnom.dll")
avisource=("p:\anh\interim\anh_interim.avi")
sangnom(order=x,aa=x)

x being 0,1 or 2 for order and aa=x being the amount of antialiasing you wish to do.

I assume as my source is progressive that I need to use order=2 or do I run sangnom just as sangnom(aa=x)

and would I need to convert to yv12 for thisfilter to work? in which case I'd need avisynth 2.7
When a woman says yes, she means no - when she says maybe, she means no.

http://www.auky37.dsl.pipex.com/falconlogo_web.jpg
Author
Time
also try www.videohelp.com and www.doom9.org
Author
Time
The code format there is just an alternate way of doing things that makes it easier to do complex filtering with avisynth. Basically each one of those vthings () is a variable being assigned whatever is on the other side of the equal sign. As you can see, each line has several commands that are put together with periods.

Looking at v1 and v2, you can see that each one is slightly different, as v2 adds a few additional filters. The important thing to note is that both v1 and v2 are separate video feeds at this point. v3 takes these two video feeds and combines them. This same method of combining two videos is done once again with v4a, v4b, and v5. In the end, the script returns the finished video, v6.

To use this in your own script, all you need to do is copy and paste, and of course change the plugin and avisource locations. If you already have an IVTC method in your script, then just replace the "SeparateFields.SelectEvery(10,0,1,2,3,4,5,6,9).Weave.AssumeFPS(23.976)" portion of both v1 and v2 with your own method, using the same syntax.

I hope that makes sense to you. If not, maybe laserschwert can explain a little better.

My Projects:
[Holiday Special Hybrid DVD v2]
[X0 Project]
[Backstroke of the West DVD]
[ROTS Theatrical DVD]

Author
Time
so as I understand you Zion, schwerts script takes two versions of the capture and is overlaying them so you have half the fields from one, and half the fields from the other, then around V5 line combining the two back together into a single 23.97fps ivtc source which is anti aliased, color corrected and sharpened up?

so in my case, as I have a IVTC source file with jaggies, all I need to do is run sangnom as a normal filter

avisource=("p:\anh\interim\anh_interim.avi")
sangnom(order=x,aa=x)

rather than structuring it as schwert has done
When a woman says yes, she means no - when she says maybe, she means no.

http://www.auky37.dsl.pipex.com/falconlogo_web.jpg
Author
Time
Well, SangNom is originally intended to be used as a deinterlacing filter. This means that "order=0" should be used on "top field first" material, "order=1" on "bottom field first" material, and "order=2" on material where the two fields have been blended together.

Material that got IVTCed is neither of those, it's progressive. And to get the best result for progressive material, I felt that it looked best to use two instances of SangNom... one using "order=0" and one using "order =1".

I am using the v1, v2, v3, and so on to keep the script a little more cleaned up. So, your script would have to look like this:

v1 = AviSource("p:\anh\interim\anh_interim.avi").SangNom(order=0)
v2 = AviSource("p:\anh\interim\anh_interim.avi").SangNom(order=1)

v3 = v1.overlay(v2, opacity = 0.5)

return v3


You could add the "aa=" attribute to the SangNom-filters and play with the setting. For the results I posted in Zion's thread I didn't put it in (which left it at its default value... whatever it is). By the way, SangNom adds a little blur to the image, so it's good to add some sharpening (I prefer the LimitedSharpen-function) afterwards.

My script above looks so big, because it's not just antialiasing the clip, but IVTCing, de-ghosting, sharpening, color-correcting AND rescaling it as well.

Author
Time
ah gotcha. now I see. you have two instances to deal with the fields that would have been present, because in my case it's a progressive source material.

sharpening, I'll be using the PCvideo sharpener in virtualdub, although I hear good things of this limitedsharpen filter but can't seem to find it available as a dll or zip download.
When a woman says yes, she means no - when she says maybe, she means no.

http://www.auky37.dsl.pipex.com/falconlogo_web.jpg
Author
Time
oops, forgot to ask as well.

can this code of yours be combined with other standard avisynth stuff.

so for example

I could crop my progressive or even an interlaced source BEFORE or after using standard control lines? or must this script be run exclusively without other command switches after the usual loadplugin lines?
When a woman says yes, she means no - when she says maybe, she means no.

http://www.auky37.dsl.pipex.com/falconlogo_web.jpg
Author
Time
You can combine my script with more AviSynth-stuff... of course. But it's best to apply other stuff AFTER antialiasing it. So instead of putting return v3 at the end, it would be something like return v3.Levels(xxx).Tweak(xxx).Crop(xxx).LanczosResize(xxx) and so on.

Regarding LimitedSharpen, look into Zion's thread. I've posted everything you need in there.
Author
Time
well once I'd figured out I had version 2.5.2 avisynth which doesn't support overlay and downloaded 2.5.5 it works. bloody marvellous too.

screenies to come, but sangnom in combination with this script has all but eliminated my jaggies so thanks a bunch laserschwert, without you I was ready to just accept the jaggies as being impossible to eliminate and encoding.

find below my master script

#Star Wars Episode IV : A New Hope Master Script

#Plugins

LoadPlugin("h:\avsfilters\sangnom.dll")

#Source Files

v1 = AviSource("p:\anh_source_cropped.avi").ConvertToYV12().SangNom(order=0).bicubicresize(720,274)
v2 = AviSource("p:\anh_source_cropped.avi").ConvertToYV12().SangNom(order=1).bicubicresize(720,274)
v3 = v1.overlay(v2, opacity = 0.5)

#Add pre-anamorphic borders
v4 = v3.AddBorders(0,45,0,45)

#Add Greedo mos eisley subtitles
v5 = v4.Subtitle("Going somewhere, Solo?", first_frame=70640, last_frame=70680, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5).Subtitle("It's too late.", first_frame=70808, last_frame=70847, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

v6 = v5.Subtitle("You should have paid him when you had the chance.", first_frame=70855, last_frame=70913, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5).Subtitle("Jabba's put a price on your head so large...", first_frame=70924, last_frame=70994, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

v7 = v6.Subtitle("...every bounty hunter in the galaxy will be looking for you.", first_frame=71006, last_frame=71073, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5).Subtitle("I'm lucky I found you first.", first_frame=71081, last_frame=71119, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

v8 = v7.Subtitle("If you give it to me, I might forget I found you.", first_frame=71191, last_frame=71270, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5).Subtitle("Jabba's through with you.", first_frame=71349, last_frame=71394, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

v9 = v8.Subtitle("He has no time for smugglers who drop their shipments...", first_frame=71418, last_frame=71506, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5).Subtitle("..at the first sign of an Imperial cruiser.", first_frame=71514, last_frame=71550, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

v10 = v9.Subtitle("You can tell that to Jabba. He may only take your ship.", first_frame=71640, last_frame=71730, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5).Subtitle("That's the idea.", first_frame=71787, last_frame=71818, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

v11 = v10.Subtitle("I've been looking forward to this for a long time.", first_frame=71826, last_frame=71912, x=-1, y=334, font="BD Hanover", size=20, text_color=$ffFFff, spc=5)

#make it anamorphic
v12 = v11.bicubicresize(720,480).converttorgb24()

return v12

In virtualdub I then adjust levels and color etc but I'm going to add that to this script, so the only thing it will do in virtualdub is MSU sharpen. yes I'm afraid I caved in the end, picvideo @ gentlesharpen is quite nice but I'm afraid MSU still beats it for definition and lack of edge enhancement so I've bitten the bullet and gone for the meagre 4fps it gives me.

to be fair, before it was only giving 2fps so that is at least an improvement and indiciation that Avisynth has at least made a small saving.


my current virtualdub settings are.

vdubs own HSV adjust, hue +0.0, saturation x120.3%, value+0.0%
donald graft's red, green blue adjust, red 97, green 101, blue 100
vdubs own level adjust, input levels 12, 0.978, 255 luma ticked
donald graft's hue saturation intensity, hue 0, saturation 1.09, intensity 1.01

anysuggestions for getting the avisynth equivalents to these into a script so I only have to sharpen in vdub on a seperate pass?
When a woman says yes, she means no - when she says maybe, she means no.

http://www.auky37.dsl.pipex.com/falconlogo_web.jpg
Author
Time
Yet another forum... couldn't resist joining.

tellan, multiple comments about you process, the first being DON'T use VirtualDub filters. A little detail... you're final output is going to probably be a DVD or YUV12 4:2:0. You should try and capture in a YUV format and stick with YUV throughout the chain. VirtualDub is RGB only (1.6.1 experimental does support YUV but I'm not sure about the filters). Everytime you switch back and forth from YUV to RGB, you lose color detail. Additionally, definately lose that 'converttorgb24()' in your AviSynth filter chain. Bottom line is, get into YUV format as soon as you can and stick with it.

Next, you doing a 'crazy' amount of color correction and in essence, duplicating a lot of steps ... Playing with HSV twice, plus and RGB modifcation. I'd give either AviSynth's ColorYUV() or Tweak() functions a try ... It is safe to use the VirtualDub filters for quick feedback, but once again, stick with AviSynth for the real work.

When I get home from work tonight, I'll post my processing chain and a couple samples ... compared to what else I've seen on this site, it'll blown most you people's socks off .

------
oo_void
------
oo_void
Author
Time
By the way: Qualitywise it helps to give SangNom a little more vertical resolution to work with. So, before the SangNom filter, add a Lanczos4Resize to a height of about 600 px (that's what I did in my script). Horizontal size stays as it is.
Author
Time
I see the thing about rg24, that's a throwback from an old script when I was passing the script straight into tmpgenc and without it my YUY2 capture source wouldn't display correctly.

the reason I use virtual dub for one and only one sharpening pass is because I have yet to find a avisynth filter that can beat the quality of MSU smart sharpen for virtualdub. it's unfortunate but when I save the avi I save it as a huffyuv yuy2 file. which unfortunately means a conversion but gets it back to a yuy2 file.

if anyone can find a way to make msu smartsharpen work in avisynth then be my guest

the reason Ive used so many HSV and RGB filtering in Vdub is because again, no one filter completely accomplishes what my source needs to be corrected. the problem here is that the filters alter little aspects but all three are needed to accomplish the right look.

would be interested in seeing some of your shots, especially a comparison from source to finished article as this is important to determine just what the filters have done.

sharpening for me is the biggest issue which is why I am still using MSU.

asharp delivers too much edge enhancement when I get the same detail as MSU
warpsharp sucks
msharpen can get as good as MSU but then I lightened lines of resolution top and bottom of the picture.

limited sharpen interests me but I haven't tried it yet, nor can I find much info on it.

Laserschwert did do a lot on it in another thread which I have y et to look at.
When a woman says yes, she means no - when she says maybe, she means no.

http://www.auky37.dsl.pipex.com/falconlogo_web.jpg
Author
Time
Both LimitedSharpen and IIP (especially with the LimitedSharpen hack) will handle any sharpening tasks. Additionally, IIP uses Dust (great for removing the grain from the LD) and includes a couple of mask functions that suppress the color bleed you see in your transfers. Finally, IIP is an outstanding resizer ... Just make sure you're using MaskTools 1.5.4 if you plan on playing with them, and be sure and add a SetMemoryMax(128) (or higher) to the top of your script.
------
oo_void
Author
Time
Why are people using resizers?

<span class=“Italics”>MeBeJedi: Sadly, I believe the prequels are beyond repair.
<span class=“Bold”>JediRandy: They’re certainly beyond any repair you’re capable of making.</span></span>

<span class=“Italics”>MeBeJedi: You aren’t one of us.
<span class=“Bold”>Go-Mer-Tonic: I can’t say I find that very disappointing.</span></span>

<span class=“Italics”>JediRandy: I won’t suck as much as a fan edit.</span>

Author
Time
Ah, gotcha. I though people were just trying to correct the ratio or something. I just have to flip a few switches in Vegas, which is nice, because I don't need two masters then.

<span class=“Italics”>MeBeJedi: Sadly, I believe the prequels are beyond repair.
<span class=“Bold”>JediRandy: They’re certainly beyond any repair you’re capable of making.</span></span>

<span class=“Italics”>MeBeJedi: You aren’t one of us.
<span class=“Bold”>Go-Mer-Tonic: I can’t say I find that very disappointing.</span></span>

<span class=“Italics”>JediRandy: I won’t suck as much as a fan edit.</span>