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!

fabrice 11-17-2003 03:57 PM

Hi Jellygoose,

The problem of the unfilter linear filtering is that it blur the whole image, even if there is only a 'static' figure' in front of a moving scene.

The temporal filter, with a small radius gives a blurring effect, without ghosting (at least with what I tried). That's why I reduce the radius and increase the threshold with the motion...

I have to try mi script with the sample that generate CQMatic, to see the overall size...

Salu2
Fabrice

EDITED: with the overall sample, the difference is only 5%... It was 8% with a still scene...

digitall.doc 11-17-2003 05:57 PM

Wellcome Jellygoose,
I wrong the terms. I wanted to say, from what I've readin the forums, that it seems better temporal smoothing in low motion, and spatial smoothing in high motion. And I realise that I did it also wrong in my test script, with STMedianFilter set to spatial in low motion, instead of temporal.
I don't think it's a question to beat nothing, but to improve (if possible) the MA script. The 3 level motion (that are also linear, as far as I know) allows us to employ three different ways to filter at three levels, and employes a different approach to stimate motion. I don't know if with this method, with my limited knowledge, I will get to something. But I also didn't know if I could make a KVCD and if it worthed, and... yes, it does.
Do you think we could improve our scripts in any way?. To be better looking and more compressed. Don't you imagine a way we could make a three level filtering?.
Fabrice: you get a 5% bigger size file. If we decrease maximum unfilter value in the MA (maybe 80 instead of 100), the file size will grow, but high action will be less blurred. I think the point is getting similar or smaller size, less blurred... well, more or less, I think, ... :roll: don't know nothing.

ak47 11-17-2003 06:44 PM

Ok I did some testing and I actually was pretty impressed, its not a whole lot better but on high action scenes the blocky ness on lower bit rate is less noticeable. I tested them both with an average bit rate of 1000 in vbr mode, in other words MCE was wrong since the final size is 125mbs, this is on both videos. Also I tested it with an anime and kvcd format. The next will be my two scripts and size. Also I tested it without compression and saw the avs script, both look identical, I didn't see any quality loss due to the filtering.
Code:

nf =  0

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

Telecide(order=1,guide=1,post=0).Decimate(cycle=5)
TomsMoComp(1,5,1)
undot()
Limiter()
asharp(1, 4)
BicubicResize(496, 320, 0, 0.6, 2, 9, 716, 462)
STMedianFilter(3, 3, 1, 1 )
MergeChroma(blur(1.50))
MergeLuma(blur(0.1))

SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

AddBorders(24, 80, 24, 80)
Limiter()

function fmin( int f1, int f2) {
  return ( f1<f2 ) ? f1 : f2
}

This script took 1704.69s of 1441.94s an average of 1.2 times the movie.
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.25,param3_lm_max=1.4,param4_mm_min=1.4,
param4_mm_max=1.5,param3_hm_min=1.5,param3_hm_max=1.58,
param4_lm_min=0.08,param4_lm_max=0.14,param5_mm_min=0.14,
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=-5,param2_lm_max=-15,param1_mm_min=7,param1_mm_max=5,
param2_mm_min=3,param2_mm_max=7,param3_mm_min=-15,
param3_mm_max=-25,param1_hm_min=8,param1_hm_max=14,param2_hm_min=-25,param2_hm_max=-45)
AddBorders(24, 80, 24, 80)
Limiter()

This took 2070.63s of 1441.94s an average of 1.4 times the movie.
I could give someone the beginning part of the video, 4mbs worth, since it's a DVD off of TV caps (the quality is still DVD), but I think that is illegal so I am not going to unless I know first. Or you can just try it out yourself if you want to.
Any comments are welcome even if you think my script sucks.
P.S. Should this thread be moved to the optimal script page, since now were comparing the MA with another script.

audioslave 11-17-2003 08:09 PM

@ak47
I'm getting an syntax error when using your latest posted FMF script?! On line 36, column 0. That's the line that start with FMF... Any ideas on why? :roll: Do I need anything besides the filters for this script to work?

ak47 11-17-2003 08:32 PM

Sorry forgot to mention that the line FMF(*****) should all be one line, I paged the lines because I didn't want to thread to look weird.

audioslave 11-17-2003 08:35 PM

@ak47
Thanks mate! Now that error is gone, but... now I got another one - There is no function named FMF. What's this about?

EDIT: Nevermind. I read the Doom9 forum and downloaded the fmf.avs file. I just added "Import("D:\xxxxx\fmf-1.5b1.avs")" first in the script! :D

BTW The fmf.avs file looks like this (just copy it and paste it in Notepad or something and name the file "fmf-1.5b1.avs"):
Quote:

# FULL MOTION FILTER v1.5 b1 (10/07/2003) by HomiE FR (homie.fr@wanadoo.fr)

# 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")
{
# SETTING CHROMA MOTION ESTIMATION
chroma = default(chroma,false)
global chroma = chroma

# SETTING MOTION LEVELS THRESHOLDS
threshold_min = default(threshold_min,0.0)
threshold_lm = default(threshold_lm,(chroma == true) ? 4.0 : 5.0)
threshold_hm = default(threshold_hm,(chroma == true) ? 12.0 : 15.0)
threshold_max = default(threshold_max,(chroma == true) ? 16.0 : 20.0)
global threshold_min = threshold_min
global threshold_lm = threshold_lm
global threshold_hm = threshold_hm
global threshold_max = threshold_max

# SETTING MIN/MAX SCENE CHANGE THRESHOLDS
threshold_sc_min = default(threshold_sc_min,(chroma == true) ? 20.0 : 30.0)
threshold_sc_max = default(threshold_sc_max,(chroma == true) ? 40.0 : 60.0)
global threshold_sc_min = threshold_sc_min
global threshold_sc_max = threshold_sc_max

# SETTING MIN DISTANCE BETWEEN SCENE CHANGES
distance_sc_min = default(distance_sc_min,10)
global distance_sc_min = distance_sc_min

# SETTING TEMPORAL INFLUENCE
temporal_influence = default(temporal_influence,50.0)
global temporal_influence = temporal_influence

# SETTING MOTION LEVEL TRANSITION
transition_length = default(transition_length,10)
global transition_length = transition_length

# ENABLING/DISABLING DEBUG INFORMATION
debug = default(debug,false)
global debug = debug

# SETTING MIN/MAX LOW MOTION PARAMETERS
param1_lm_min = default(param1_lm_min,0)
param1_lm_max = default(param1_lm_max,0)
param2_lm_min = default(param2_lm_min,0)
param2_lm_max = default(param2_lm_max,0)
param3_lm_min = default(param3_lm_min,0)
param3_lm_max = default(param3_lm_max,0)
param4_lm_min = default(param4_lm_min,0)
param4_lm_max = default(param4_lm_max,0)
param5_lm_min = default(param5_lm_min,0)
param5_lm_max = default(param5_lm_max,0)
global param1_lm_min = param1_lm_min
global param1_lm_max = param1_lm_max
global param2_lm_min = param2_lm_min
global param2_lm_max = param2_lm_max
global param3_lm_min = param3_lm_min
global param3_lm_max = param3_lm_max
global param4_lm_min = param4_lm_min
global param4_lm_max = param4_lm_max
global param5_lm_min = param5_lm_min
global param5_lm_max = param5_lm_max

# SETTING MIN/MAX MEDIUM MOTION PARAMETERS
param1_mm_min = default(param1_mm_min,0)
param1_mm_max = default(param1_mm_max,0)
param2_mm_min = default(param2_mm_min,0)
param2_mm_max = default(param2_mm_max,0)
param3_mm_min = default(param3_mm_min,0)
param3_mm_max = default(param3_mm_max,0)
param4_mm_min = default(param4_mm_min,0)
param4_mm_max = default(param4_mm_max,0)
param5_mm_min = default(param5_mm_min,0)
param5_mm_max = default(param5_mm_max,0)
global param1_mm_min = param1_mm_min
global param1_mm_max = param1_mm_max
global param2_mm_min = param2_mm_min
global param2_mm_max = param2_mm_max
global param3_mm_min = param3_mm_min
global param3_mm_max = param3_mm_max
global param4_mm_min = param4_mm_min
global param4_mm_max = param4_mm_max
global param5_mm_min = param5_mm_min
global param5_mm_max = param5_mm_max

# SETTING MIN/MAX HIGH MOTION PARAMETERS
param1_hm_min = default(param1_hm_min,0)
param1_hm_max = default(param1_hm_max,0)
param2_hm_min = default(param2_hm_min,0)
param2_hm_max = default(param2_hm_max,0)
param3_hm_min = default(param3_hm_min,0)
param3_hm_max = default(param3_hm_max,0)
param4_hm_min = default(param4_hm_min,0)
param4_hm_max = default(param4_hm_max,0)
param5_hm_min = default(param5_hm_min,0)
param5_hm_max = default(param5_hm_max,0)
global param1_hm_min = param1_hm_min
global param1_hm_max = param1_hm_max
global param2_hm_min = param2_hm_min
global param2_hm_max = param2_hm_max
global param3_hm_min = param3_hm_min
global param3_hm_max = param3_hm_max
global param4_hm_min = param4_hm_min
global param4_hm_max = param4_hm_max
global param5_hm_min = param5_hm_min
global param5_hm_max = param5_hm_max

# INITIALIZING MOTION LEVEL
global motion_level = 0

# INITIALIZING SCENE CHANGE THRESHOLD/SCENE CHANGE POSITION
global threshold_sc = threshold_sc_min
global pos_sc = 0

# INITIALIZING OLD/NEW/END MOTION LEVELS FOR MOTION LEVEL TRANSITIONS
global motion_level_old = 0
global motion_level_new = 0
global motion_level_end = 0

# INITIALIZING MOTION LEVEL TRANSITION POSITION
global transition = 0

# INITIALIZING AVERAGE DIFFERENCE
global diff_avg = 0.0

# INITIALIZING LOW MOTION PARAMETERS
global param1_lm = param1_lm_min
global param2_lm = param2_lm_min
global param3_lm = param3_lm_min
global param4_lm = param4_lm_min
global param5_lm = param5_lm_min

# INITIALIZING MEDIUM MOTION PARAMETERS
global param1_mm = param1_mm_min
global param2_mm = param2_mm_min
global param3_mm = param3_mm_min
global param4_mm = param4_mm_min
global param5_mm = param5_mm_min

# INITIALIZING HIGH MOTION PARAMETERS
global param1_hm = param1_hm_min
global param2_hm = param2_hm_min
global param3_hm = param3_hm_min
global param4_hm = param4_hm_min
global param5_hm = param5_hm_min

# SETTING TEMPORAL RATIOS ACCORDING TO TEMPORAL INFLUENCE
global ti1 = Pow(temporal_influence/100,0.50)
global ti2 = Pow(temporal_influence/100,2.00)

# ENABLING/DISABLING CHROMA DIFFERENCE INFORMATION
global y_ratio = (chroma == true) ? 0.50 : 1.00
global uv_ratio = (chroma == true) ? 0.50 : 0.00

# SETTING PAST/PRESENT/FUTURE CLIPS
global clip_p2 = Trim(c,0,-2)+c
global clip_p1 = Trim(c,0,-1)+c
global clip = c
global clip_f1 = Trim(c,1,0)
global clip_f2 = Trim(c,2,0)

# SETTING OLD/NEW CLIPS FOR MOTION LEVEL TRANSITIONS
global clip_old = c
global clip_new = c

# GETTING OUTPUT RESOLUTION
width = Width(Low_Motion_Filter(clip))
height = Height(Low_Motion_Filter(clip))
global clip_resized = PointResize(clip,width,height)

# COMPUTING MOTION FILTER
c = ScriptClip(clip_resized,"MF(clip)")

# GETTING DIFFERENCES BETWEEN PAST/PRESENT/FUTURE FRAMES
c = FrameEvaluate(c,"global diff_f2 = y_ratio*YDifferenceFromPrevious(clip_f2) + uv_ratio*UDifferenceFromPrevious(clip_f2) + uv_ratio*VDifferenceFromPrevious(clip_f2)")
c = FrameEvaluate(c,"global diff_f1 = y_ratio*YDifferenceFromPrevious(clip_f1) + uv_ratio*UDifferenceFromPrevious(clip_f1) + uv_ratio*VDifferenceFromPrevious(clip_f1)")
c = FrameEvaluate(c,"global diff = y_ratio*YDifferenceFromPrevious(clip) + uv_ratio*UDifferenceFromPrevious(clip) + uv_ratio*VDifferenceFromPrevious(clip)")
c = FrameEvaluate(c,"global diff_p1 = y_ratio*YDifferenceFromPrevious(clip_p1) + uv_ratio*UDifferenceFromPrevious(clip_p1) + uv_ratio*VDifferenceFromPrevious(clip_p1)")
c = FrameEvaluate(c,"global diff_p2 = y_ratio*YDifferenceFromPrevious(clip_p2) + uv_ratio*UDifferenceFromPrevious(clip_p2) + uv_ratio*VDifferenceFromPrevious(clip_p2)")

return c
}

# MOTION ESTIMATION FUNCTION
function ME()
{
# SETTING SCENE CHANGE THRESHOLD ACCORDING TO AVERAGE DIFFERENCE
global threshold_sc = PS(threshold_sc,threshold_sc_min,threshold_sc_max, threshold_min,threshold_max)

# UPDATING SCENE CHANGE POSITION
global pos_sc = (pos_sc > 0 && pos_sc < distance_sc_min) ? (pos_sc + 1) : 0
global pos_sc = (diff_f2 > threshold_sc && pos_sc == 0) ? 1 : pos_sc

# SCANNING FOR USELESS FRAMES
global ok_p2 = (pos_sc == 5 || pos_sc == 4 || pos_sc == 3) ? 0 : 1
global ok_p1 = (pos_sc == 4 || pos_sc == 3) ? 0 : 1
global ok = (pos_sc == 3) ? 0 : 1
global ok_f1 = (pos_sc == 2) ? 0 : 1
global ok_f2 = (pos_sc == 2 || pos_sc == 1) ? 0 : 1

# DISCARDING USELESS FRAMES
diff_p2_ok = diff_p2*ok_p2
diff_p1_ok = diff_p1*ok_p1
diff_ok = diff*ok
diff_f1_ok = diff_f1*ok_f1
diff_f2_ok = diff_f2*ok_f2

# COMPUTING AVERAGE DIFFERENCE
global diff_avg = (diff_ok + ti1*(diff_p1_ok+diff_f1_ok) + ti2*(diff_p2_ok+diff_f2_ok))/(ok + ti1*(ok_p1+ok_f1) + ti2*(ok_p2+ok_f2))

# STORING OLD MOTION LEVEL
global motion_level_old = motion_level

# SETTING MOTION LEVEL ACCORDING TO AVERAGE DIFFERENCE
global motion_level = (diff_avg < threshold_lm) ? 0 : motion_level
global motion_level = (diff_avg >= threshold_lm && diff_avg <= threshold_hm) ? 1 : motion_level
global motion_level = (diff_avg > threshold_hm) ? 2 : motion_level
global motion_level = (transition > 0) ? motion_level_end : motion_level

# STORING NEW MOTION LEVEL
global motion_level_new = motion_level

# SETTING TRANSITION POSITION
global transition = (transition > 0 && transition < transition_length) ? (transition + 1) : 0
global transition = (motion_level_new != motion_level_old && transition == 0 && transition_length > 0) ? 1 : transition
global transition = (pos_sc == 3) ? 0 : transition

# STORING TARGETTED MOTION LEVEL AFTER CURRENT MOTION LEVEL TRANSITION
global motion_level_end = (transition == 1) ? motion_level_new : motion_level_end
}

# PARAMETER SCALING FUNCTION
function PS(val param_in,val param_min,val param_max,float diff_min,float diff_max)
{
param_out = Spline(diff_avg,-1,param_min,diff_min,param_min,diff_max,param_max, 255,param_max,false)
param_out = (IsInt(param_in) == true) ? round(param_out) : param_out

return param_out
}

# MOTION FILTER FUNCTION
function MF(clip c)
{
# COMPUTING MOTION ESTIMATION
ME()

# SETTING LOW MOTION PARAMETERS ACCORDING TO AVERAGE DIFFERENCE
global param1_lm = (motion_level == 0) ? PS(param1_lm,param1_lm_min,param1_lm_max,threshold _min,threshold_lm) : param1_lm
global param2_lm = (motion_level == 0) ? PS(param2_lm,param2_lm_min,param2_lm_max,threshold _min,threshold_lm) : param2_lm
global param3_lm = (motion_level == 0) ? PS(param3_lm,param3_lm_min,param3_lm_max,threshold _min,threshold_lm) : param3_lm
global param4_lm = (motion_level == 0) ? PS(param4_lm,param4_lm_min,param4_lm_max,threshold _min,threshold_lm) : param4_lm
global param5_lm = (motion_level == 0) ? PS(param5_lm,param5_lm_min,param5_lm_max,threshold _min,threshold_lm) : param5_lm

# SETTING MEDIUM MOTION PARAMETERS ACCORDING TO AVERAGE DIFFERENCE
global param1_mm = (motion_level == 1) ? PS(param1_mm,param1_mm_min,param1_mm_max,threshold _lm,threshold_hm) : param1_mm
global param2_mm = (motion_level == 1) ? PS(param2_mm,param2_mm_min,param2_mm_max,threshold _lm,threshold_hm) : param2_mm
global param3_mm = (motion_level == 1) ? PS(param3_mm,param3_mm_min,param3_mm_max,threshold _lm,threshold_hm) : param3_mm
global param4_mm = (motion_level == 1) ? PS(param4_mm,param4_mm_min,param4_mm_max,threshold _lm,threshold_hm) : param4_mm
global param5_mm = (motion_level == 1) ? PS(param5_mm,param5_mm_min,param5_mm_max,threshold _lm,threshold_hm) : param5_mm

# SETTING HIGH MOTION PARAMETERS ACCORDING TO AVERAGE DIFFERENCE
global param1_hm = (motion_level == 2) ? PS(param1_hm,param1_hm_min,param1_hm_max,threshold _hm,threshold_max) : param1_hm
global param2_hm = (motion_level == 2) ? PS(param2_hm,param2_hm_min,param2_hm_max,threshold _hm,threshold_max) : param2_hm
global param3_hm = (motion_level == 2) ? PS(param3_hm,param3_hm_min,param3_hm_max,threshold _hm,threshold_max) : param3_hm
global param4_hm = (motion_level == 2) ? PS(param4_hm,param4_hm_min,param4_hm_max,threshold _hm,threshold_max) : param4_hm
global param5_hm = (motion_level == 2) ? PS(param5_hm,param5_hm_min,param5_hm_max,threshold _hm,threshold_max) : param5_hm

# APPLYING MOTION FILTER ACCORDING TO MOTION LEVEL
c = (transition == 0 && motion_level == 0) ? Low_Motion_Filter(c) : c
c = (transition == 0 && motion_level == 1) ? Medium_Motion_Filter(c) : c
c = (transition == 0 && motion_level == 2) ? High_Motion_Filter(c) : c

# APPLYING MOTION LEVEL TRANSITION
c = (transition > 0) ? Transition() : c

# PRINTING DEBUG INFORMATION
c = (debug == true) ? Debug(c) : c

return c
}

# MOTION LEVEL TRANSITION FUNCTION
function Transition()
{
# SETTING OLD CLIP ACCORDING TO OLD MOTION LEVEL
global clip_old = (transition == 1 && motion_level_old == 0) ? Low_Motion_Filter(clip) : clip_old
global clip_old = (transition == 1 && motion_level_old == 1) ? Medium_Motion_Filter(clip) : clip_old
global clip_old = (transition == 1 && motion_level_old == 2) ? High_Motion_Filter(clip) : clip_old

# SETTING NEW CLIP ACCORDING TO NEW MOTION LEVEL
global clip_new = (transition == 1 && motion_level_new == 0) ? Low_Motion_Filter(clip) : clip_new
global clip_new = (transition == 1 && motion_level_new == 1) ? Medium_Motion_Filter(clip) : clip_new
global clip_new = (transition == 1 && motion_level_new == 2) ? High_Motion_Filter(clip) : clip_new

# SETTING OLD/NEW CLIPS WEIGHT ACCORDING TO TRANSITION POSITION
weight = 1.0*(1.0 - (1.0/transition_length)*float(transition))

# MERGING OLD/NEW CLIPS ACCORDING TO WEIGHT
c = MergeLuma(clip_new,clip_old,weight)
c = MergeChroma(c,clip_old,weight)

return c
}

# DEBUG INFORMATION FUNCTION
function Debug(clip c)
{
# PRINTING VERSION INFORMATION
c = Subtitle(c,"Full Motion Filter v1.5 b1",x=20,y=30,font="lucida console",size=18,text_color=$FFFFFF)
c = Subtitle(c,"by HomiE FR (homie.fr@wanadoo.fr)",x=20,y=45,font="lucida console",size=14,text_color=$FFFFFF)

# PRINTING MOTION ESTIMATION INFORMATION
c = Subtitle(c,"motion estimation",x=20,y=75,font="lucida console",size=18,text_color=$FFFFFF)
c = Subtitle(c,"diff_p2 = "+string(diff_p2),x=20,y=95,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_p2 == 0) ? Subtitle(c,"[discarded]",x=230,y=95,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_p1 = "+string(diff_p1),x=20,y=110,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_p1 == 0) ? Subtitle(c,"[discarded]",x=230,y=110,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff = "+string(diff),x=20,y=125,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok == 0) ? Subtitle(c,"[discarded]",x=230,y=125,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_f1 = "+string(diff_f1),x=20,y=140,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_f1 == 0) ? Subtitle(c,"[discarded]",x=230,y=140,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_f2 = "+string(diff_f2),x=20,y=155,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_f2 == 0) ? Subtitle(c,"[discarded]",x=230,y=155,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_avg = "+string(diff_avg),x=20,y=170,font="lucida console",size=16,text_color=$FF6666)

# PRINTING SCENE CHANGE DETECTION INFORMATION
c = Subtitle(c,"scene change detection",x=20,y=200,font="lucida console",size=18,text_color=$FFFFFF)
c = Subtitle(c,"threshold_sc = "+string(threshold_sc),x=20,y=220,font="lucida console",size=16,text_color=$CCCCFF)
c = (pos_sc == 0) ? Subtitle(c,"detection = enabled",x=20,y=235,font="lucida console",size=16,text_color=$CCCCFF) : Subtitle(c,"detection = disabled",x=20,y=235,font="lucida console",size=16,text_color=$CCCCFF)
c = (ok_p2+ok_p1+ok+ok_f1+ok_f2 == 5) ? Subtitle(c,"information = scanning...",x=20,y=250,font="lucida console",size=16,text_color=$9999FF) : Subtitle(c,"information = scene change !",x=20,y=250,font="lucida console",size=16,text_color=$9999FF)

# PRINTING FULL MOTION FILTER INFORMATION
c = Subtitle(c,"full motion filter",x=20,y=280,font="lucida console",size=18,text_color=$FFFFFF)
c = (motion_level == 0) ? Subtitle(c,"scene type = low motion",x=20,y=300,font="lucida console",size=16,text_color=$66FF66) : c
c = (motion_level == 1) ? Subtitle(c,"scene type = medium motion",x=20,y=300,font="lucida console",size=16,text_color=$66FF66) : c
c = (motion_level == 2) ? Subtitle(c,"scene type = high motion",x=20,y=300,font="lucida console",size=16,text_color=$66FF66) : c
c = (motion_level == 0) ? ((param1_lm_min != 0 || param1_lm_max != 0) ? Subtitle(c,"param1_lm = "+string(param1_lm),x=20,y=315,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param1_lm = disabled",x=20,y=315,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param2_lm_min != 0 || param2_lm_max != 0) ? Subtitle(c,"param2_lm = "+string(param2_lm),x=20,y=330,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param2_lm = disabled",x=20,y=330,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param3_lm_min != 0 || param3_lm_max != 0) ? Subtitle(c,"param3_lm = "+string(param3_lm),x=20,y=345,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param3_lm = disabled",x=20,y=345,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param4_lm_min != 0 || param4_lm_max != 0) ? Subtitle(c,"param4_lm = "+string(param4_lm),x=20,y=360,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param4_lm = disabled",x=20,y=360,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param5_lm_min != 0 || param5_lm_max != 0) ? Subtitle(c,"param5_lm = "+string(param5_lm),x=20,y=375,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param5_lm = disabled",x=20,y=375,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param1_mm_min != 0 || param1_mm_max != 0) ? Subtitle(c,"param1_mm = "+string(param1_mm),x=20,y=315,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param1_mm = disabled",x=20,y=315,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param2_mm_min != 0 || param2_mm_max != 0) ? Subtitle(c,"param2_mm = "+string(param2_mm),x=20,y=330,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param2_mm = disabled",x=20,y=330,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param3_mm_min != 0 || param3_mm_max != 0) ? Subtitle(c,"param3_mm = "+string(param3_mm),x=20,y=345,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param3_mm = disabled",x=20,y=345,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param4_mm_min != 0 || param4_mm_max != 0) ? Subtitle(c,"param4_mm = "+string(param4_mm),x=20,y=360,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param4_mm = disabled",x=20,y=360,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param5_mm_min != 0 || param5_mm_max != 0) ? Subtitle(c,"param5_mm = "+string(param5_mm),x=20,y=375,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param5_mm = disabled",x=20,y=375,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param1_hm_min != 0 || param1_hm_max != 0) ? Subtitle(c,"param1_hm = "+string(param1_hm),x=20,y=315,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param1_hm = disabled",x=20,y=315,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param2_hm_min != 0 || param2_hm_max != 0) ? Subtitle(c,"param2_hm = "+string(param2_hm),x=20,y=330,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param2_hm = disabled",x=20,y=330,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param3_hm_min != 0 || param3_hm_max != 0) ? Subtitle(c,"param3_hm = "+string(param3_hm),x=20,y=345,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param3_hm = disabled",x=20,y=345,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param4_hm_min != 0 || param4_hm_max != 0) ? Subtitle(c,"param4_hm = "+string(param4_hm),x=20,y=360,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param4_hm = disabled",x=20,y=360,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param5_hm_min != 0 || param5_hm_max != 0) ? Subtitle(c,"param5_hm = "+string(param5_hm),x=20,y=375,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param5_hm = disabled",x=20,y=375,font="lucida console",size=16,text_color=$CCFFCC)) : c

return c
}

ak47 11-17-2003 08:41 PM

did you import the avs file off of doom9.org called fmf-1.5b1.avs

ak47 11-17-2003 08:42 PM

lol cross post
P.S. make sure you have fluxsmooth 1.01

audioslave 11-17-2003 08:43 PM

:D 8)
What motion search do you use in TMPGEnc for this script - Estimate or High quality? And what about the min and max bitrates? Do you use 300 for min and 2000 for max?

ak47 11-17-2003 08:48 PM

I used MCE for Mpeg-2 encoding, its definitely buggy but I get better quality out of Mpeg-2 then Tmpgenc(not Mpeg-1 though). But I would suggest motion estimate search.

audioslave 11-17-2003 09:16 PM

@ak47
Hi again!
Now I'm encoding Matrix Reloaded with the FMF script. Occationally I get some frames that are quite red. This shows very clearly on this movie since it is very green. I don't know why this happens... Maybe it could be one of the filters that screws up :?:
And back to the bitrates - should I use 300 for min and 2000 for max in TMPGEnc?

ak47 11-17-2003 09:51 PM

First off if your video is not interlaced then removed this line, TomsMoComp(1,5,1) (you probably already did that though), also mess with the decomb features to get what you want, also check you original source and see if there is anything wrong with it then if no problem, check with the avs script and see it though windows media player or something else to check if its yours/my script that is messing up. If it's the script then check your plugin's and see if you have the latest version on the filters, also remove the FMF line if you still have the problem and see if its that. Also can you tell me the source, AVI or straight from the DVD?

audioslave 11-18-2003 12:34 PM

My source is DVD. I will check the filters this evening... I'll be back! :wink:

digitall.doc 11-19-2003 05:32 AM

Hi all:
... still working on it.
Let's see if I have a good departure point. If I'm wrong, please make me know:
- Low motion-> temporal filtering (like TemporalSoften, fast, good quality)
- Medium motion-> spatial-temporal filtering (TemporalSoften+Unfilter, or all in one like FluxSmooth, MIpSmooth, Convolution3d,...). Ranging from less spatial and more temporal, to more spatial and less temporal.
- High motion-> spatial filtering: Unfilter, Deen (memory leaks?), SpatialSoften (is that good?),...
Doubts: what's threshold_sc supposed to be for?. And the question about motion level threshold. I made a comparison, and a SwitchThreshold of 2 in MA equals a motion stimation about 6 in FMF (lm threshold is 4 to 5). And a motion stimation change from low to medium in FMF, equals to a nf level of 5.63-7.14 in MA. Should we raise the thresholds (_lm, _hm and _max)?, I state this because I find that there's little space in high motion, for instance, to give unfilter an ample margin of values (to heavy unfulter in really high motion).
Wait your opinions, suggestions, scripts,... I hope I'll post mine soon (still not satisfied with results). :wink:

ak47 11-19-2003 07:51 PM

Yes I am also making a new script I removed MergeChroma from the adaptive part of the script mainly because you can max it out to 1.50 and it's not going to change much, and I am also putting a denoiser in there. Your ideas are good for the motions, but I don't know much about programming or how filters differ in that way so I just trying to make the script that looks best, that make the most sense to my knowledge, I am only a high school student.

digitall.doc 11-20-2003 08:00 PM

Hi ak47:
:D as you can see from my posts, I still have a lot to learn. I've been trying to understand the FMF.avs script, in order to know what some parameters do (like threshold_sc), and better adjusting them. I think I should raise threshold_max, to make the filters work smoother, in an ampler range of values. But as I don't have the enough knowledge, I have to end like you, making lots of tests without realyy knowing what I have to adjust to get a better result.

ak47 11-20-2003 08:01 PM

I followed your advice digitall.doc and made a new script with different variations on filter per motion, and its fast just as fast as the MA script maybe faster.
Code:

function Low_Motion_Filter(clip c)
{
c = TemporalSoften(c,2,param1_lm,param1_lm,param3_lm,2)
c = UnFilter(c,param2_lm,param2_lm)
c = MergeLuma(c,blur(c,param4_lm))
return c
}

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

function High_Motion_Filter(clip c)
{
c = UnFilter(c,param2_hm,param2_hm)
c = VagueDenoiser(c,param3_hm,3,6,true)
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)
FMF(param3_hm_min=1.0,param3_hm_max=2.2,param1_mm_min=3,param1_mm_max=5.5,param2_mm_min=4,param2_mm_max=7,
param4_mm_min=3,param4_mm_max=4.5,mergechroma(blur(1.50)),param4_lm_min=0.08,param4_lm_max=0.14,param5_mm_min=0.14,
param5_mm_max=0.2,param4_hm_min=0.2,param4_hm_max=0.3,param2_lm_min=-5,param2_lm_max=-15,param1_lm_min=3,
param1_lm_max=8,param3_lm_min=3,param3_lm_max=7,param3_mm_min=-15,param3_mm_max=-25,param2_hm_min=-25,param2_hm_max=-45)
AddBorders(24, 80, 24, 80)
Limiter()

Two things one is to FMF(**) line is one line, and second give me responds on how to make my script better if you can, thanx in advance.

digitall.doc 11-20-2003 08:10 PM

Hi ak: 1 minute difference in posting!
Well, I'll give a try your script. How does it look like?. I find you're blurring too much with so many spatial in low motion (unfilter -5 to -15). And in your FMF parameters appears a mergechroma(blur(1.5)). Is that really a parameter?, or is it a "bug"?. I've made several test I'll post later, with vaguedenoiser, fluxsmooth, convo3d or mipsmooth (only one each time). But from all my test (I just implement FMF instead of de adaptive routine in de MA script, and keep the rest of MA script the same) I've realised that I canīt put out STMedianFilter(3,3,1,1), because the encoding gets slower, the file bigger, and not so good looking. Looks like STM makes a light filtering that allows the rewst of the filters work better.
I'll post later my experiences.

ak47 11-20-2003 08:22 PM

Quote:

How does it look like
The Lower Motion has saved detail and high motion has been filter more so you gain more compression in other words it looks great.
Quote:

I find you're blurring too much with so many spatial in low motion (unfilter -5 to -15)
Ya I'll change that.
Quote:

And in your FMF parameters appears a mergechroma(blur(1.5))
No bug I just want to place the filter in the right order, you can add a static filter in the FMF line so it will get adaptive filtering before of after.
Quote:

I've realised that I canīt put out STMedianFilter(3,3,1,1), because the encoding gets slower, the file bigger, and not so good looking
when your comparing quality make sure you have a constant or average bit rate, so use something like 3000kbs max,64kbs min,1000kbs average VBR. Also STMedianFilter is good for being fast, but it isn't that strong in my opinion.

kwag 11-20-2003 08:29 PM

Quote:

Originally Posted by ak47
I mainly introduce this script to show the power and control of FMF.

But this was already discussed way back this year here: http://www.kvcd.net/forum/viewtopic....r=asc&start=16
I also discussed the disadvantage of having three sharp filter brackets ( low/medium/high ) and that's the reason I made the MA script linear. This way, there are no sharp tresholds ( sharp attack/decay ) boundaries where the filters turn on/off rapidly.
I don't remember where the threads are, but they are buried deep down somewhere in the forum.

-kwag


All times are GMT -5. The time now is 09:46 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.