digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Anyone try FMF? (http://www.digitalfaq.com/archives/avisynth/6725-avisynth-fmf.html)

ak47 11-15-2003 09:09 PM

Avisynth: Anyone try FMF?
 
I tried this avs import and I got some good results, able to compress more with the same quality. For more info look at http://forum.doom9.org/showthread.ph...threadid=56051 and http://forum.doom9.org/showthread.ph...0&pagenumber=4 for the guy that I modified my script
Code:

function Low_Motion_Filter(clip c)
{
c = FluxSmooth(c,param1_lm,-1)
c = UnFilter(c,param2_lm,param2_lm)
C = MergeChroma(c,blur(c,param3_lm))
c = MergeLuma(c,blur(c,param4_lm))
return c
}

function Medium_Motion_Filter(clip c)
{
c = FluxSmooth(c,param1_mm,param2_mm)
c = UnFilter(c,param3_mm,param3_mm)
c = MergeChroma(c,blur(c,param4_mm))
c = MergeLuma(c,blur(c,param5_hm))
return c
}

function High_Motion_Filter(clip c)
{
c = FluxSmooth(c,-1,param1_hm)
c = UnFilter(c,param2_hm,param2_hm)
c = MergeChroma(c,blur(c,param3_hm))
c = MergeLuma(c,blur(c,param4_hm))
return c
}

Mpeg2Source("C:\GOD1\VIDEO_TS\kenshin E1.d2v")

Telecide(order=1,guide=1,post=0).Decimate(cycle=5)
TomsMoComp(1,5,1)
undot()
Limiter()
BicubicResize(496, 320, 0, 0.6, 2, 9, 716, 462)
STMedianFilter(3, 3, 1, 1 )
FMF(param3_lm_min=1.0,param3_lm_max=1.2,param4_mm_min=1.2,param4_mm_max=1.35,param3_hm_min=1.35,param3_hm_max=1.58,param4_lm_min=0.07,
param4_lm_max=0.15,param5_mm_min=0.15,param5_mm_max=0.2,param4_hm_min=0.2,param4_hm_max=0.3,param1_lm_min=14,param1_lm_max=7,
param2_lm_min=-1,param2_lm_max=-4,param1_mm_min=7,param1_mm_max=5,param2_mm_min=3,param2_mm_max=7,param3_mm_min=-2,param3_mm_max=-4,param1_hm_min=8,param1_hm_max=14,param2_hm_min=-4,param2_hm_max=-8)
AddBorders(24, 80, 24, 80)
Limiter()

P.S. I barely messed with the thresholds so some might be strong some might be week.

Dialhot 11-15-2003 09:41 PM

That can be a way to find a new MA optimal script that do not have this ugly visible blur on high action scene.

Thank you for the tip.

ak47 11-16-2003 08:56 AM

Diahot, should the filtering of fluxsmooth and/or unfilter go before or after the Croma/Luma blur. Also is it better to blur the high motion or low motion scenes.

Dialhot 11-16-2003 09:39 AM

It's better to put them after. And it's better to blur high actoin scene as if yopu do on static one, your eye will see it immediatly while in action it doesn't have the time to distinguish the blur effect.

Encoder Master 11-16-2003 10:06 AM

QUESTION:

Can I use it in the optimal kwag script for DVD Sources.
And how looks it then?
Is it's realy good?

ak47 11-16-2003 10:33 AM

Encoder Master, it is basically a modify version of kwag's optimal script, that doesn't mean its better, all I really did is remove asharp(never really liked that), and change the adaptive temporal and spatial smoothing, and made the Chroma and Luma blur adaptive. It looks about the same in my eyes, but i still need to modify it, but to really know what it looks like you just have to try it out. And the speed is about the same on my computer.

P.S. I am using Shad0n modded version of Fluxsmooth

Encoder Master 11-16-2003 11:23 AM

If it's already the same why you don't use kwags script if there are no advantages?

ak47 11-16-2003 12:10 PM

The thing is its not that it will or won't beat kwag's script, I mainly introduce this script to show the power and control of FMF. But the thing is I really haven't had a fair test with the two scripts, and I need to iron out the quality and remaculate the compression, in other words I need to change the thresholds, especially unfilter. So it could be better it could be worse, I just have to mess with it some more.

P.S. I am the type of person that doesn't tell much of a difference with HDTV and standard TV's so if you want to help, I would be grateful

digitall.doc 11-16-2003 01:07 PM

Hi ak47:
after reading your post, and the thread you linked, I decided to give it a try. But I find it difficult to adjust, with so many parameters and thresholds,... Will it be possible to make a standard FMF like Kwag's MA?. And there's also the problem with some filters (memory leak).
For that reason I began with QMF, that seemed easier. I made a very simple script, with STmedianfilter(8,24,1,1) in low motion, STmedianfilter(3,3,1,1) in medium motion, and unfilter(-100,-100) in high motion. Yes, I know, very simple, heavy unfilter, but it was for test purpose. And happens that in scene changes, the frames are blurred during some frames, even if it's a slow motion scene :oops: .
I will make some more tests, and try FMF with your help. I believe that if you have many parameters, you can tune the script better to your needs,... but you also need to know how to adjust all these parameters :roll:. It could complement well the MA script.
A question: you say you made the script to work similar to MA script. Why are you using the same filters in low, medium and high action, instead of using unfilter in high action and temporalsoften in medium and low action, as in the MA script?. Maybe not temporalsoften in low action, better a spatial filter, but, what about temporalsoften in medium action, like in MA?. Sorry, maybe silly questions... :?:

Dialhot 11-16-2003 02:01 PM

Be carreful : using FMF can't lead to the same result than MA script !

In MA script, the internal settings of the filters are proportionnal to the action in the scene. And even _within the scene_, the more the action increase, the more the blurring is heavy.

With FMF we have only 3 category : low, medium, high filtering. There is not proportional increasing of the strenght of each filter.

Thus, you won't have the same behaviour.

fabrice 11-16-2003 03:13 PM

Hi,

What you discribe is the QMF script. With the FMF, as posted below, you have 3 levels, of course, but you can adjust the parameters according the difference-, just like the MA Script, for example:
Code:

# LOW MOTION FILTER FUNCTION
function Low_Motion_Filter(clip c)
{
c = UnFilter(c,param2_lm,param2_lm)
return c
}

# MEDIUM MOTION FILTER FUNCTION
function Medium_Motion_Filter(clip c)
{
c = UnFilter(c,param3_mm,param3_mm)
return c
}

# HIGH MOTION FILTER FUNCTION
function High_Motion_Filter(clip c)
{
c = UnFilter(c,param2_hm,param2_hm)
return c
}
...

# APPLYING FRAME BY FRAME ADAPTATIVE SPATIO-TEMPORAL SMOOTHER (USING FMF)
FMF(param2_lm_min=-2,param2_lm_max=-3,\
param3_mm_min=-3,param3_mm_max=-5,\
param2_hm_min=-5,param2_hm_max=-8,debug=false)

going from -2 to -8 depending on the motion.
The unfilter (-1, -1) line has a bug...

Salu2
fabrice

ak47 11-16-2003 03:36 PM

First off thank you Digitall.doc to try my script, second off the memory leak problem is solved by a previous thread I posted, http://www.kvcd.net/forum/viewtopic.php?t=7461 . Also I think that denoisers shouldn't be put in the FMF adaptive part, since if you add too much it will just make the picture too messed up, also you can only put up to 5 parameters. And I don't get what you say here
Quote:

What you describe is the QMF script. With the FMF, as posted below, you have 3 levels, of course, but you can adjust the parameters according the difference-
I thought if you put / it just is the same as not having that?

digitall.doc 11-16-2003 04:22 PM

Hi all:
Fabrice: FMF is adaptative, in a way, because you have two values for each filter parameter, but I donīt know if the value is applied linearly or in a motion adaptative way. Reading the doc that came with the script seems it adapts to motion... but how?, and can we decide, as in MA script, the value for each level of motion? (I don't know if I can explain myself well).
ak47: I think FAbrice was answering Dialhot when he states that QMF is not as FMF. Thanx for the feedback on fluxsmooth, but it's just one filter: what about the rest of filters?, won't we have the same problem with some of them (memory leak)?. And when you say you wouldn't put denoisers in the FMF adaptive part, what filters are you refering to?. Vaguedenoiser, Undot?. Because you put there Fluxsmooth, a spatial/temporal, "similar" to STMedianFilter or MipSmooth. Why not TemporalSoften, a spatial one?. Doubts, doubts,... :wink:
Note: after trying QMF, I tried FMF with your script, and didn't notice that problem in scenechanges. But I don't really know if making use of different filters in each motion level, will be the same. Time to test 8).
BTW: it would be very useful, if anyone knows how the motion stimation works in FMF, to "translate" it to the same "units" we use in the MA script, because we could apply the knowledge we have from MA script to FMF way of filtering. I mean: why do you use so little strength in unfilter in high action (in the MA script we even get to use unfilter(-100,-100), and in FMF just (-8,-8 ) :?: .

ak47 11-16-2003 06:12 PM

Quote:

donīt know if the value is applied linearly or in a motion adaptative way. Reading the doc that came with the script seems it adapts to motion... but how?
Just open the FMF****.avs and see how it works, it explains how each line/lines work like,
Quote:

# FULL MOTION FILTER FUNCTION
function FMF(clip c,
\ float "threshold_min",float "threshold_lm",float "threshold_hm",float "threshold_max",
\ float "threshold_sc_min",float "threshold_sc_max",int "distance_sc_min",
\ float "temporal_influence",bool "chroma",int "transition_length",bool "debug",
\ val "param1_lm_min",val "param1_lm_max",
\ val "param2_lm_min",val "param2_lm_max",
\ val "param3_lm_min",val "param3_lm_max",
\ val "param4_lm_min",val "param4_lm_max",
\ val "param5_lm_min",val "param5_lm_max",
\ val "param1_mm_min",val "param1_mm_max",
\ val "param2_mm_min",val "param2_mm_max",
\ val "param3_mm_min",val "param3_mm_max",
\ val "param4_mm_min",val "param4_mm_max",
\ val "param5_mm_min",val "param5_mm_max",
\ val "param1_hm_min",val "param1_hm_max",
\ val "param2_hm_min",val "param2_hm_max",
\ val "param3_hm_min",val "param3_hm_max",
\ val "param4_hm_min",val "param4_hm_max",
\ val "param5_hm_min",val "param5_hm_max")
{
Quote:

and can we decide, as in MA script, the value for each level of motion? (I don't know if I can explain myself well).
Look at Dialhot last post, he tells what is different in the MA script and the FMF script, if that is your question.
Quote:

Thanx for the feedback on fluxsmooth, but it's just one filter: what about the rest of filters?
Ya I haven't had a single problem with the script other then the memory leak on fluxsmooth, that got fixed by Shad0n.
Quote:

Vaguedenoiser, Undot?. Because you put there Fluxsmooth, a spatial/temporal, "similar" to STMedianFilter or MipSmooth. Why not TemporalSoften, a spatial one?.
Fluxsmooth is a smoother, STMedianFilter is a denioser(an maybe a smoother, but I just pull this out of my previous thoughts on threads I read, correct me if I am wrong), and same with MipSmooth.
Quote:

Note: after trying QMF, I tried FMF with your script, and didn't notice that problem in scenechanges. But I don't really know if making use of different filters in each motion level, will be the same.
FMF and QFM are very similar to the way the work, the thing that's different is FMF has more options, and a different method.
Quote:

Time to test
I am going to do that too :D
Quote:

BTW: it would be very useful, if anyone knows how the motion stimation works in FMF, to "translate" it to the same "units" we use in the MA script, because we could apply the knowledge we have from MA script to FMF way of filtering. I mean: why do you use so little strength in unfilter in high action (in the MA script we even get to use unfilter(-100,-100), and in FMF just (-8,-8 )
The best way to know is to ask the guy who made it, but he hasn't been on for a while so you might not get a respond.

fabrice 11-17-2003 12:39 AM

Hi,

this would be the MA script translated to FMF:
Code:

# LOW MOTION FILTER FUNCTION
function Low_Motion_Filter(clip c)
{
c=TemporalSoften(c, param1_lm, param2_lm, param3_lm, 1, 1)
return c
}

# MEDIUM MOTION FILTER FUNCTION
function Medium_Motion_Filter(clip c)
{
c = UnFilter(c,param1_mm,param1_mm)
return c
}

# HIGH MOTION FILTER FUNCTION
function High_Motion_Filter(clip c)
{
c = UnFilter(c,param1_hm,param1_hm)
return c
}


## Main section and static filters ###
#
Mpeg2Source("Your_D2V_Source_Here")
#
undot()
Limiter()
asharp(1, 4)
GripCrop(Your_GripCrop_Parameters_Here)
GripSize(resizer="BicubicResize")
STMedianFilter(3, 3, 1, 1 )
MergeChroma(blur(1.50))
MergeLuma(blur(0.1))
#
#

## Linear Motion Adaptive Filtering ##
#
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to
# very static scenes, and apply variable blur on moving scenes.

SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2

FMF(threshold_lm=SwitchThreshold, threshold_hm=20,transition_length=1,\
param1_lm_min=6,param1_lm_max=round(2/SwitchThreshold),\
param2_lm_min=3,param2_lm_max=round(1/SwitchThreshold),\
param3_lm_min=4,param3_lm_max=round(3/SwitchThreshold),\
param1_mm_min=-2*SwitchThreshold,param1_mm_max=-40,\
param1_hm_min=-40,param1_hm_max=-100,\
debug=false)

#
#
#

GripBorders()
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()

And digitall.doc, you're right: I was answering to Dialhot...

Salu2
Fabrice

digitall.doc 11-17-2003 07:18 AM

Hola Fabrice:
I find your proposal script very interesting, trying to emulate what we do in the MA. But there are several things that may be improved:
- instead of applying two levels of filtering (you really just apply temporalsoften to lomotion and unfilter in the rest of situations), we could adjust thresholds for Low, medium and high motions, and employ three different set of filters. That is: in low motion we could use DUP for instance, or heavy temporal filtering, as we do heavy spatial in high motion.
- I see you tried to reproduce motion adaptive in unfilter and temporalsoften in you script, making use of SwitchThreshold value. But as you know, SwitchThreshold is a constant value. In the MA script we make use of nf, than change from frame to frame. I will post later (now at work, you see, working hard today :twisted: ) a script I made trying to reproduce MA in FMF. But I find a problem: I doīn't know how FMF stimates motion, to adapt the filtering to motion.
Hi ak47, and thank you for your complete answer. But still questions :?: :
- I still don't know how FMF applies motion stimation to the filtering, and how selects a value between min and max parameter value. Your script capture just shows the parameters, not how they work
- I already read Dialhot answer, but in FMF I think that apart from being three motion levels, it applies the filtering strengh between min and max in each level, supossedly adapted to motion (isn't it?).
- If I understand you well, you shouldn't put filters like vaguedenoiser, temporasoften or mipsmooth in the FMF. But, why not?. Do you think they'll be useless in this way?. I remember we tried vaguedenoiser in the MA and worked well (but too slow, and not much better than MA alone), and I've tried mipsmooth instead of stmedianfilter, also good looking (nut out of the adaptive part of the script). What's your opinion?. Maybe we could give it a try, as soon as you learn how FMF works (thresholds, motion stimate, ...)
- Has ever been "this guy" in the forums?. He could maybe help us.
I find it interesting, similar to the MA script, but with the possibility of making use of 3 levels of motion, with several filters each, and a different approach to motion stimation (I read in the script, apart from YDifferenceToNext(), also UDifferenceToNext and VDifferenceToNext and so). Maybe too much adaption, too much filters,... :roll:
Back to work. Wait your answers, opinions, ideas,...

fabrice 11-17-2003 02:01 PM

Hi digitall.doc,

The purpose of my previous post was to show how to 'implement' the MA script with this FMF script. That's not what I'm using...

Just right now, I'm trying to use TemporalSmoother to blur in high motion scene, like this:

Code:

# LOW MOTION FILTER FUNCTION
function Low_Motion_Filter(clip c)
{
c = Temporalsoften(c, 4,param1_lm,param1_lm*2,mode=2,scenechange=10)
return c
}

# MEDIUM MOTION FILTER FUNCTION
function Medium_Motion_Filter(clip c)
{
c = Temporalsoften(c, 3,param1_mm,param1_mm*2,mode=2,scenechange=10)
return c
}

# HIGH MOTION FILTER FUNCTION
function High_Motion_Filter(clip c)
{
c = Temporalsoften(c, 2,param1_hm,param1_hm*2,mode=2,scenechange=10)
return c
}
...
FMF(threshold_max=25,\
param1_lm_min=3,param1_lm_max=6,\
param1_mm_min=7,param1_mm_max=18,\
param1_hm_min=19,param1_hm_max=48,\
debug=false)

and I like the result, as in high motion scene, the low motion part of the picture look better than using unfilter...

To know which value applying, the FMF script, you have a parameter called debug... Il calculate the value dividing the parameter difference por the levels difference...

Salu2
Fabrice

digitall.doc 11-17-2003 03:06 PM

Hi all, Hi fabrice:
first of all, sorry for being so like a *** in the *ss :oops: , but I want to know if FMF really worth the effort to learn its function (I feel strange writing you in my bad English, but this way everybody can participate here).
Your script looks nice. Do you employ it in the MA script, substituting the adaptive part?. You're right when you say it will make in high motion scenes, not to blur too much the quiet parts of the scene, that is a trouble in MA script.
I have a doubt on your TempotalSoften parameters, and as I cannot get in avisynth.org web (page down?), I ask you. In the MA script, below threshold (i.e. low motion), the values for radius vary between 1-6 (similar to your script), but luma and chroma vary between 0.5-very high (1/nf), and 1.5-very high (3/2f), isn't it?. Why are using this "low" values?. I guess your answer: use it because like how it looks, but, is the final clip pretty compressed?. Donīt you use unfilter at all, that gives good compression?.
Well, i tried a script to spatial filter in low motion, and similar to MA in medium and high motion:
Code:

function Low_Motion_Filter(clip c)
{
c = STMedianFilter(c,round(param1_lm),round(param1_lm),0,0)
c = UnFilter(c,param2_lm,param2_lm)
c = MergeChroma(c,blur(c,param3_lm))
c = MergeLuma(c,blur(c,param4_lm))
return c
}

function Medium_Motion_Filter(clip c)
{
c = TemporalSoften(c,round(param1_mm),round(param2_mm),round(param5_mm),1,1)
c = UnFilter(c,param3_mm,param3_mm)
c = MergeChroma(c,blur(c,param4_mm))
c = MergeLuma(c,blur(c,0.2))
return c
}

function High_Motion_Filter(clip c)
{
c = FluxSmooth(c,-1,param1_hm)
c = UnFilter(c,param2_hm,param2_hm)
c = MergeChroma(c,blur(c,param3_hm))
c = MergeLuma(c,blur(c,param4_hm))
return c
}
........
FMF(param3_lm_min=1.0,param3_lm_max=1.2,param4_mm_min=1.2,param4_mm_max=1.35,\
param3_hm_min=1.35,param3_hm_max=1.58,param4_lm_min=0.07,param4_lm_max=0.15,\
param5_mm_min=1.5,param5_mm_max=255,param4_hm_min=0.2,param4_hm_max=0.3,\
param1_lm_min=2,param1_lm_max=5,param2_lm_min=2,param2_lm_max=-2,param1_mm_min=1,\
param1_mm_max=6,param2_mm_min=0.5,param2_mm_max=255,param3_mm_min=-2,\
param3_mm_max=-4,param1_hm_min=8,param1_hm_max=14,param2_hm_min=-4,\
param2_hm_max=-80)

But I'm not very happy with the results. Two problems: when any action, unfilter blurs a lot (it's a problem of motion thresholding, I don't know how to adjust motion levels), and I think is far slow than MA script.
How can I adjust these parameters: motion threshold, scene change threshold,... (some even I don't know what are they used for)?. I did't understand your explanation on debug.
...But, don't worry: at last I'll get to understand it (just slow learning :lol: )

fabrice 11-17-2003 03:45 PM

Hi,

Quote:

I feel strange writing you in my bad English, but this way everybody can participate here
I was thinking just the same! :)
Quote:

Do you employ it in the MA script, substituting the adaptive part?.
As I find the MA script a bit too blurry, I'm using a script of my own, based on the "old Optimal Script". :)

As I said, I'm still working on this script, and the first thing is to try make lower the file size, but it's not too bad: for the moment, just 8% too big (compared to the MA Script, but the picture is a lot sharper!). Still some jo to do! :)

IOn you're script, I think you're duplicating the blur, with unfilter and blur... Try with just one, to see the effect. And about the debug thing, try adding debug=true as last parameter, and you'll see what I mean.

Salu2
Fabrice

Jellygoose 11-17-2003 03:46 PM

8O
Wouldn't it be a better idea to use Spatial Filters for High Action Parts and Temporal Smoothers for still parts? I thought Temporal Smoothing in High Action parts leads to unwanted "picture smearing" and ghost images...

I actually don't see how this "3 level motion adaptive smoothing" can beat our linear motion adaptive filtering at all...

Please share your thoughts!


All times are GMT -5. The time now is 07:27 PM  —  vBulletin Đ Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.