Avisynth: Motion Adaptive Filtering Now Possible? - Page 7 - digitalFAQ.com Forums [Archives]
 digitalFAQ.com Forums [Archives] Avisynth: Motion Adaptive Filtering Now Possible?

#121
05-29-2003, 12:31 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Hi ren,

-kwag
Someday, 12:01 PM
 Site Staff / Ad Manager Join Date: Dec 2002 Posts: 42 Thanks: ∞ Thanked 42 Times in 42 Posts
#122
05-29-2003, 12:39 PM
 ARnet_tenRA Free Member Join Date: Jan 2003 Location: Illinois, USA Posts: 73 Thanks: 0 Thanked 0 Times in 0 Posts
Here is what I have so far: It divides the movie into 16x16 blocks and allows you to perform filtering on each block separately.

Code:
```AviSource(" -Your Movie Here- ")

FilterBlocks()

function FilterBlocks( clip clip, int "cwidth", int "cheight", clip "vertclip" ) {
cwidth = default(cwidth,0)
cheight = default(cheight,0)
vertclip = default(vertclip, HorizontalStrip(clip, cwidth, cheight))
cheight = cheight+16
cheight < clip.height ? FilterBlocks(clip, cwidth, cheight, StackVertical(vertclip,HorizontalStrip(clip, cwidth, cheight))): vertclip
}

function HorizontalStrip( clip clip, int cwidth, int cheight, clip "hortclip" ) {
hortclip = default(hortclip, Crop(clip,cwidth,cheight,16,16).filters())
cwidth = cwidth+16
cwidth < clip.width ? HorizontalStrip(clip, cwidth, cheight, StackHorizontal(hortclip,Crop(clip,cwidth,cheight,16,16).filters())): hortclip
}

function filters( clip clip ) {
greyscale(clip)
}```
You can place whatever filters you want in the filters function.

Again I used greyscale to show that every block is being filtered.

Regards, Tenra
#123
05-29-2003, 01:14 PM
 rendalunit Free Member Join Date: Apr 2002 Location: san jose, Ca Posts: 1,148 Thanks: 0 Thanked 0 Times in 0 Posts
thanks kwag,

All the filters load fine now but I'm still getting the "I don't know what SubBlur means" error

ren
#124
05-29-2003, 01:18 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by rendalunit thanks kwag, All the filters load fine now but I'm still getting the "I don't know what SubBlur means" error ren
You're using some stray variables and lines that I had defined for display purpose as sub-titles
Make sure your script looks like this:

Code:
```LoadPlugin("C:\Filters25\MPEG2Dec3.dll")

Mpeg2Source("K:\VIDEO_TS\project.d2v")

MaxThreshold=1.58

UnFilter(50, 50)
BicubicResize(528, 368, 0, 0.6, 16, 0, 688, 480)
STMedianFilter(8, 32, 0, 0 )
TemporalSoften(2,7,7,3,2)
mergechroma(blur(1.50))

val=0 # Initialize our motion variable.
N="noise"

FrameEvaluate("val=YDifferenceFromPrevious()/14.55") # Assign "val" with difference between current frame and last frame.
ScriptClip("val > MaxThreshold ? MergeLuma(blur(MaxThreshold)) : MergeLuma(blur( val )) ") # Adaptive mergeluma.
LetterBox(16, 16, 16, 16)
Limiter()```
And just make the changes to your source line, resize, addborders and letterbox.

-kwag
#125
05-29-2003, 01:33 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
And here's the showoff for the day
www.kvcd.net/704x480-showoff.mpg ( CQ=68 MIN=300, MAX=2,500 ~6MB 25 seconds , which should be about the right CQ to fit this particular movie on one CD, looking just like this sample )

Enjoy!,
-kwag
#126
05-29-2003, 01:38 PM
 rendalunit Free Member Join Date: Apr 2002 Location: san jose, Ca Posts: 1,148 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by kwag You're using some stray variables and lines that I had defined for display purpose as sub-titles
Yep, I finally figured that out

now I'm getting strange noise from blockbuster:

could this be because of the Variance param becoming invalid?

ren
#127
05-29-2003, 01:48 PM
 rendalunit Free Member Join Date: Apr 2002 Location: san jose, Ca Posts: 1,148 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by kwag And here's the showoff for the day www.kvcd.net/704x480-showoff.mpg ( CQ=68 MIN=300, MAX=2,500 ~6MB 25 seconds , which should be about the right CQ to fit this particular movie on one CD, looking just like this sample
Wow!!! That looks great!!

btw- what movie is that? I'm going to rent it

ren
#128
05-29-2003, 01:52 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Hi ren,

I didn't protect the variance in the sample script, but that was just for a test, so don't take it seriously
The proper way would be using calculations to limit the min and max boundaries, before applying the value to variance. Like another conditional operator "?" to bracket the values.
I really see no need for Blockbuster above 528x resolutions
And specially now, that I think we can even go up to 704x480, as in the sample I posted
The dynamic value applied to mergeluma function really saves us a huge amount of data, so I think we can now start to use XVCD 704x480(576) resolution with this methods. This can only get better from now on

-kwag
#129
05-29-2003, 01:53 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by rendalunit Wow!!! That looks great!! btw- what movie is that? I'm going to rent it ren
"The Foreigner"

-kwag
#130
05-29-2003, 02:31 PM
 bman Free Member Join Date: Apr 2002 Posts: 356 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rendalunit
Quote:
 Originally Posted by kwag You're using some stray variables and lines that I had defined for display purpose as sub-titles
Yep, I finally figured that out

now I'm getting strange noise from blockbuster:

could this be because of the Variance param becoming invalid?

ren
@ ren
To get rid of noise blocks I did some changes in BlockBuster line :
ScriptClip("val < 0.3 ? BlockBuster(method=N, detail_min=10, detail_max=15, variance=(1/val*10), seed=0) : val > 1 ? blur(1.5 : blur(val)")
This values I get by testing (encoding sample) and I'm quite sure that thay
will be different for different sources (dvd's) .
I think best is if u check min - max values for your source and according that adjust tham .
bman
#131
05-29-2003, 02:36 PM
 DorvalCS Free Member Join Date: Dec 2002 Location: Montreal, Canada Posts: 31 Thanks: 0 Thanked 0 Times in 0 Posts
I figured it out

I was running into this problem earlier today
<<When I load the script in VirtualDub I get this error message:
"Couldn't locate decompressor for format YV12" >>

I have downloaded and installed the Video Codec "ATI YV12 4:2:0 Planar v.4.12.5038".... No more problem. I don't know if that's what I was suppused to do... But it fixed my problem

I'm now in full testing mode for thise new 2.5 Script... Can't wait to see some relusts..
__________________
DorvalCS
#132
05-29-2003, 02:45 PM
 bman Free Member Join Date: Apr 2002 Posts: 356 Thanks: 0 Thanked 0 Times in 0 Posts
@ all
Any suggestions for VoBSub or TextSub for Avs2.5
bman
#133
05-29-2003, 08:32 PM
 ozjeff99 Free Member Join Date: May 2002 Location: Sydney, Australia Posts: 159 Thanks: 0 Thanked 0 Times in 0 Posts
Kwag....704x576 woohoo. Since I can't do KVCDx3 this is very tasty. Great work everyone! :P
ozjeff99
#134
05-29-2003, 08:52 PM
 ovg64 Free Member Join Date: Jan 2003 Location: Puerto Rico Posts: 423 Thanks: 0 Thanked 0 Times in 0 Posts
Finally i took some time and got these thing going with avs2.51, now it would be nice if MovieStacker would generate our avs scripts again.
#135
05-29-2003, 09:12 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by ovg64 now it would be nice if MovieStacker would generate our avs scripts again.
It's just a matter of time, and a matter of muaddib getting his motheboard fixed His machine went bad (again!) last week, and he told me he would be unavailable for some days until he gets his system fixed. I'm sure he will be surprised when he logs back on

-kwag
#136
05-30-2003, 12:19 AM
 ozjeff99 Free Member Join Date: May 2002 Location: Sydney, Australia Posts: 159 Thanks: 0 Thanked 0 Times in 0 Posts
The Motherboard is not broken it is very very tired. Speak to it Muad

I'm wondering with this application in tandem with a normal Mpeg-1 encoding process whether a new standard is being created..

.....Mpeg-1.5

ozjeff99
#137
05-30-2003, 01:58 AM
 audioslave Free Member Join Date: Mar 2003 Location: Sweden Posts: 725 Thanks: 0 Thanked 0 Times in 0 Posts
Good morning!

@kwag
Have you tried lowering the maximum bitrate yet? I read that you would try it...
Wow, my head is spinning! This new script really is amazing! Can we finally use 704x576/480 for our encodes?
Another thing: Are you supposed to change the maximum numer of frames per GOP depending on your source? Like 24 for NTSCFilm, 25 for PAL and 30 for NTSC?
Here I go again, bombing you with questions

And, yes, that "The Foreigner" clip looks simply AWESOME!!! Did you use the latest Optimal Script for AviSynth 2.5* for that one?
#138
05-30-2003, 05:52 AM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by audioslave Good morning! @kwag Have you tried lowering the maximum bitrate yet? I read that you would try it...
Yes, at 528x480 (KVCDx3) I tried a MAX of 2000Kbps and the result is great
Quote:
 Wow, my head is spinning! This new script really is amazing! Can we finally use 704x576/480 for our encodes?
I think so , just like that sample of "The Foreigner". I used ToK to predict the real CQ with the current script, and it came out to "CQ=63.65" Not far from that sample I did at CQ=68, and I did the complete movie with ToK at 704x480 to fit on one CD and looks just like that sample I posted
I did use a MAX bitrate of 2,500, because at that resolution we need that bit rate for fast action scenes. However, at 528x480, I think we can get by with the MAX of 2000 using the new adaptive script.
Quote:
 Another thing: Are you supposed to change the maximum numer of frames per GOP depending on your source? Like 24 for NTSCFilm, 25 for PAL and 30 for NTSC?
If you use ToK, that's exactly what it does automatically, depending on your source frame rate
Quote:
 Here I go again, bombing you with questions And, yes, that "The Foreigner" clip looks simply AWESOME!!! Did you use the latest Optimal Script for AviSynth 2.5* for that one?
You bet , the one that's currently posted

-kwag
#139
05-30-2003, 06:22 AM
 audioslave Free Member Join Date: Mar 2003 Location: Sweden Posts: 725 Thanks: 0 Thanked 0 Times in 0 Posts
WOW!
Can you use ToK with AviSynth 2.5*? When I tried that TMPGEnc said I had the wrong sampler.dll version... Where can I find a sampler.dll version to work with the new linear script and AviSynth 2.5*?
#140
05-30-2003, 07:29 AM
 Krassi Free Member Join Date: Mar 2003 Location: Germany Posts: 390 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by audioslave WOW! Can you use ToK with AviSynth 2.5*? When I tried that TMPGEnc said I had the wrong sampler.dll version... Where can I find a sampler.dll version to work with the new linear script and AviSynth 2.5*?
@audioslave:
You can get the newest Sampler here:
http://www.jungleweb.net/~sansgrip/avisynth

I have just used ToK and had no problems with the current 2.51 script.

 Similar Threads Thread Thread Starter Forum Replies Last Post supermule Avisynth Scripting 3 09-15-2006 01:45 AM holgerschlegel Avisynth Scripting 7 08-27-2003 04:08 AM pitoman Avisynth Scripting 2 08-05-2003 12:51 PM bicho_visacoso Avisynth Scripting 6 06-15-2003 06:30 AM Bchteam Avisynth Scripting 15 05-31-2003 12:38 PM