View Full Version : Let's share your favorite Avisynth scripts! :)
lovelegend
17th July 2002, 19:33
Hi guys, I'm a newbie, and in these five days I did read the "Avisynth Q&A" and some of the related links. However, I found that there's a lack of REAL examples. Even the tutorial posted on the avisynth website (http://math.berkeley.edu/~benrg/avisynth-tutorial.html) just tells you how to join clips, reduce the size by 2, stackvertical, etc, which are actually not practical.
Therefore, I would like to ask if you could post your favorite Avisynth scripts, with a brief discription of what does your script do, like 'For converting DVDrip avi file into SVCD (mpg-2) file'... so newbies like me could have a reference and a point to start with. Thank you very much!!! :)
kayman
17th July 2002, 19:42
friend wrote a gui to help automate the avs process and cce so this is a paste from the ini. this script is for tv caps this the +trims function so i can edit out commercials
this script is for a mpeg 2 SCVD but hte encoding is done in CCE then a pulldown is run after cce encoding
telecide decimate commands bring the frame rate down to 23.976 from 29.97
unfilter and temporal soften help to reduce the small amount of noise bt smoothing the unfilter sharpens the image after the smotthing
TemporalSoften2(2,5,5)
[AVSINFO]
BLACKNESS = YES
BLACKNESSB = 5
BLACKNESSE = 5
NUMENTRIES = 11
AVSENTRY1 = LoadPlugin("f:\Decomb.dll")
AVSENTRY2 = LoadPlugin("f:\SimpleResize.dll")
AVSENTRY3 = LoadPlugin("f:\TemporalSoften2.dll")
AVSENTRY4 = LoadPlugin("f:\UnFilter.dll")
AVSENTRY5 = +AVI
AVSENTRY6 = TemporalSoften2(2,5,5)
AVSENTRY7 = unfilter(40,40)
AVSENTRY8 = Telecide()
AVSENTRY9 = Decimate()
AVSENTRY10 = +TRIMS
AVSENTRY11 = SimpleResize(480,480)
cardboardguard
22nd July 2002, 22:58
Originally posted by kayman
friend wrote a gui to help automate the avs process
any chance you could put it up somewhere or attatch it? i'd like to see/try it. :)
kayman
23rd July 2002, 00:18
no sorry i work for a SVCD tv release group , stickly memebers only :)
but as a tease it works really well stream lines us to get it edited out encoded with the push of a few buttons
kayman
h00z
23rd July 2002, 14:34
I mostly encode anime, and my scripts usually go something like this:# Battle Angel Episode 1 DivX;-) AVISynth Script
# --- Load Plugins ---
LoadPlugin("C:\Program Files\DivX Apps\Avisynth\mpeg2dec_.dll")
LoadPlugin("C:\Program Files\DivX Apps\Avisynth\decomb.dll")
LoadPlugin("C:\Program Files\DivX Apps\Avisynth\simpleresize.dll")
LoadPlugin("C:\Program Files\DivX Apps\Avisynth\temporalsoften2.dll")
LoadPlugin("C:\Program Files\DivX Apps\Avisynth\avisynth_spatial.dll")
LoadPlugin("C:\WINDOWS\System32\vobsub.dll")
Import("D:\_avs-files\vdub_filters.avs")
# --- Load Video Clip ---
mpeg2source("D:\ba1\ba1.d2v")
# --- Crop ---
Crop(12,2,700,478)
# --- Decomb.dll Settings ---
Telecide(chroma=true,gthresh=50,guide=1,threshold=30)
Decimate(cycle=5)
# --- Smoother ---
TemporalSoften2(1,10,1)
SpatialSoftenMMX(1,1,0,false,false,10,10,1,1)
# --- Resize ---
SimpleResize(512,384)
# --- Sharpen ---
ConvertToRGB()
VD_WarpSharp(20)
ConvertToYUY2()
# --- Subtitles ---
VobSub("D:\ba1\vts_03_0")I haven't tried the sharpening capabilities of the new "Unfilter" yet, but it might eventually replace my WarpSharp filter since it works in native YUY2 space (saving some time on the conversion to RGB and back).
theReal
27th July 2002, 03:20
Get GordianKnot and create an avs script. It's a good starting point as it contains almost all important options. I learned avisynth through this script (plus the reference guide). I still use the Gknot script as a starting point for almost all avisynth jobs.
Richard Berg
27th July 2002, 07:46
GKnot is only good for DVD ripping, and not very good at that (for avisynth, no doubt it gets the job done WRT actually ripping).
theReal
27th July 2002, 11:32
Well, of course you can (and have to) change the GKnot script, but as a starting point and a good example how to make a script with many options, I think it's quite good.
In the meantime, almost no value is left original and I add many other filters (if I need any filters at all).
btw for ripping a normal PAL DVD, I find it best not to have too many filters and stuff. I like this script, it's what GKnot actually uses, and I don't see what could be better about it (because there's almost nothing in it):
LoadPlugin("E:\GORDIA~1\mpeg2dec.dll")
mpeg2source("G:\DVD Rips\test.d2v")
trim(startframe,endframe)
crop(0,68,720,445)
BicubicResize(704,304,0,0.5)
Now, for something a little more complicated, I change the script, of course. I'm just encoding Schindler's List. The source is a Chinese DVD which has been copied from LD. (The quality is quite ok, btw)
LoadPlugin("E:\GORDIA~1\mpeg2dec.dll")
LoadPlugin("E:\GORDIA~1\InverseTelecine.dll")
mpeg2source("G:\[ DVD Rips ]\Schindler\Schindler.d2v")
trim(0,342529)
InverseTelecine(44,11,95)
crop(8,69,704,351)
TemporalSmoother(4,1)
(The resizing is done in VDub with Precise Bilinear, and yes, I tried Decomb/telecide, I also tried other IVTC() values, I tried GreedyHMA and I tried to ivtc manually with doubleweave() and pulldown(), but InverseTelecine(44,11,95) seemed to give the best results)
So, if I start from scratch or if I take the Gknot script as a starting point, I end up with the same commands, I think.
Acaila
27th July 2002, 13:48
Normally I don't use any filters except crop and resizing, but if I find a slightly noisy DVD I use this one (already discussed in the XviD section here (http://forum.doom9.org/showthread.php?s=&threadid=28127)):
Source=MPEG2source("D:\DivX Rip\DivX\X-Men\X-Men_64bit.d2v").Crop(16,74,696,432)
Temporal=Source.TemporalSoften2(1,5,25).MergeChroma(Source)
Spatial=SmoothHiQ(Temporal,3,25,10,192,3).MergeLuma(Temporal)
Movie=Spatial.Trim(0,136800).BicubicResize(672,288,0,0.5)
Credits=Trim(Source,136801,0).TemporalSmoother(10).BilinearResize(672,288)
Return Movie+Credits
Most movies gain a bit of pixel noise mostly coming from BicubicResize in combination with MPEG quantizer in XviD. This script cleans it up nicely without loosing detail.
For noisier movies increase the thresholds some more, but you'll start losing detail as well.
The thing with the credits I have always used since it is a nice way to get the credits size down (in combination with a high quant encoding)
Marc FD
27th July 2002, 13:51
Sorry i don't have favorite scripts :
I write a new for each encode/movie.
@ Acalia :
try this one :)
Source=MPEG2source("D:\DivX Rip\DivX\X-Men\X-Men_64bit.d2v").Crop(16,74,696,432)
Temporal=Source.Cnr2() #Or Cnr2Ex for tweaking
Spatial=SmoothHiQ(Temporal,3,25,10,192,3).MergeLuma(Temporal)
Movie=Spatial.Trim(0,136800).BicubicResize(672,288,0,0.5)
Credits=Trim(Source,136801,0).TemporalSmoother(10).BilinearResize(672,288)
Return Movie+Credits
i would like if you could say what do you think of my filter,
and it's exactly defined to do Temporal Chroma Denoising :)
Acaila
27th July 2002, 14:18
In that case you're not exactly getting the inner workings of my script. It does temporal luma smoothing, and spatial chroma smoothing.
EDIT:
I tried out your CNR2 as a replacement of SmoothHiQ, and I couldn't detect any obvious differences in output (with my short test anyway). However the file with CNR2 was approx. 3.5% smaller (constant quality 100%).
Oh, and it was a bit faster too :)
Marc FD
27th July 2002, 14:43
I don't get it...
MergeChroma is in fact adding chroma to the temporal
denoised luma??
Ok, i'm wrong. I just didn't know how work MergeLuma and MergeChroma.
Why do you prefer using temp denoising on luma and spatial denoising on chroma ??
Maybe you try to remove high-frequency chroma noise,
which is the more frequent. I would aggree with you that
a spatialsmoother is better for high-freq noise.
BUT cnr2 is _designed_ to stabilize/denoise the chroma low AND high
frequencies noise : i think it's better than a usual tempsmother
for that : It's not just a tempsmother on chroma plane : the algo
is far away from that. In fact you could just try it like this :
Source=MPEG2source("D:\DivX Rip\DivX\X-Men\X-Men_64bit.d2v").Crop(16,74,696,432)
Temporal=Source.TemporalSoften2(1,5,25).MergeChroma(Source)
temp2=Cnr2.MergeLuma(Temporal)
Movie=temp2.Trim(0,136800).BicubicResize(672,288,0,0.5)
Credits=Trim(Source,136801,0).TemporalSmoother(10).BilinearResize(672,288)
Return Movie+Credits
That's a modified script with the acaila-spirit :)
say me if it's really horrible (it's my filter after all)
Thx.
PS : I don't pretend my filter will give better results, but since you haven't tried it :)
dividee
27th July 2002, 18:54
@Acaila
Just some optimizations on script:
MergeChroma is not necessary since you only keeps luma from this clip with MergeLuma later. Also, instead of TemporalSmoother(10) for credits, something like TemporalSoften2(1,40,40) is faster and should do the job just as well.
Do you still see the "green shift" bug? With the new Compare/PSNR debugging filter from Marc & me it has become easier to quantify this problem. I have to say that a lot of filters exhibit this problem, and of course it's only made worse when you're chaining filters. They'll slowly be fixed, one by one. I guess you saw the new version of SmoothHQ sh0dan posted which correct this problem.
[EDIT:] Sorry for being OT
Acaila
27th July 2002, 19:53
@Marc FD:
Why do you prefer using temp denoising on luma and spatial denoising on chroma ??Temporally or spatially smoothing on the chroma plane hardy gets rid of any noise. On the other hand when done on the luma plane it denoises very well (because we can't see differences in chroma as soon as in luma). Spatial filtering can cause blurring very soon, temporal is much safer in that respect. Combine these two things and temporal+luma and spatial+chroma makes very much sense to me, and my results show this as well. These are my findings though, perhaps others disagree.
So the major part of my denoising is done by the temporal filtering, the spatial chroma part only attributes a very small amount (it's just there to catch the leftovers).
In fact I just ran a test series (2500 frames, 100% quality mode) with various components of my above script (to see how your filter worked):
Filter Size Reduction Result
Unfiltered 20022 0,0% Noisy
Cnr2 19276 3,9% No difference over non-filtered
SmoothHiQ 19950 0,4% No difference over non-filtered
TemporalSmoother 17554 14,1% Much less noise
TemporalSoften2 18186 10,1% Less noise
TemporalSmoother + Cnr2 16721 19,7% Much less noise, no difference over TemporalSmoother alone
TemporalSmoother + SmoothHiQ 17478 14,6% Much less noise, no difference over TemporalSmoother alone
TemporalSoften2 + Cnr2 17350 15,4% Less noise, no difference over TemporalSoften2 alone
TemporalSoften2 + SmoothHiQ 18112 10,5% Less noise, no difference over TemporalSoften2 alone
Filtering in the chroma plane didn't produce any visible difference (not even a single pixel shift, quite remarkable), but it did benefit compression. So based on these tests I'd say the combination TemporalSoften2 + Cnr2 is a very good candidate for denoising :).
@Dividee:
Thanks to all of you for finding and fixing the cause of that chroma shift.
MergeChroma is not necessary since you only keep luma from this clip with MergeLuma later.Yeah I guess your right, but it made sense to do it like that. I never looked at it in a way to optimize it :)
Also, instead of TemporalSmoother(10) for credits, something like TemporalSoften2(1,40,40) is faster and should do the job just as well.As far as I have seen TemporalSmoother always results in higher compression that TemporalSoften2. The latter pretty much always retains more detail, but what I was looking for, for the credits part, is higher compression not detail.
13242 frames (black & white text)
TemporalSmoother(10): 8826 kb
TemporalSoften2(1,40,40): 10060 kb
Question:
How can I use the Layer/Mask/PSNR filters to see in more detail what (and how much) my filter chain smoothes? So far I'm getting a PSNR value about 45-50 (is that good?), but I'm entirely sure I'm using it correctly.
Marc FD
27th July 2002, 21:15
First, acalia, great work :cool: !
A very good PSNR would be around 60.
but 45-50 average is a good quality.
after all, don't forget if your source is
more noisy than your result, the PSNR would
not have a real signification...
To test/compare filters i use See.dll in
Subtract(a,b).See(0,min,max).levels(min,1,max,0,255)
combinaisons :
- 128-130 for low-freq noise,
- 131,140 for med-freq noise and
- 141,160 for high-freq noise.
The thing i prefer is to use See(5) (HSL:S)
and See(7) (HSL:H) It acts like a revelator
and show you things you would never suspect
(like the monstruous ugly quantisation from
DivX 5 on chroma...)
If you don't see chroma differences using
the UV mode from see can help you.
(I designed it first to compare chroma
channels)
What i can say from my exp. is that chroma is not
very noticable, and it's why there is huge noise
on it. I tested my filters on a very noisy VHS
encode (dancing chroma) and it gived me a better
output. since it's real-time capable, i would really
like to use it like a post-processor, but AviSynth
_lacks_ mp3 decoding (hope richard hear my prayer :) )
@Dividee
Would a new avs be soon on sourceforge ??
I really need compare (for my benchmarks) :)
BTW, could you send me the last compare source ??
i will see if i can correct some bugs or add
cool features :D
@All
I'm going to make advanced benchmarks on all
avisynth filters. I've done a whole testing
protocol. I would make my first "paper" on the
Resize filters : "The true about avs resizers" :)
I could get sticky or doom9 could add it somewhere.
I will try to make something like a "reference".
I think it could help lots of people (and me too ;) )
Wait'n'see :cool:
EDIT : sorry it was "levels" not "layers" :rolleyes:
lovelegend
28th July 2002, 00:52
@@........ you guys are too pro....
I think I still have a long way to go... :rolleyes:
Originally posted by Acaila
Normally I don't use any filters except crop and resizing, but if I find a slightly noisy DVD I use this one (already discussed in the XviD section here (http://forum.doom9.org/showthread.php?s=&threadid=28127)):
So noise would be produced if the movie was resized? (Since I always think the noise reducing filters are needed for analog source, such as VHS --> avi) And if we're going to resize an avi into let say mpg-2, then we should use noise reducing filters, right? :rolleyes:
Also, where could I get more information about Temporal filtering and spatial filtering on luma and chroma planes? I think many newbies like me would like to know more about this. However, just take this thread as an example, your discussion is far out of my knowledge already... ^^" Therefore, I hope you guys could show us the way for the first step (this is also the reason for me posting this thread)... :) (Don't hit me if it's on Avisynth reference guide, since I haven't finished reading it.... :D )
Also, how to calculate the PSNR? And is it meaningful if I just wanna convert avi into SVCD?
theReal
28th July 2002, 12:44
lovelegend, don't worry too much about chroma and PSNR if you're just about to write your first working avisynth script.
Better use, like I said, the Gknot avisynth files as an example, or the easy script I posted above.
Resizing doesn't produce noise, resizing actually works as a noise filter (bilinear resizing reduces noise more than bicubic).
You need noise filters primarily for analog sources, but some DVDs are also made from analog sources, or they are artificially made to look like they were analog ("film-effect").
As a rule of thumb, don't use any filtering unless you need it. You need filtering if the source looks really bad already, or if it doesn't compress well enough.
As a good and easy noise filter I'd recommend temporalsmoother(2,1) (where 2 is the strength and 1 is the radius, also change the values to see what they do). Up to this point, I'd say it's really easy :)
From what I read here, I think I have to look a little further into chroma denoising - I guess it can make tv captures more compressible with almost no impact on the actual looks of the video. I don't think it's so important for DVDs, where I try to get good results without filtering.
MoonWalker
28th July 2002, 13:25
@Acaila
Are you using any parameteres at cnr2?? Of just plain like this :
Source=MPEG2source("D:\DivX Rip\DivX\X-Men\X-Men_64bit.d2v").Crop(16,74,696,432)
Temporal=Source.TemporalSoften2(1,5,25).MergeChroma(Source)
temp2=Cnr2().MergeLuma(Temporal)
Movie=temp2.Trim(0,136800).BicubicResize(672,288,0,0.5)
Credits=Trim(Source,136801,0).TemporalSmoother(10).BilinearResize(672,288)
Return Movie+Credits
Is this you canditate script?? :) Is the MergeChroma(Source) needed?
EDIT : @MarcFD I have tried this filter chain with Cnr2 (in Vdub) but I sais "invalid arguments to funcions Cnr2"..I have avisynth 2.02
MoonWalker
Acaila
28th July 2002, 14:13
@MoonWalker:
Source=MPEG2source("D:\DivX Rip\DivX\X-Men\X-Men_64bit.d2v").Crop(16,74,696,432)
LumaFiltered=Source.TemporalSoften2(1,5,25)
ChromaFiltered=LumaFiltered.Cnr2().MergeLuma(LumaFiltered)
Movie=ChromaFiltered.Trim(0,136800).BicubicResize(672,288,0,0.5)
Credits=Source.Trim(136801,0).TemporalSmoother(10).BilinearResize(672,288)
Return Movie+CreditsI changed the variable names to more appropriate ones :)
I'm guessing a Layer() and a Mask() command thrown in at the right places could make all this filtering work a lot better, if only I knew how to use them. Documentation is too technical IMO and thus not very helpful unless you have a solid background in that sorta stuff (sorry Poptones :().
If someone can make a n00b-readme for these two commands with some good examples, it'd be much appreciated :)
Marc FD
28th July 2002, 23:10
@moonwalker
it didn't work because you didn't gave im a implicit clip arg :)
@Acaila
I don't see how you can use mask/layers to have better
results ?? what are these filters desingned too ??
@lovelegend
No pb, we aren't discuting about something very special.
I think you will very soon understood everything.
You just lacks a little practice :)
MoonWalker
28th July 2002, 23:25
@MarcFD..
Yes yes I know :devil: :devil:....My quickness...
Well I just started a test...I goes with 20-21 fps(whereas a bicubic resize was going 28-29)...I am doing The Matrix.
I did quick test comparing the d2v and the script and saw clear difference in noise..Much less noise..And with a very small smoothing of the backround only(I saw some woods that were smoothed a little :)), but it's not visible when playing the movie...
I will post as soon as it finishes...
MoonWalker
lovelegend
29th July 2002, 03:08
@theReal
Yeap, I think I've got your point... :rolleyes:
Btw, I've visited the Gknot website and it says it will choose a suitable resize filter for you, but if I write avisynth myself, then which filter should I use? :confused:
@Marc FD
But if I don't know the nature of the filters and how does they work, then how could I understand them? Or you mean I should test the filters myself and find those which are suitable for me? :rolleyes:
theReal
29th July 2002, 07:49
The filters Gknot uses are either:
#BicubicResize(640,464,0.333,0.333) "Soft Bicubic"
# or
#BicubicResize(640,464,0,0.5) "Neutral Bicubic"
# or
#BicubicResize(640,464,0,0.75) "Sharp Bicubic"
# or
#SimpleResize(640,480)
Bilinearresize is not good, only use it for credits. I try to use Neutral Bicubic always. Sharp Bicubic sharpens a bit (and indeed adds some noise), Soft Bicubic blurs a bit (but compresses better.
Simple Resize is a Bilinear Resizing, but it looks quite ok and it is very fast
lovelegend
29th July 2002, 08:36
@theReal
Oh, i see, thanks!
Another question, why do you use IVTC in your script? I've read some discussions, I know what's IVTC. However, I don't know when and why (any benefit?) should I use IVTC... (and when shouldn't I use IVTC?)
Recently I just need to convert avi's into SVCD's, then do I need to do IVTC? :confused:
theReal
29th July 2002, 08:42
I have only used it once, for converting an NTSC DVD to Divx (it was a little complicated because the DVD had been made from Laserdisc)
Usually, I'm converting only PAL stuff and there's absolutely no need for ivtc.
You only need ivtc if you want to convert partially interlaced (telecined) 29.97fps material to progressive 23.976fps material.
lovelegend
29th July 2002, 08:52
Originally posted by theReal
I have only used it once, for converting an NTSC DVD to Divx (it was a little complicated because the DVD had been made from Laserdisc)
Usually, I'm converting only PAL stuff and there's absolutely no need for ivtc.
You only need ivtc if you want to convert partially interlaced (telecined) 29.97fps material to progressive 23.976fps material.
So all the avi's with 29.97fps can be IVTC to 23.976fps, right? But what's the point of doing that? Someone said the flow of the film would be more smooth (on PC, if I remember right), someone said the filesize would be smaller. http://arbor.ee.ntu.edu.tw/~jackei/dvd2avi/ivtc/ says only 30fps telecined from 24fps can be converted back to 24fps by IVTC, but if I've got a DVDrip (avi), how do I know it's telecined or not? :confused:
P.S. Am I off-topic? No, I'm still discussing the AviSynth script... :D
Marc FD
29th July 2002, 10:07
Originally posted by lovelegend
Or you mean I should test the filters myself and find those which are suitable for me? :rolleyes:
Yes. The only way is to test/tweak/try/play with the filters.
I'm going to make very complete benchmarks on avisynth filters.
My first bench would be on resizers.
It could be interessing for you :)
I'm going to work now :D
theReal
29th July 2002, 10:42
lovelegend,
you can only ivtc TELECINED 29.97fps material, that means it has been converted from progressive 24fps film to 29.97 ntsc before. Then you convert it back to the original by removing all of the artificially inserted, interlaced frames. The result looks better than deinterlaced 29.97fps material, because it is truly progressive scan without any interlacing artefacts.
23.97fps compresses a lot better than 29.97fps, so you also gain quality. For example Schindler's List, the DVD I just mentioned, got a Gknot compress test value of 44% at a resolution of 576x320 with 29.97fps deinterlaced.
With ivtc, motion scenes look better, and the movie got a compress test value of 52% at a 640x352 resolution. So, in the end, it looks WAY BETTER in 23.97fps.
You cannot, however, ivtc any 29.97fps material. If the movie has been filmed with a camcorder, or it has been produced for tv, then it most certainly is true 29.97fps, all frames interlaced, nothing you can remove.
MoonWalker
29th July 2002, 12:47
I can say one think...Superb..I haven't see so good image quality...I have The Matrix 2-CD rip (with just a BicubicResize(0,0.5)) and The Matrix 2-CD rip(with acaila's filter chain)..XviD compressed, MPEG Quant(That adds more noise)..Well the result was very very obvious..The one with acaila's filter was excellent..No noise at all..And when playing the movie no visual smoothing(only if you pause the movie and observe __VERY__ carefully)...The only con is tha I had about 18-19 fps whereas the plain resize was 27-28..But I don't care since I am a fan of quality :p :p
MoonWalker
Acaila
29th July 2002, 13:56
@Marc FD:
I took a closer look at using your Cnr2() in that filter chain of mine. At first sight it was very good (as I mentioned earlier), higher compression, negligible detail loss.
However on closer examination I noticed a kind of 'chroma ghosting' effect. During fast motion the residual chroma image would linger a frame or two behind the real image (which at 25fps during playback won't be noticable, that's why I didn't see it earlier). This can probably be reduced/avoided by using custom settings, however it still means the default values are too aggressive.
One other thing, could you please clarify if this Cnr2 of yours is temporal or spatial? I believe it's temporal, but I don't think I've seen you mention it anywhere. And I've never used the original Cnr filter.
Marc FD
29th July 2002, 15:10
It's a temporal filter. I've said it already before (maybe on an another thread?) and i think it's written in the readme
(i've ommited it ??)
But when normal temporal filters could only remove low frequency noise, this filter can remove more noise, and it's damn faster :)
If you want to have an impressive result with this filter, test it on noisy analog sources (TV,VHS) it would lead to good improvements in quality and compressibility.
Of course on DVDs (who are less noisy on Chroma), it wouldn't be very impressive...
I'd like to add that the only side-effect is chroma ghosting and not bluring. This filter would never blur chroma.
Do you saw chroma ghosting on evey action scenes, or only on explosions/SpecialFXs ??
lovelegend
29th July 2002, 20:21
@theReal
I will try it myself and see, thanks anyway! :)
@Marc FD
Of course I'm interested! :D
Waiting for your report! ;)
soujir0u
30th July 2002, 11:31
Hi, I tried using Acaila's filter chain, and am trying to adapt it for anime encoding. I increased the diameter value to 7 for SmoothHiQ, but it turned everything into red! Messing around with the Chroma and Luma values (2nd and 3rd values I think) solved the problem, but I'm still not sure as to what these values are for, and how they affect the picture... Can anyone help? Thanks!
sh0dan
30th July 2002, 12:54
documentation (http://cultact-server.novi.dk/kpo/avisynth/smooth_hiq_as.html)
Simpler put:
The higher the threshold is, the more blurred your image will become (and more noise be eliminated). Luma is light-value, and chroma is color value. Usually it is a good idea to have a higher chroma threshold, since there is often more noise in the color.
Regarding the 'reddishnes' - are you using the latest (1.01) - just released a few days ago?
Anyway, there is a new version up tomorrow, with some new features to be tested.
soujir0u
30th July 2002, 13:01
Yes, I'm using 1.01. Maybe it's because my luma value was higher than the chroma...
Um, Acaila, what do you mean by a normal setting? Would that be using the same value for both Luma and Chroma?
Edit: ??? Suddenly the post by Acaila disappeared!
Acaila
30th July 2002, 13:08
@sh0dan:
A small clarification please.
If chroma difference > chroma threshold but luma difference < luma threshold does your filter still smooth the chroma channel or doesn't it do anything for that pixel.
I.e. is it:
1) IF chroma difference > chroma threshold AND luma difference > luma threshold THEN blur chroma and blur luma
Or 2) IF chroma difference > chroma threshold THEN blur chroma
IF luma difference > luma threshold THEN blur luma
soujir0u
30th July 2002, 13:11
Would you guys like to look at my script and suggest some improvements please? Thanks!
# Start
mpeg2source("D:\1\1.d2v")
Telecide(post=false)
Decimate(cycle=5)
ConvertToRGB()
VD_AreaBasedDeinterlace(false, "blend", 27, 50, false, 0)
VD_SmartDeinterlace("both","luma",false,true,true,false,20,100)
crop(17,4,686,472)
ConvertToYUY2()
SmoothHiQ(7,15,15,254,0)
ConvertToRGB()
VD_WarpSharp(20)
ConvertToYUY2()
TemporalSoften2(1,5,25)
BicubicResize(592,336,0,0.5)
# End
I use Area Based Deinterlacer + Smart Deinterlacer to clean up any remaining combed frames as it's better than Decomb's postprocessing. SmoothHiQ + Warpsharp to clean up the noise and sharpen it a bit (good for anime!). I'm not sure what settings I should use for SmoothHiQ and TemporalSoften2, so I just threw in some numbers based on other posts on this forum. :p
Acaila
30th July 2002, 13:12
@soujir0u: I deleted it after I saw that sh0dan posted the same thing when I was writing mine :D
Anyway, I said that for anime you don't need to smooth ONLY the luma plane for TemporalSoften and ONLY the chroma plane for SmoothHiQ. For anime you can generally smooth much more because the amount of detail to keep is much less, so just chain a TemporalSmoother with a SmoothHiQ without all the extra things I had in my chain.
e.g.
MPEG2Source=(".....")
Crop(...)
TemporalSmoother(...)
SmoothHiQ(...)
SimpleResize(...)
etc.etc.
Acaila
30th July 2002, 13:19
My suggestions for your scipt:
- I doubt you really need that many deinterlacers...
- TemporalSmoother(2) or a TemporalSoften2 with higher settings than what you're using now.
- SmoothHiQ(7,25,15,192,3) (<- works good for me)
- For anime I'd use SimpleResize instead of Bicubicresize because the lines aren't as sharp as on normal movies and the general amount of detail is lower too.
But I haven't done many anime so someone else can probably help better for specific settings.
Ps. check the posting times, this feels like live chatting :)
sh0dan
30th July 2002, 14:54
Originally posted by Acaila
@sh0dan:
If chroma difference > chroma threshold but luma difference < luma threshold does your filter still smooth the chroma channel or doesn't it do anything for that pixel.
No - luma and chroma BOTH have to pass for the pixel to be included in the current pixel. To do what you suggest, you will have to smooth each colorspace seperately, and use merge to get them together. For this, you of course have to set threshold on the non-processed colorspace to 255.
#Smooth only chroma plane, and do not take luma into consideration
avisource("")
chromasmooth=smoothiq(7,255,30,192,3)
mergechroma(chromasmooth)
I would not recommend doing so, because weight with difference will be almost disabled, because max difference is 255.
@soujir0u: Damn - you have many yuy2->rgb->yuy2 conversions - be aware, that this process isn't lossless. You might also want to try using higher threshold for chroma values (25-30) in the SmoothhiQ.
soujir0u
31st July 2002, 00:55
Thanks for your suggestion guys. I've decided to simply use VirtualDub in Full Processing mode due to too many RGB filters that I have to use... But it's kinda slow, about 3fps. :(
Marc FD
31st July 2002, 10:44
3 fps !!!
It's slower than vlad's Convolution3D or my M.A.M. !!
I think you should search more :
There IS a way to do better filtering only in YUY2 colorspace :
Try the new filters (see "smooth in time and space" thread)
you should be able to encode @ ~10 fps....
soujir0u
1st August 2002, 06:00
Hmm... But I want to use Warp Sharp which only works in RGB mode... I'll try using Mpeg2dec's built-in Smart Deinterlace and the other filters your mentioned and see if I get some speed increase.
Marc FD
1st August 2002, 11:48
I used WarpSharp too, but i wiould prefer an avisynth filter who can do the same thing. maybe unfilter ??
lovelegend
2nd August 2002, 10:34
I've got another problem..... Before sh0dan posted the new thread (http://forum.doom9.org/showthread.php?s=&threadid=30354&highlight=smoothhiq), I tried to use Acaila's filter chains. However, I didn't have SmoothHiQ filter, so I did a search and found that it's a Virtual Dub plugin. I then followed the instruction in Avisynth Q&A, copied and pasted the function to a new SmoothHiQ.avs file with the function referred to the SmoothHiQ.vdf (I don't know if I was right, but for the function I just changed the directory to refer to SmoothHiQ.vdf). And then use import() to import the SmoothHiQ.avs..... but I got the Script error: expected "val", "bool", "int", "float", "string", or "clip".
Her is my simple script:
test=AVISource("path\testclip.avi")
import("F:\ASDLL\VDubFilters\SmoothHiQ.avs")
SmoothHiQ(test,3,25,10,192,3)
Here is the SmoothHiQ.avs
function VD_SmartSmoothHiQ(clip clip, int "diameter", int "threshold", int "amount",
string "mode",
\ bool "weighted_difference", int "maintain_diffweight", bool "visualize_blur", bool "grayscale")
{
LoadVirtualdubPlugin("path\SmoothHiQ.vdf", "_VD_SmartSmoothHiQ")
mode = default(mode, "weighted")
mode = (mode=="average") ? 0 : (mode=="weighted") ? 1 : -1
Assert(mode>=0, """VD_SmartSmoothHiQ: "mode" parameter must be "average" or "weighted"""")
return clip._VD_SmartSmoothHiQ(default(diameter,5), default(threshold,50), default(visualize_blur,0), default(amount,254),
\ mode, default(grayscale,false)?1:0, default(weighted_difference,true)?1:0, default(maintain_diffweight,0))
}
Then I kept searching and found that avisynth had a function called 'LoadVirtualDubPlugin', I then used it but it had another Script error: invalid arguments to function 'SmoothHiQ'. I just want to know what did I do wrong (in both indirect and direct methods)...
P.S. I noticed that the function in SmoothHiQ.avs had 8 arguments (exclude the argument 'clip'), but both Acaila and soujir0u put only 5 arguments... um..... :rolleyes:
Wilbert
2nd August 2002, 11:09
That's because you messed up two different filters! A VirtualDub filter called Smart Smoother HiQ and an AviSynth filter called Smooth HiQ.
The VirtualDub version can be used as follows:
# example:
# ConvertToRGB()
# VD_SmartSmoothHiQ(5,50,254,"weighted")
# ConvertToYUY2()
1) Note there is a mistake in the script, you should replace default(visualize_blur,0) by default(visualize_blur,0)?1:0 (my mistake sorry). You can do that in Notepad.
2) You can just import the vdub_filters (a pointer can be found in Q&A) in your script, thus:
import("F:\ASDLL\VDubFilters\vdub_filters.avs")
test=AVISource("path\testclip.avi")
test2=ConvertToRGB32(test)
VD_SmartSmoothHiQ(test2,5,50,254,"weighted")
or what is the same:
import("F:\ASDLL\VDubFilters\vdub_filters.avs")
AVISource("path\testclip.avi").ConvertToRGB32()
VD_SmartSmoothHiQ(5,50,254,"weighted")
In the url you gave smoothiq (http://forum.doom9.org/showthread.php?s=&threadid=30354) you can download the AviSynth version (note that this contains a dll-file: SmoothHiQ.dll). Which can be used as follows:
LoadPlugin("F:\SmoothHiQ.dll") # or wherever you put it
ConvertToYUY2() # probably not necessary
SmoothHiQ(7,15,15,254,0)
Please have a look at Q&A: Q21, Q27 and Q32.
theReal
2nd August 2002, 11:10
lovelegend, first I had the same problem because there are two versions of smoothhiq.
You can find the avisynth version here:
http://forum.vcdhelp.com/userguides/99389.php
It's not on Donald Graft's site (only the VDub version) and nowhere else. I wonder why, it's a good filter...
**EDIT: Wilbert, you were faster :)
lovelegend
3rd August 2002, 03:51
Oh, it's my mistake then, thanks for telling and giving me the link for the filter. Thanks Wilbert and theReal...
However, I'm leaving and I will read the steps for importing virtual dub plugins later........ :)
Shayne
4th August 2002, 14:02
Hi guys this thread is helping me out greatly on my TV captures since i am a newbie to tv always using dvd prior.
I ussally run vdubs filters
stevens/avery dynamic noise deduction and
avery warp sharpen
but its slow
I just have 1 question
it appears to me that some of these scripts run filters prior to decomding or droping the frame rate. Why would i want to do this is there some avantage to cropping a droped frame or runing any filter prior to decomb
theReal
4th August 2002, 19:29
it appears to me that some of these scripts run filters prior to decomding or droping the frame rate.
Which ones do you mean? I haven't seen any scripts that do this (and I also think it wouldn't make any sense to do so).
You can run smoothing filters before resizing to make filtering artefacts less visible, but to run smoothing filters before ivtc or deinterlacing would only reduce the effectiveness of ivtc and deinterlacing filters and result in a crappy video.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.