Log in

View Full Version : Avisynth-proper denoising interlace source


Serbianboss
18th June 2006, 19:32
I read many articles on doom9 forum, i also read this quide http://www.doom9.org/index.html?/capture/postprocessing_avisynth.html but i something dosn't understand about applaying denoisers to interlaced clip.

All my captures are DV avi(bottom field first) captured via Canopus 110. So i want to apply noise filters and want that my output be also interlaced(for making DVD)

1. First of all, i read that if we want to apply just spatial filter that we need to SeparateFields()/some noise filter/Weave().
For example if we use vague denoiser which is spatial filter, does we just write VagueDenoiser(threshold=4,method=1,interlaced=true) instead SeparateFields()...
Does this interlaced=true can change Separate fileds....Wave()..

2. How in script i can put two filters(spatial and temporal) ?
For example:vague denoiser and peach smooter (i know that this filter is spatial-temporal) or Degrainmedian and vague denoiser.

For example does is correct to write:

...
degrainmedian(interlaced=true)
vague denoiser(interlaced=true)
Or i must to put somewhere SeparateFields()...Wave()...

Can anyone explain what way is correct, does i can work with interlaced=true or i always must to write SeparateFields()...Wave()... when working with interlaced material.

I again mention that i want to keep interlaced because i making DVD.

thanks for attention.

Wilbert
18th June 2006, 20:05
1. First of all, i read that if we want to apply just spatial filter that we need to SeparateFields()/some noise filter/Weave().
For example if we use vague denoiser which is spatial filter, does we just write VagueDenoiser(threshold=4,method=1,interlaced=true) instead SeparateFields()...
Does this interlaced=true can change SeparateFields....Weave()..
You should look in the corresponding documentation whether a (spatial) filter has an interlaced setting. If so, you can use that when your input is interlaced. VagueDenoiser has such a setting. Thus the script


VagueDenoiser(threshold=4,method=1,interlaced=true)

is fine. If it hasn't such a setting, i already explained you what to do.

So this is correct too:

degrainmedian(interlaced=true)
vaguedenoiser(interlaced=true)

Boulder
18th June 2006, 21:20
It would be much easier for you if you bobbed the video, denoised and then reinterlaced. You wouldn't need to think about the different ways different filters handle interlaced material.

Serbianboss
19th June 2006, 01:35
thanks for answers.

1. I found that combination Peachsmoother and vague denoiser give excellent result. But i have one problem. When try


...
SeparateFields()
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 100)
Weave()
VagueDenoiser(threshold=4, method=1, nsteps=6,interlaced=true) i have little blinking results on every second.

Also when try

...
SeparateFields()
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 100)
VagueDenoiser(threshold=4, method=1, nsteps=6,interlaced=true)
Weave()
i have that blinking

And even i just use PeachSmoother with Separatefields() and Wave i have the same problem with that blinking.

But when i use Peachsmoother and vague denoiser wihout Separatefields() and wave, everything is OK.


...
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 200)
VagueDenoiser(threshold=4, method=1, nsteps=6,interlaced=true)

So my question is: Can i leave last script, or must to put something for peachsmoother.
I dont find anything about peachsmooter and his interlacing.

2. It would be much easier for you if you bobbed the video, denoised and then reinterlaced. You wouldn't need to think about the different ways different filters handle interlaced material.

Can you post sample script for this?

Boulder
19th June 2006, 08:36
For example this thread : http://forum.doom9.org/showthread.php?t=86394

Bob can (and should) be replaced by a smart bobber, for example LeakKernelBob (included in LeakKernelDeint.dll, faster, lower quality) or TDeint's mode 1 (slower, better quality).

communist
19th June 2006, 11:45
For a Bob().Filter().Reinterlace() approach it is usually suggested here to use a smart bobber instead of plain bob.
However just recently I've seen a suggestion here in some thread (by foxyshadis or stickboy?) that Bob(0,0) doesnt touch the existing lines in anyway (lossless transfer with interpolated lines inbetween). I've played around with Bob(0,0).Reinterlace() and it is lossless compared to plain Bob().Reinterlace() and way faster than TDeint(mode=1).

I didn have time yet to test denoisers between bob(0,0) and reinterlace but I *think* this should be a faster (and in no way less accurate) way to filter interlaced material. Since we're going to discard interpolated lines in the reinterlacing step anway does it really matter in what way we created them in the first step - be that dumb (bob) or smart (tdeint etc.)?

Boulder
19th June 2006, 12:12
This was discussed a while ago, I don't remember what the conclusion was though. I think FredThompson asked something about it. EDIT: here it is, http://forum.doom9.org/showthread.php?t=108352

Bob(0,x) is lossless, as apparently is LeakKernelBob(order=n,threshold=0) as well but it's faster.

Serbianboss
19th June 2006, 13:10
I try this script(with help of manono).
Again all my captures is DV avi interlaced(bottom field first), and want to make interlaced DVD.

LoadPlugin("degrainmedian.dll")
LoadPlugin("LeakKernelDeint.dll")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
crop(8,4,-8,-12)
AssumeBFF() //does i need this or no
ConvertToYUY2(Interlaced=True) //i must first put ConvertToYUY2 because my captures are RGB24
LeakKernelBob(Order=0)
degrainmedian(limitY=5,limitUV=7,mode=0)
SeparateFields()
SelectEvery(4,0,3) //i think that this is proper instead (4,1,2)
Weave()
AddBorders(8,8,8,8)

How to us script look like?

If anybody think that something need to change please say.

I think that i must to put SelectEvery(4,0,3), because when i put SelectEvery(4,1,2) i have jerky output.

Boulder
19th June 2006, 13:16
Why do you get RGB24 out of the DV files, what codec do you use for decoding the stream?

It's safe to use AssumeBFF(), it'll ensure Avisynth knows the field order. You should place another AssumeBFF() before SeparateFields for the same reason. I'd also lower the LeakKernelBob threshold to 3 or 4.

If you use SelectEvery(4,1,2), the output field order will actually be TFF so that might be the reason for the jerky output if you didn't set the field order correctly in the encoder.

Serbianboss
19th June 2006, 15:00
I am using Panasonic DV codec for decoding.

I now place one more AssumeBFF() before SeparateFields.


I'd also lower the LeakKernelBob threshold to 3 or 4.

What does mean and how to do that ?

So my final script looks like:

LoadPlugin("degrainmedian.dll")
LoadPlugin("LeakKernelDeint.dll")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
crop(8,4,-8,-12)
AssumeBFF()
ConvertToYUY2(Interlaced=True)
LeakKernelBob(Order=0)
degrainmedian(limitY=5,limitUV=7,mode=0)
AssumeBFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
AddBorders(8,8,8,8)

Anything to change ?

Boulder
19th June 2006, 15:31
I am using Panasonic DV codec for decoding.

You could install Cedocida (see the DV subforum's sticky thread) to get the native colorspace (I assume you have a PAL camera) which is YV12. I'd also crop after bobbing to be safe.

If you read the LeakKernelDeint documentation supplied in the package, you'd see that threshold can be set with the parameter threshold.

Serbianboss
19th June 2006, 16:04
I everything capture via canopus 110, so my format is PAL.
With your sugesstion i remove crop after bobbing.

You could install Cedocida (see the DV subforum's sticky thread) to get the native colorspace (I assume you have a PAL camera) which is YV12. I'd also crop after bobbing to be safe.

Is that mean that my DV can be YUY2 instead RGB(with panasonic codec) ? And if can i dont need to write converttoyuy2().

I dont realy understand LeakKernelDeint threshold. What you mean when you said "threshold can be set with the parameter threshold"

My final script looks like:
LoadPlugin("degrainmedian.dll")
LoadPlugin("LeakKernelDeint.dll")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
AssumeBFF()
ConvertToYUY2(Interlaced=True)
LeakKernelBob(Order=0)
crop(8,4,-8,-12)
degrainmedian(limitY=5,limitUV=7,mode=0)
AssumeBFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
AddBorders(8,8,8,8)

Boulder
19th June 2006, 16:08
LeakKernelBob has a parameter called threshold. So you would write LeakKernelBob(order=0,threshold=3).

PAL DV is YV12 so you should convert to YUY2 right before SeparateFields. This is if you install Cedocida and set it to output YV12. You can also use ffdshow for decoding DV and output YV12.

Serbianboss
19th June 2006, 16:22
Ok, if it is better i will put LeakKernelBob(order=0,threshold=3).

I am just wondering what would be if i just stay LeakKernelBob(order=0) ?

Next time i will try cedocida codec. Does picture will be better with Cedocida?

thanks for quick answers

Boulder
19th June 2006, 16:40
The default threshold is 10, which is way too big IMO. The image quality should be better with Cedocida (or ffdshow) because there will be no unnecessary colorspace conversions. It will also make your script faster.

Serbianboss
19th June 2006, 20:09
So, you suggest that threshold be between 3 or 4.

One more thing,

you said that my script is ok,but i want to try with Tdeint deinterlance filter because many people said that Tdeint is better but slower.

Which parametar i can use for Tdeint filter in my script for DVD?

LoadPlugin("degrainmedian.dll")
LoadPlugin("LeakKernelDeint.dll")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
AssumeBFF()
ConvertToYUY2(Interlaced=True)
LeakKernelBob(Order=0)
crop(8,4,-8,-12)
degrainmedian(limitY=5,limitUV=7,mode=0)
AssumeBFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
AddBorders(8,8,8,8)

Boulder
19th June 2006, 20:10
Simply TDeint(mode=1).

Serbianboss
19th June 2006, 20:20
thanks, i will try now and tell the result:)

Does i need for Tdeint to set order, or i just to leave with TDeint(mode=1) ?

Boulder
19th June 2006, 20:24
TDeint gets the order from Avisynth (that's why the AssumeBFF() should be used), but it does have the same order parameter as LeakKernelBob.

Serbianboss
19th June 2006, 20:39
What you suggest, to use or not to use order=0 with mode=1 ?

Boulder
19th June 2006, 20:44
You don't need the parameter if you use AssumeBFF().

Serbianboss
19th June 2006, 23:33
If for Tdeint dosnt need parametar order=0 (because AssumeBFF), so can i use same thing for LeakKernelBob(or i must put here some value) ?

I try with Tdeint and i dont see "any" approvment(is very slow). So i will stick with LeakKernelBob.

Boulder
19th June 2006, 23:47
Read the documentation - or try it out..

Serbianboss
20th June 2006, 00:01
I read documentation and nothing found about AssumeBFF.

I know that AssumeBFF is important, but i am little confused when with LeakKernelBob i use AssumeBFF and order=0 and with Tdeint i use AssumeBFF and dont use order=0.

foxyshadis
20th June 2006, 06:14
Leak wrote his plugin before AssumeTFF/AssumeBFF existed, thus it doesn't use them. (Maybe someday I'll recompile it with support.) Or you can just add this if it's so important:

function LeakKernelBobF (clip c, int threshold, bool sharp) {
threshold=default(threshold,10)
sharp=default(sharp,false)
c
order = getparity? 1 : 0
leakkernelbob(order=order,threshold=threshold,sharp=sharp)
}

You can even customize your defaults that way. But please, it's not something to make a big deal out of.

Boulder
20th June 2006, 08:32
I know that AssumeBFF is important, but i am little confused when with LeakKernelBob i use AssumeBFF and order=0 and with Tdeint i use AssumeBFF and dont use order=0.
You can use order=x with TDeint, it's just not needed when you use AssumexFF().

Fizick
20th June 2006, 20:28
Bobbing is not always the bst method. At last for speed.
Good old selecteven-selectodd exists.
http://www.avisynth.org/InterlacedSmoothing

Serbianboss
20th June 2006, 22:21
I found excellent combination with peachsmoother and vague denoiser. With combination this two filter(with high parametars) i get remarkable results(for getting DVD)

This is scripts for making interlacing DVD
Script 1
LoadPlugin("VagueDenoiser.dll")
LoadPlugin("PeachSmoother")
LoadPlugin("LeakKernelDeint.dll")
avisource("C:\Documents and Settings\Desktop\vhscapture.avi")
crop(8,4,-8,-12)
AssumeBFF()
ConvertToYUY2(Interlaced=True)
LeakKernelBob(Order=0,threshold=3)
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 200)
VagueDenoiser(threshold=4, method=1, nsteps=6)
AssumeBFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
AddBorders(8,8,8,8)

But i want to make same script without deinterlacing and back as interlaced.

i try like this:
Script 2
LoadPlugin("VagueDenoiser.dll")
LoadPlugin("PeachSmoother")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
ConvertToYUY2(interlaced=true)
crop(8,4,-8,-12)
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 200)
VagueDenoiser(threshold=4, method=1, nsteps=6,interlaced=true)
AddBorders(8,8,8,8)

Everything is ok(video material) but i am interesting does peachsmoother can use without separating fields,because when i use separating fields i get video which is blinking on every 1-2 seconds.

So question is, does is correct to leave script 2 like that or i must something to change ?

Fizick
20th June 2006, 23:02
Script 2 is NOT correct using peachsmoother.
See my link above.

Serbianboss
20th June 2006, 23:19
But how in that function to use both noise filters(peach and vague) ?

foxyshadis
21st June 2006, 00:02
If you want to use a filter that doesn't have interlaced support, you can't use it without bobbing or separatefields. Thus if you don't do either you're restricted to only filters that have interlaced support.

Serbianboss
21st June 2006, 09:29
So, Peachsmoother isnt "interlaced" filter ?

I am using this script(with bobbing and little sharping) for applying peachsmoother and vague denoiser and have excellent results.

LoadPlugin("VagueDenoiser.dll")
LoadPlugin("PeachSmoother")
LoadPlugin("LeakKernelDeint.dll")
LoadPlugin("MaskTools.dll")
import("C:\Program Files\AviSynth 2.5\plugins\limitedsharpen.avs")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
crop(8,4,-8,-12)
AssumeBFF()
ConvertToYUY2(Interlaced=True)
LeakKernelBob(Order=0,threshold=3)
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 200)
VagueDenoiser(threshold=4, method=1, nsteps=6)
limitedsharpen()
AssumeBFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
AddBorders(8,8,8,8)

But i just try to make some script without bobbing for using peachsmoother. I try with separatefields()/PeachSmoother()/Weave() but i have problem with blinking video(not jerky).

Serbianboss
21st June 2006, 14:44
I am intersting which parametars suggests for low, medium, and high parametars for limited sharpen filter.

I am using this script for making DVD:

LoadPlugin("VagueDenoiser.dll")
LoadPlugin("PeachSmoother")
LoadPlugin("LeakKernelDeint.dll")
LoadPlugin("MaskTools.dll")
import("C:\Program Files\AviSynth 2.5\plugins\limitedsharpen.avs")
avisource("C:\Documents and Settings\Nenad\Desktop\111.avi")
crop(8,4,-8,-12)
AssumeBFF()
ConvertToYUY2(Interlaced=True)
LeakKernelBob(Order=0,threshold=3)
PeachSmoother(NoiseReduction = 80, Stability = 25, Spatial = 200)
VagueDenoiser(threshold=4, method=1, nsteps=6)
limitedsharpen()
AssumeBFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
AddBorders(8,8,8,8)