Log in

View Full Version : Dealing with Hybrid Video and Filters


zilog jones
2nd January 2005, 22:40
I've come across this issue a few times with some analogue captures of shows/ad's/etc., where it's mostly progressive (PAL) but there's some short part of it that's interlaced, e.g. some special effect or scrolling credits. The thing is I'm using temporal and spatial smoothers. I know I can do that SeparateFields malarky, but if I'm not mistaken these don't work as well when used on separate fields - a bit of a waste when there's only a few seconds of interlaced video in a half-hour clip!

So, is there any way I can make a script so for a certain range of frames (which I can set manually) it can do filters by separating fields, and for the rest of the clip it'll do things normally?

stickboy
2nd January 2005, 23:49
See this thread:
How to process interlaced and the final result to be interlaced (http://forum.doom9.org/showthread.php?s=&threadid=86394)

You can use any of the mentioned techniques in combination with ApplyRange. For example:

function InterlacedFilter(clip c)
{
c
JDL_UnfoldFieldsVertical(true)
Filter1()
Filter2()
Filter3()
JDL_FoldFieldsVertical(true)
return last
}

AVISource("someVideo.avi")
ApplyRange(100, 200, "InterlacedFilter")

zilog jones
3rd January 2005, 01:27
Thanks for the ApplyRange thing - it's a lot simpler than I thought!

But after reading that other thread, I'm confused now! So... temporal filters can just be used normally on interlaced video? Is part 7.2.11 of the Capture Guide (http://www.doom9.org/capture/postprocessing_avisynth.html) wrong then? It says to treat temporal filters just like spatio-temporal ones...

stickboy
3rd January 2005, 01:48
The guide merely says:
But when using a spatio-temporal smoother (or just a temporal smoother), this produces incorrect results.where "this" refers to the SeparateFields + Filter + Weave method.

If you don't use SeparateFields at all, you can apply a temporal filter directly.

(This really isn't that complicated; you can reason out what the filter is doing.)

What the guide says doesn't hurt; it should produce the same results. Separating the fields is just an unnecessary step. Furthermore, most people probably do some spatial filtering too.

I suppose it would be nice if the guide mentioned the unfold/fold method or scharfis_brain's method. It seems like these questions have been coming up a lot recently...

zilog jones
3rd January 2005, 02:41
I always thought it was implying you should do the

SeparateFields()
even = SelectEven(last).Filter(...)
odd = SelectOdd(last).Filter(...)
Interleave(even, odd)
Weave()

thing for temporal smoothers as well as spatio-temporal ones. It's a bit misleading - it should comfirm that nothing like this needs to be done for temporal filters at all.

Wilbert
3rd January 2005, 10:34
What the guide says doesn't hurt; it should produce the same results. Separating the fields is just an unnecessary step.
Furthermore, most people probably do some spatial filtering too.

I suppose it would be nice if the guide mentioned the unfold/fold method or scharfis_brain's method. It seems like these questions have been coming up a lot recently...
I will correct/change it the next time. Thx!

Mug Funky
4th January 2005, 05:17
here's what i've been doing because i'm sick and tired of typing the endless separatefields().select.... stuff:

function fieldfilter (clip c, string filter)
{
even=c.separatefields().selecteven()
odd=c.separatefields().selectodd()
eval("even=even."+filter)
eval("odd=odd."+filter)

interleave(even,odd).weave()
}

usage:

fieldfilter("degrainmedian()")

just use any filter you like, but put it in quotes.

stickboy
4th January 2005, 06:39
Not any filter you like. PixieDust won't work with it, which is why there are endless threads about this topic (and which is why most of them usually involve Dust).

It's also the reason why I wrote JDL_UnfoldFieldsVertical/JDL_FoldFieldsVertical in the first place.