digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Motion adaptive filtering now possible? (http://www.digitalfaq.com/archives/avisynth/3594-avisynth-motion-adaptive.html)

kwag 05-28-2003 03:21 PM

Quote:

Originally Posted by bman
I'm trying to encode AVS2.51 but can't find unfilter() function

Hi bman,

Here: http://www.avisynth.org/~warpenterprises/
The filter's MECA :)

-kwag

bman 05-28-2003 03:38 PM

@ KWAG !
Thenx :!:
What about vobsub or subtitles with avs2.51 :!: :oops: :oops:
bman

kwag 05-28-2003 03:42 PM

Quote:

Originally Posted by bman
@ KWAG !
Thenx :!:
What about vobsub or subtitles with avs2.51 :!: :oops: :oops:
bman

Good question :!: I haven't tried that yet 8)

-kwag

audioslave 05-28-2003 05:24 PM

Thanks a bunch Kwag! I'll get right to business :D :wink:

Anerboda 05-28-2003 05:40 PM

Quote:

Originally Posted by Boulder
Sampler does work in AVS2.5.1 and should work since v0.2. I use it all the time, just remember to use sampler-2.5.dll instead of sampler.dll . They're both in the same package.

True.. I just did a test with ToK and it is working... in settings just point ToK to the Sampler-2.5.dll from the package.

But I got a CQ of 62,83 with AviSynth 2.5 and with AviSynth 2,08 I got a CQ of 70,12 with the same settings in ToK for file prediction (optimal scripts for both versions of AviSynth) with the same movie. 8O :?:

Anerboda

audioslave 05-28-2003 06:17 PM

@Kwag

Could you PLEASE show me what lines to remove to get rid of the text on the top of the movie? I just can't seem to get rid of the text... :cry: Please show me on the script, will you? BTW What settings do you recommend for a "normal" DVD encode? To get a "normal" amount of noise? If you know I mean...
I got the aspect ratio thing working though. I added the "AddBorders()" line I got in "MovieStacker" and simlpy removed the side borders :wink: . Like this:

BicubicResize(448, 414, 1/3, 1/3, 9, 0, 702, 576)
AddBorders(0, 81, 0, 81)

Then, in TMPGEnc, I set the "Video Arrange Method" to "Full Screen".

kwag 05-28-2003 06:55 PM

Hi audioslave,

Get your resize values from moviestacker, and paste them on the corresponding lines. Use the "Latest Script" posted as reference.
Don't mess with blockbuster "noise" yet! I posted that just as an example :!:
If you use the "Latest script", it will work just fine, and the subtitle (numbers on top) won't appear in your encode. Get the latest script here: http://www.kvcd.net/forum/viewtopic.php?t=3483

Which is this:

Code:

MaxThreshold=1.58

UnFilter(50, 50)
BicubicResize( Your_Resize_Values_Here )
STMedianFilter(8, 32, 0, 0 )
TemporalSoften(2,7,7,3,2) # Experimental!
mergechroma(blur(1.50))
## Dynamic linear adaptive filtering ##
ScriptClip("val=YDifferenceFromPrevious()/14.55" + "val > MaxThreshold ? MergeLuma(blur(MaxThreshold)) : MergeLuma(blur( val ))")
##
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
#AddBorders( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()

-kwag

audioslave 05-28-2003 07:19 PM

Thank you kwag! Sorry for being a pain in the *** :cry: .
I'll stick with the Optimal Script for now...
Off to bed now. It's 02:18 p.m. here in Sweden. Yawn! Good night to you all...

ozjeff99 05-28-2003 11:16 PM

Recognition of all contributors and puting personal attention aside for the benefit of the whole team is a mark of the finest leadership. We are here, and have come this far so quickly because of you Kwag. You inspire us all.

Thanks mate...ozjeff99

kwag 05-28-2003 11:37 PM

Thanks ozjeff99 :D
You all make this site a great place to be, learn, study and play :wink:

-kwag

bman 05-29-2003 12:33 AM

@ ozjeff99
I'm with u on every word u sead !
KWAG - U are THE ONE !!! and I mean it !

@ KWAG
====
ScriptClip("val < 0.3 ? BlockBuster(method=N, detail_min=1, detail_max=10, variance=((1/val)*10), seed=0).Subtitle(String(Subnoise),1,30) : val >1 ? blur( 1.58 ).Subtitle(String(SubBlur),1,30):blur(val)")
=====
This line doesn't want to work for me ? Ofcourse I removed Subtitle function and instead of 1 I delete 0.1 on val :

ScriptClip("val < 0.3 ? BlockBuster(method=N, detail_min=1, detail_max=10, variance=((0.1/val)), seed=0) : val >1 ? blur( 1.58 ) : blur(val)

I know it's not right but where ???
I'm getting too much noise added to dark and and even bright scenes too .
After encoding at the very begining of clip I'm getting few frames looking like marble surface ??!!!!
I messed everything I think :oops: :oops: :oops:
bman

kwag 05-29-2003 12:49 AM

Quote:

Originally Posted by bman
ScriptClip("val < 0.3 ? BlockBuster(method=N, detail_min=1, detail_max=10, variance=((1/val)*10), seed=0).Subtitle(String(Subnoise),1,30) : val >1 ? blur( 1.58 ).Subtitle(String(SubBlur),1,30):blur(val)")
=====
This line doesn't want to work for me ? Ofcourse I removed Subtitle function and instead of 1 I delete 0.1 on val :

It should read like this:
N="Noise"
ScriptClip("val < 0.3 ? BlockBuster(method=N, detail_min=1, detail_max=10, variance=((1/val)), seed=0) : val > 1 ? blur( 1.58 ) : blur(val)")

The idea of 1/val is to work in reverse. The value of "val" fluctuates from close to 0 to around ~25. So what I did is divide the number by one, so that the higher the activity, the lower the result and vice versa. This is the effect we want, and that is to apply more noise on slow or static scenes and decrease the noise in a linear fashion as the activity increases. This way we apply the noise inversely proportional to the activity :)
You can play with the (1/val) to include a multiplier, like ((1/val) * 10 )
That will increase the noise, but probably too much! But go ahead and experiment :!: that's what this is all about 8)

-kwag

kwag 05-29-2003 01:06 AM

small sample
 
Here you go guys :)
www.kvcd.net/small-adaptive-sampler.mpg (10 second clip)
That's what the complete movie looks like on one CD-R :mrgreen:
That movie is 96 minutes long, and it was encoded at 528x480 and @CQ=71.2 with the current script ( For AviSynth 2.5x ):!:

-kwag

jorel 05-29-2003 01:41 AM

@ Kwag and all

i download the full-adaptive-sampler.mpg (11.8mb)
and the small-adaptive-sampler.mpg (1.04mb).

after see the full sampler i can affirm...

great, fantastic,... 8O

congrats Kwag the full sampler is brilliant.(i don't need to see the small)
very clear and with big details.

8)

i need to read all this thread.(again) :wink:

DorvalCS 05-29-2003 02:26 AM

Quote:

Originally Posted by jorel

i download the full-adaptive-sampler.mpg (11.8mb)

Jorel my friend... Where did you get this full-adaptive-sampler???

I've looked everywhere and I can't find it :oops:

DorvalCS

jorel 05-29-2003 02:36 AM

@ DorvalCS and all

don't know if the download is working now...

http://www.kvcd.net/full-adaptive-sampler.mpg

:!:

bman 05-29-2003 03:07 AM

KWAG wrote:
Quote:

It should read like this:
N="Noise"
ScriptClip("val < 0.3 ? BlockBuster(method=N, detail_min=1, detail_max=10, variance=((1/val)), seed=0) : val > 1 ? blur( 1.58 ) : blur(val)")

I begane with this line from very begining :? :? :?
Quote:

The idea of 1/val is to work in reverse. The value of "val" fluctuates from close to 0 to around ~25. So what I did is divide the number by one, so that the higher the activity, the lower the result and vice versa. This is the effect we want, and that is to apply more noise on slow or static scenes and decrease the noise in a linear fashion as the activity increases. This way we apply the noise inversely proportional to the activity :)
Brilliant idea , Brilliant !
Quote:

You can play with the (1/val) to include a multiplier, like ((1/val) * 10 )
That will increase the noise, but probably too much!
I did played some but I don't know why I can't get smooth picture 8O 8O 8O
Then I just decreased 1 to 0.1 and even 0.01 and it made significant difference :(
Quote:

But go ahead and experiment :!: that's what this is all about 8)
Ofcoarse I'll do that as soon as I'll arrive home .
And exscuse me for my stupidity but BlockBuster("noise") I always used to get rid of blinking colored blockiness on dark scenes ???
I assumed that we'll use it in similar way in adaptive script ??!! :(
bman

rhino 05-29-2003 04:15 AM

It will be interesting to see what effects this has on long films and fitting them onto 1 CD. I was re-reading the thread about Pearl Harbour being 183 minutes, lots of action but better on 2 CD's. Wonder what effect dyanmic filtering will have on this.

Cheers,

Jellygoose 05-29-2003 05:54 AM

8O :D
I'm joying, I'm cheering!! :D Just watched the small-sampler over and over again! awesome!
can't wait to test this!! I'll be back in a couple of hours! :wink:

By the way bman... As for the noise, I wouldn't mess with the (1/val), to change the amount of noise, but with the multiplier... so if you want less noise added, try something like this ((1/val)*0.5)
I don't know if I understood you right, but this would add half as much noise as before...

Jellygoose 05-29-2003 07:01 AM

Hi all!!

I'm currently testing the new script, with a full prediciton of "The Boondock Saints" using ToK... and...
it seems to work... I'll check with ya'll later!

DKruskie 05-29-2003 07:01 AM

I have to agree with jellygoose..It's awesome!!..Great job Kwag

David

Jellygoose 05-29-2003 07:24 AM

Back again...
Ok this new filter chain just throws me off my chair... The CQ value actually didn't raise too much, for me (by 1.6 points), but it seemed to be a lot sharper throughout the movie...
I'm currently testing "TemporalCleaner" against "TemporalSoften", while I'm using a very low y-Threshold, and a rather high c-Threshold!
I'll let you know the results! :wink:

black prince 05-29-2003 08:14 AM

@All,

Kawg wrote:
Quote:

Here you go guys
www.kvcd.net/small-adaptive-sampler.mpg (10 second clip)
That's what the complete movie looks like on one CD-R
That movie is 96 minutes long, and it was encoded at 528x480 and @CQ=71.2 with the current script ( For AviSynth 2.5x )

-kwag
I enjoyed the small clip, but the link to the full clip won't work. I'll
try to load avisynth 2.51 this evening and see if I have problems.
I stayed away from this because of 2.51, but this too good to
ignor. It would be very nice to have this as avisynth v2.08 :roll:
Wonder what BV shows against a video using adapative vs the
way it's done now. :?: Maybe a comparison of frames showing
how targeting has really improved picture quality :?: There's a lot
to discover here :D

-bp

DorvalCS 05-29-2003 08:37 AM

Hi Friends! Need Some help.

I have loaded AviSynth 2.5 (latest version)
Created a Script using Kwag's latest.

But when I try to load in Tmpgenc, it tells me that my file is not supported. When I load the script in VirtualDub I get this error message:
"Couldn't locate decompressor for format YV12"

Here is a copy of my Script:

LoadPlugin("C:\Filters2_5\MPEG2Dec3.dll")
LoadPlugin("C:\Filters2_5\STMedianFilter.dll")
LoadPlugin("C:\Filters2_5\UnFilter.dll")

Mpeg2Source("C:\My Documents\My Videos\movie.d2v")

MaxThreshold=1.58

UnFilter(50, 50)
BicubicResize(496, 334, 1/3, 1/3, 4, 0, 712, 480)
STMedianFilter(8, 32, 0, 0 )
TemporalSoften(2,7,7,3,2)
mergechroma(blur(1.50))
## Dynamic linear adaptive filtering ##
ScriptClip("val=YDifferenceFromPrevious()/14.55" + "val > MaxThreshold ? MergeLuma(blur(MaxThreshold)) : MergeLuma(blur( val ))")
##
AddBorders(16, 73, 16, 73)
Limiter()

What am I doing wrong? :oops:

Thanks for your help... I can't wait to try this new script... :wink:

bman 05-29-2003 08:48 AM

@ All
I see all of us are impressed with adaptive filtering method :D :D :D
According my quest KWAG implement this method on 2 filters MergeLuma and BlockBuster .
Thanx him for that !!!
I didn't made tests yet and can't say how much compression new filter can add to mpg but IF IT'S RIGHT and it helps to get higher compression then - WHY DON'T try adaptive on WHOLE SCRIPT( I mean without resizing and SUBS ) .
If its working on 2 filters then maybe it could be accomplish on all others in the script :?: :?: :wink: :wink:
What do u think ? It could be worked out KWAG :?: :?: :?:
Just an idea (maybe a stupid one )
bman

jorel 05-29-2003 09:04 AM

:?
i need some help ,

please, a full script posted here will be great....
i got errors like DorvalCS.

thanks in advance!
:)

kwag 05-29-2003 09:42 AM

Quote:

Originally Posted by bman
I didn't made tests yet and can't say how much compression new filter can add to mpg but IF IT'S RIGHT and it helps to get higher compression then - WHY DON'T try adaptive on WHOLE SCRIPT( I mean without resizing and SUBS ) .

Hi bman,

Yes, I mentioned this earlier in the thread, to incude filters that we can "plug" for different conditions. Some filters will need "static" values ( like temporal filters ) throughout the movie, unless sh0dan gives us a function similar to YDifferencefromPrevious, that instead of reporting a value change for activity, gives us a value change for "noise" activity per frame :idea: ( Hello sh0dan ;) )
Another thing I thought of last night was that instead of reporting the activity on a per-frame basis, divide the frame in a 16x16 array or so, and then the difference from previous frames would return a quadrant of information :idea: Then when adaptive filtering is used, it can also be applied selectively to each "quadrant". For example, you are watching a scene where the top half of the picture is a still sharp backgroung, and the bottom half is cars driving by (fast action). Right now, there would be an average of blur added to the complete frame, because it's the average applied from the value returned by the motion. With the quadrant approach, the blur would apply ONLY to the bottom area of the scene, and leave the top part untouched :!: So imaging that with this method, we could apply say a hight mergeluma to the bottom half of the screen, then the right top quadrants if it was pitch dark, we could apply some level of BlockBuster noise and if the left top quadrant doesn't need any filters, then that area is left alone. So we would have "Hybrid Adaptive Filtering" :mrgreen:
Maybe I'm asking too much, but if the function hooks are developed in AviSynth, then it's just a matter of plugging our filters either on a "frame level" or on a "quadrant level" per frame. The possibilities we could get with this would be just amazing 8)

@sh0dan,
Comments on this :?:

-kwag

Jellygoose 05-29-2003 09:58 AM

Kwag, I thought about the exact same thing this morning... :o
I thought this would be a lot to complicated in a way...
Am I right, that this procedure of analyzing every square in a frame would take a LOT of time?
However, it sounds extremely good, and I'm definately looking forward to further developments...
Well you're right about the TemporalFilters, but STMedianFilter as a Spatial Filter (at least that's how WE use it) can still be adjusted to the amount of motion in a frame right?

ARnet_tenRA 05-29-2003 10:02 AM

Quote:

Originally Posted by kwag
Another thing I thought of last night was that instead of reporting the activity on a per-frame basis, divide the frame in a 16x16 array or so, and then the difference from previous frames would return a quadrant of information :idea: Then when adaptive filtering is used, it can also be applied selectively to each "quadrant".

Here is a way to do it Kwag. I am sure you can optimize it more. I have added the GreyScale filter to show how each section is getting a different filter. Of course you can filter any way you want.
Code:

AviSource(" -Your movie here.- ")

aa=Crop(0*width/4,0*height/4,1*width/4,1*height/4).GreyScale()
ab=Crop(1*width/4,0*height/4,1*width/4,1*height/4)
ac=Crop(2*width/4,0*height/4,1*width/4,1*height/4).GreyScale()
ad=Crop(3*width/4,0*height/4,1*width/4,1*height/4)
ba=Crop(0*width/4,1*height/4,1*width/4,1*height/4)
bb=Crop(1*width/4,1*height/4,1*width/4,1*height/4).GreyScale()
bc=Crop(2*width/4,1*height/4,1*width/4,1*height/4)
bd=Crop(3*width/4,1*height/4,1*width/4,1*height/4).GreyScale()
ca=Crop(0*width/4,2*height/4,1*width/4,1*height/4).GreyScale()
cb=Crop(1*width/4,2*height/4,1*width/4,1*height/4)
cc=Crop(2*width/4,2*height/4,1*width/4,1*height/4).GreyScale()
cd=Crop(3*width/4,2*height/4,1*width/4,1*height/4)
da=Crop(0*width/4,3*height/4,1*width/4,1*height/4)
db=Crop(1*width/4,3*height/4,1*width/4,1*height/4).GreyScale()
dc=Crop(2*width/4,3*height/4,1*width/4,1*height/4)
dd=Crop(3*width/4,3*height/4,1*width/4,1*height/4).GreyScale()

StackVertical(StackHorizontal(aa,ab,ac,ad),StackHorizontal(ba,bb,bc,bd),StackHorizontal(ca,cb,cc,cd),StackHorizontal(da,db,dc,dd))

Regards, Tenra

kwag 05-29-2003 10:17 AM

Thanks Tenra,

That will sure divide the picture in slices fine, but we still need activity "per slice" from previous frames :!:
That would be the only way to apply selective filtering on a "slice", based on activity from the previous "slices" on prior frames.

-kwag

bman 05-29-2003 10:37 AM

@ KWAG , @ Tenra
What a BEAUTIFUL MIND , man , BEAUTIFUL MIND !!!!
It's just me or somebody else can smell something extraordinary is cooking here ??!!!
I have no patience to wait and see what will grow up from this :!: :!: :!:
bman

ARnet_tenRA 05-29-2003 10:49 AM

Quote:

Originally Posted by kwag
Thanks Tenra,

That will sure divide the picture in slices fine, but we still need activity "per slice" from previous frames :!:
That would be the only way to apply selective filtering on a "slice", based on activity from the previous "slices" on prior frames.

-kwag

I know. I am working on just that. I thought I would put this out there to get everyone's creative juices flowing.

Regards, Tenra

kwag 05-29-2003 11:01 AM

Quote:

Originally Posted by ARnet_tenRA
I know. I am working on just that. I thought I would put this out there to get everyone's creative juices flowing.

Oh yes :!:, we're all peeing on our pants right now :) Can't contain our emotions :lol:

-kwag

kwag 05-29-2003 11:04 AM

Quote:

Originally Posted by bman
It's just me or somebody else can smell something extraordinary is cooking here ??!!!

No, it's not only you :!:, my oven (memory) is in "broil" right now :mrgreen:

-kwag

Jellygoose 05-29-2003 11:10 AM

I can't believe no one of us had this kind of idea earlier... :o
It sounds so simple and logical to me... :!:
brilliant :!: :D

ovg64 05-29-2003 11:13 AM

Quote:

Originally Posted by jorel
:?
i need some help ,

please, a full script posted here will be great....
i got errors like DorvalCS.

thanks in advance!
:)

@ kwag, You guy are almost in California and we still here in florida.
can you post a sample script that is ready to cut and paste so we can have a better idea more or less how this works, I know What the Linear Adaptive Script is suppose to do, i just dont know how it works I dont have a programmer's mentallity so it will take 4 me more time to understand.
sorry to be a pain in the a.. :twisted:

thanks again :!:

## Dynamic linear adaptive filtering ##
ScriptClip("val=YDifferenceFromPrevious()/14.55" + "val > MaxThreshold ? MergeLuma(blur(MaxThreshold)) : MergeLuma(blur( val ))")
##

kwag 05-29-2003 11:17 AM

One of the BEST things I like of this, is that there are virtually no blocks on high speed motion :!:
Because of the heavy blur on high speed pannings, what the encoder "sees" is a a frame with no sharp edges at all, and the result is that there are barely any visible blocks seen :!: This brings me to another question: Maybe we don't need 2,300Kbps for MAX bitrate :idea:
Maybe we can drop the MAX to ~2000Kbps, and increase our play time per media :idea:
I'll have to try this 8)

-kwag

kwag 05-29-2003 11:24 AM

Here's the script I used for the sample:

Code:

LoadPlugin("C:\Filters25\MPEG2Dec3.dll")
LoadPlugin("C:\Filters25\STMedianFilter.dll")
LoadPlugin("C:\Filters25\UnFilter.dll")
LoadPlugin("C:\Filters25\BlockBuster.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))

### Dynamic Adaptive Filtering ###
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.
AddBorders(0, 56, 0, 56)
LetterBox(16, 16, 16, 16)
Limiter()


sbin 05-29-2003 11:34 AM

Man, I go away for a couple of days and you guys just tear everything up. :lol:

rendalunit 05-29-2003 12:18 PM

I'm going nowhere fast! :lol:

"Blockbuster.dll is not an Avisynth 2.5 plugin"
"STMedianFilter.dll is not an Avisynth 2.5 plugin"
"I don't know what subblur means"
"Unfilter.dll is not an Avisynth 2.5 plugin"

i installed Avisynth 2.51 build May 21, 2003
and the filters are for 2.5x

help!!
:lol:


All times are GMT -5. The time now is 02:04 AM  —  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.