digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Video Encoding and Conversion (http://www.digitalfaq.com/archives/encode/)
-   -   MA script for avi? (http://www.digitalfaq.com/archives/encode/7660-ma-script-avi.html)

CheronAph 01-13-2004 10:49 AM

MA script for avi?
 
I just tried an MA script for avi like this,

AviSource("xxx")

Trim(1, 0)
BlindPP(cpu=4)
Blockbuster(method="noise",detail_min=1,detail_max =3,variance=0.1,seed=1)
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)

LanczosResize(544, 336, 0, 0, 576, 240)

TextSub("xxx")

Undot()
TemporalSoften(2,7,7,3,2)
DCTFilter(1,1,1,1,1,1,0.5,0)
Blockbuster(method="noise",detail_min=1,detail_max =10,variance=0.3,seed=5623)

ScriptClip(" nf = YDifferenceToNext()" +chr(13)+ "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(0, 120, 0, 120)
LetterBox(16, 16, 16, 16)

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


I got a CQ of 56,790, with the normal script I got 51,715!
Is there any reason I shouldnīt use the MA script?
It looks very good!

PS. Itīs faster too!

incredible 01-13-2004 11:00 AM

I don't know what do you mean with "normal script", .. which one? As I assume the last optimal script?

At the first view I see you are using the second blockbuster in front of TemporalSoften() .... so put the second one in front of Addborders() cause Temporalsoften() in the ma routine will "clean" the purpose of your second Blockbuster if you put it before the ma routine!

And by the way you do double TemporalSoftening .... one at the beginning which treats in a static mode and another one in the ma routine which works ma based. This could cause "swimming" and "static artefacts" in your encoding.

Dialhot 01-13-2004 11:13 AM

Quote:

Originally Posted by incredible
And by the way you do double TemporalSoftening .... one at the beginning which treats in a static mode and another one in the ma routine which works ma based. This could cause "swimming" and "static artefacts" in your encoding.

And I would add : You added to a script that is already "complete" a second filtering pass. But are you sure the result is acceptable (watchable)?

Note: the script can't be faster in anyway. Adding filters never increase the speed :-)

CheronAph 01-13-2004 11:24 AM

If I move the second blockbuster or remove it, the encoding time jumps to 20 hours, normally itīs 3 hours! The movie is 100 minutes long!

Dialhot 01-13-2004 11:28 AM

Quote:

Originally Posted by CheronAph
If I move the second blockbuster or remove it, the encoding time jumps to 20 hours, normally itīs 3 hours! The movie is 100 minutes long!

Did you try to encode a little part of the movie (let say 5 min) and watch it completly ? The faster encoding time let me think about an error.

CheronAph 01-13-2004 01:42 PM

I did a 5 minute clip and theres nothing wrong with it!

incredible 01-13-2004 02:02 PM

ok, 5mins but anyhow, above you're performing a Triple Temporal filtering job (Convo3D - TempSoften - Tempsoften) ! And that's not the way. Especially in cases of mid motion you get into the risk that contours of abjects/peoples begin to swim as I told you. Just watch the Backgrounds and their static "Grain" effect.

Well I don't know your source condition (where all bases on) but I speak out of experiences :)

At least kick out that Temporalsoften of the ma and replace it by a Unfilter(0,0) ... as you already do non-stop-static temporal filtering. This even makes it faster!

CheronAph 01-13-2004 02:04 PM

The source is quite good, what do you suggest I do, has anyone else tried MA for AVI?

CheronAph 01-13-2004 02:06 PM

The script is Dialhotīs optimal script, I just added MA to it!

incredible 01-13-2004 02:11 PM

I just add that unfilter change in my last post, so notice it ;-)


You're scaling the height of your source from 240 to 336!
That means BLUR, even when trying to compensate this by using Lanczos.

What will happen when using MA in here? Very easy:

Lets see it chronologic:

- Resize/Lanczos= Blur/Sharp
- MA = Blur

In other words in this part the process is performing a dance but not an effective treating of your source. Also when upscaling using lanczos that "could" end up worse, cause lanczos results in a whole sharpened image. That means the edges of Dvix Artefacts do come more out etc.
You should (if sharpen is really nessecary) do that using BicubicPrecise and a little asharp afterwards, cause asharp() can be set to sharpen at a defined edge threshold only and not all that uneasy stuff at plain surfaces etc.

wgamer 02-08-2004 01:51 AM

hi every1

here is a script that i used:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\GripFit_YV12.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\STMedianFilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\unfilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
###############################
AviSource("F:\Movie.avi",false)
################################
AddBorders( 0, 8, 0,0)

###################################
GripCrop(352, 240, overscan=1, source_anamorphic=false)
GripSize(resizer="LanczosResize")

##############################
BlindPP(cpu=4)
Blockbuster(method="noise",detail_min=1,detail_max =3,variance=0.1,seed=1)
#Convolution3D(1, 6, 12, 6, 8, 2.8, 0)

#################################
Undot()
MergeChroma(blur(1.50))
MergeLuma(blur(0.1))
DCTFilter(1,1,1,1,1,1,0.5,0)
##############################
ScriptClip(" nf = YDifferenceToNext()" +chr(13)+ "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) ")

#Blockbuster(method="noise",detail_min=1,detail_ma x=10,variance=0.3,seed=5623)

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

movie: 480x280 ntsc divx5 mp3



i got two problems now
(1) the movie has a slight flickering effect
(2) half way thru the m1v file i get an acces violation error. (avs 254)
i am using klite codec pack
dialhot had advised not to use MA script with avi. but i just couldnt resist
i encoded it as mpg 1 cq 80 cqmatic prediction was 89.9! m1v size is 532 mb so there is scope for incresing cq. will the flicker be removed by increasing cq? then how to avoid access violation error?
thnks

wgamer 02-08-2004 05:20 AM

ok

i uninstalled klite codec and installed individual 311 alpha, xvid and divx


so when i check with gspot i get only one codec and not 2 or 3 codecs as was previously the case. the codec is divx 5 and i am able to play the avi and the error free first half of m1v

also, before encoding i ran the avi thru vdub mp3 freeze for errors.

now i am checking for errors in vdub 156 also just in case

wgamer 02-08-2004 06:42 AM

no errors in avi

wgamer 02-08-2004 07:05 AM

damn stupid of me. :oops:
the error was in the audio

only prob now is the slight flickering effect.

Prodater64 03-15-2004 06:00 AM

Hi: It is possible or not take the Dialhot's optimal script and add the Kwag's optimal script MA section?

@Dialhot
If this script woud be possible, can y ou put it in the optimal script thread?
Other case can put it here, please.

Dialhot 03-15-2004 06:25 AM

Quote:

Originally Posted by Prodater64
Hi: It is possible or not take the Dialhot's optimal script and add the Kwag's optimal script MA section?

It will give very bad result. Divx are already too blured to allow a MA part based on a "the more the action, the more the blurring" filtering.

Now it is possible to make a MA script even with divx but the content of the ScriptClip line must be completly different than the one for DVDs.

But I won't go in this way as I find the actual script very efficient like it is. I just wonder if I won't do a V5 remplacing C3D by other thing I'm currently testing. Results in few days I think.

Edlund 03-17-2004 05:04 PM

Hi, Cheronarph, you can try this script for example, I use it instead of the optimal:
Code:

LoadPlugin("C:\Movies\KVCD\MPEG2Dec3.dll")
LoadPlugin("C:\Movies\KVCD\GripFit_YV12.dll")
LoadPlugin("C:\Movies\KVCD\filtersdownloaded\asharp.dll")
LoadPlugin("C:\Movies\KVCD\filtersdownloaded\undot.dll") 
LoadPlugin("C:\Movies\KVCD\filtersdownloaded\dctfilter.dll")
LoadPlugin("C:\Movies\KVCD\UnFilter_Avisynth_2.5_Alpha\UnFilter.dll")
LoadPlugin("C:\Movies\KVCD\filtersdownloaded\TemporalCleaner.dll")
LoadPlugin("C:\Movies\KVCD\filtersdownloaded\Blockbuster.dll")
LoadPlugin("C:\Movies\KVCD\MovieStacker\Filters\Release\vsfilter.dll")

AviSource("...",false)
converttoyv12().GripCrop(..., ..., overscan=2, source_anamorphic=false)
Blockbuster(method="noise",detail_min=1,detail_max=3,variance=0.1,seed=1)
GripSize(resizer="BicubicResize")
Undot()
Limiter()
ASharp(1, 4)

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))) : \
TemporalCleaner(round(3+nf), round(8+nf))")

DCTFilter(1, 1, 1, 1, 1, 1, 0.5, 0)

GripBorders()
Limiter()

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

TextSub("...")

If you want to do prediction, you can use the optimal, and then encode the movie with this script for faster speed and less filesize.

incredible 03-17-2004 05:26 PM

Sorry Edlund but...

1. I assume you did this script for YUY2 capture purposes as you add a YV12 conversion?

2. You're adding a blockbuster where the random added noise will be scaled afterwards by Gripsize ... so the purpose is destroyed and afterwards not filtered out (that existing block cleaning purpose will not be given)
AND beside this instead you dont clean the noise/blocks, after resizing them you do a sharpen.

3. "... TemporalCleaner(round(3+nf), round(8+nf)... " on almost static scenes (where Temporal cleaning should be done primary) it will act even less in case of less NF.

Dialhot 03-17-2004 05:43 PM

And :

4/ bluring a Divx with unfilter if really a bad Idea as a told to Prodater.

Edlund 03-23-2004 09:48 AM

Thanks for the corrections guys.

toliman 03-25-2004 05:14 AM

i usually like ffdshow's noise feature to enhance viewing, but in avisynth, i had no idea how to emulate it without reading the source code. so this may be way off, but it seems to be workable for adding grain/artificial detail, as the dshow mpeg-4 decode filters do. this would work ideally for low-medium bitrate "action" video (600-900kbps) to a higher bitrate end-product.

results are fast enough, and some noise is removed by the HybridFuPP() script, while sharpening the distinct edges and enhancing definition.

you may even want to limit the luma range in blockbuster to stop adding excess noise to bright areas, as ffdshow also allows for. depending on the source avi or final bitrate, this might be an advantage.

i didn't add Convolution3D(), TemporalSoften() or DCTFilter(1,1,1,1,1,1,0.5,0) from the original MA/DIKO script, as i wasnt in a need to post-process the unfilter/flux masks from within HyFupp, and im unsure as to the greater effect of DCTFilter.

Code:

LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\MPEG2Dec3dg.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\Blockbuster.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\grip.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\UnDot.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\masktools.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\fluxsmooth.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\deen-beta1.dll")
LoadPlugin("C:\VIDEO\Avisynth 2.5 Plugins\UnFilter.dll")


Import("C:\VIDEO\Avisynth 2.5 Plugins\HybridFupp-v0.855a.avs")
AVISource("C:\Temp\video.avi",False)
converttoyv12()
BlindPP(cpu=4, quant=8, moderate_h=20, moderate_v=40)
Blockbuster(method="noise",detail_min=1,detail_max=10,variance=0.3,seed=45623)
HybridFupp(preset="high")
GripCrop(720, 576, overscan=1, source_anamorphic=false, dest_anamorphic=false)
GripSize(resizer="BicubicResize")
Blockbuster(method="noise",detail_min=1,detail_max=70,variance=4,seed=42)
GripBorders()
Limiter()
ConverttoYUY2()

any changes/suggestions are welcome, as i really only hacked this up in 4 hours of reading other posts and the scratchy online manuals. so very scratchy ...

ideally i'd move the order around, but it seems to work OK as it is, the pre-resize/HybridFupp() noise and the post-resize noise add definition to the edge sharpening mask, which will be softened by detailed noise, not a harsh blurring/ringing effect. i only really tried VagueDenoiser, which works too well at removing grain/detailed noise, but i didnt experiment much at all.

Dialhot 03-25-2004 05:46 AM

Why don't you let HybridFupp doing the resizing ?

incredible 03-25-2004 11:02 AM

And I would add that its NOT useful to add noise before HybridFupp as this wont end up in the same purposure like it does in the optimal scripts!
The purpose was to "spray" on existing artifacts/blocks so that they can be handled by for example ATC() and so in a much heavier temporal cleaning way.

And you do postprocessing using BlindPP before where BlindPP already is used in HybridFupp()

toliman 03-25-2004 02:41 PM

Re HybridFuPP resizing, i initially tried it, Avisynth threw up an exception error a few times. so i left it up to GripResize. if i knew how the mechanics of gripsize worked... i'd change it around to do bicubic -> lanczos, which is what preset="high" is set for.

after evaluating the HybridFupp v0.855alpha script deeper, i came to a conclusion, the filters are a little too strong on easily compressed footage (which is why i added noise). i tried to look at sky, smoke, foliage and skin, this seems to be more what i intended it to look like.

re: adding that initial BB noise might confuse the mask/edge detection (looking at Fupp's debug info, i couldn't notice any difference with with noise/edge mask displacement, just that more low-light areas were picked up by the 'green' edges with added noise), but it did so without changing parameters, which was easier at the time ...

anyway

Code:

converttoyv12()
AssumeFPS(25,1,false)
GripCrop(720, 576, overscan=1, source_anamorphic=false, dest_anamorphic=false)
GripSize(resizer="BicubicResize")
HybridFupp(D_str=7,dering=false,preset="high")
Blockbuster(method="noise",detail_min=1,detail_max=70,luma_threshold=16,variance=4,seed=42)
VagueDenoiser(threshold=0.3,method=1,nsteps=6,chroma=true)
GripBorders()
limiter()
ConverttoYUY2()


incredible 03-25-2004 04:03 PM

And now you applied at the end a blockbuster followed by the noisekilling Vaguedenoiser and its spatial work 8O

What are you doing ??? :wink:

toliman 03-25-2004 04:55 PM

mainly two things, as hap-hazardly as possible. also, trying not to hijack the original thread, but the script doesnt do so well on low-quality bitrates unless you like your blurring, extra crispy.

i'm not used to reconstructing 600 kbps to 4mbps, and i'm doing this by feel, since documentation on avisynth filter systems is just like reading a german->japanese dictionary translated back to english by a snotty french waiter. ("sacre bleu, you should know this *sneer*")

mainly i want a script that will ...
convert a progressive, blurred NTSC 24ps to PAL 25fps, without using telecide or tomsmocomp to blend/process frames, and/or perform some frame/motion evaluation that AssumeFPS doesn't do (without having to do some wacky IVTC-field doubling analysis that will just bleed time and details with no effect. no offense to the people who deal with int fields daily, but it's far too late to fix it)

some motion/edge aware enhancement to increase detail and a detail sensitive noise/denoise process to add the detail back into the heavily DCT compressed blocks of the original file. (it's only because of some distant memory of wavelet image reconstruction in texture construction, that i even use it in preference to the normal spatio/temporal smoothers.)

i'm looking to emulate pretty much what ffdshow could do (overscan borders/resizer, luma-sensitive noise, adaptive post-processing with deringing/deblocking), but with a higher output quality. if all else fails, i could just wring an avs into ffvfw, then into CCE and do it that way.

i tried modifying the existing DIKO/MA/Optimal script, but i get too much detail reduction in the 8x8 blocks, especially in sky/smoke/water/skin areas, and it seems like avisynth can do a lot more to reconstruct the impression of image quality than to dismember, by squeezing YUV channel macroblock delta's, or by other measures.

FuPP 03-25-2004 05:34 PM

Quote:

HybridFuPP resizing, i initially tried it, Avisynth threw up an exception error a few times
Could you tell me more ? Are you using avisynth 2.55, masktools 1.4.15 and deen 1.0 beta 1 ?

Using a resizer before HybridFuPP is a nonsense...

Quote:

after evaluating the HybridFupp v0.855alpha script deeper, i came to a conclusion, the filters are a little too strong on easily compressed footage
If I remember well, 0.855 uses deen("c3d",1,2,3,4,6,0.3,9) as a default for N2 parameter, which is a little bit too strong.

You would rather like to use hybridFuPP(preset = "high", N2="""deen("c3d",1,2,3,2,3,0.3,9)""") as a workaround or directly hybridFuPP(preset = "high", N2="VagueDenoiser(threshold=0.3,method=1,nsteps=6, chroma=true)"). Be aware that using N2, filtering is applied after resizing. If you want to apply it before, you should use N1.

PS : Blockbuster shouldn't be necessary after HybridFuPP

Regards,
FuPP

toliman 03-25-2004 05:56 PM

Quote:

Could you tell me more ? Are you using avisynth 2.55, masktools 1.4.15 and deen 1.0 beta 1 ?
yes to all. i hunted down an old/distinct beta copy of deen, and that works fine, iirc, the avisynth exception came up if i used HybridFuPP(720,576,preset="high"), but not if i used width=720, etc. it might also be related to avisynth memory alloc, but with less filters loaded, it works fine.

ive only recently become more interested in looking at masked filters to only apply an effect to needed areas, since most destroy fine detail unless used sparingly.

i'd ditch GripResize, if i could, but it's so much easier ...
for N2, deen("c3d",1,7,9,4,6,0.5,0) is what im looking at in the original avs. i'll make the change and see how it goes.

toliman 03-26-2004 01:18 PM

it worked great. after a lot of unnecessary wailing, its fine.

i modified my script a little after trying to reduce the HybridFupp preset de-noise thresholds, and moved from noise to 'dither' in Blockbuster. the quality looks and seems to be just like the original source, with no discernable blocking, constrasts and edges are distinct, looks fine.

except for it being 12-15fps. at best. a different denosier would work a lot faster. also using scripting instead of GripResize to do anamorphic ratio sizing /overscan, would be a plus.

Code:

Import("C:\Program Files\DVD2SVCD\Avisynth2.5 Plugins\HybridFupp-v0.855a.avs")

converttoyv12()
GripCrop(720, 576, overscan=1, source_anamorphic=false, dest_anamorphic=false)
GripSize(resizer="BicubicResize")
Blockbuster(method="dither",detail_min=1,detail_max=70,luma_threshold=16,variance=4)
HybridFupp(D_str=8,dering=false,N2="VagueDenoiser(threshold=0.2,method=1,nsteps=3,chroma=false)",preset="high")
GripBorders()
limiter()
ConverttoYUY2()


kwag 03-26-2004 01:25 PM

Quote:

Originally Posted by toliman
and moved from noise to 'dither' in Blockbuster.

That's no good at all :!:
Even SansGrip agrees, and the dither option was experimental.

-kwag

FuPP 03-26-2004 02:12 PM

Did you try without blockbuster (actually, I'm not sure to understand why you use it) ?

I definitively do not like the idea to resize twice... It must slow down terribly things !

You can use a simple crop() and addborders() and help you with fitcd or something else to do the calculations...

Btw, I will have a look to see if I can do something with SansGrip thingies and HybridFuPP...

FuPP

toliman 03-26-2004 03:43 PM

ok, i feel silly. works better without Blockbuster, its now unnecessary.

all this ended up because of harsh denoising in presets which i never really looked at to begin with. as the saying goes .. less, is more :)

all of the help is very much appreciated.

and Fupp, if you do get code to work overscan borders in, as a resize option in some future HybridFupp(), i'd expect a lot of old and new fans in KVCD would appreciate it too.

FuPP 03-26-2004 05:27 PM

ok, I've just discovered that doing the following, you do not need Gripsize anymore :


Code:

Import("C:\Program Files\DVD2SVCD\Avisynth2.5 Plugins\HybridFupp-v0.855a.avs")

converttoyv12()
GripCrop(720, 576, overscan=1, source_anamorphic=false, dest_anamorphic=false)

HybridFupp(width = GripFit_resize_width, height = GripFit_resize_height, D_str=8,dering=false,N2="VagueDenoiser(threshold=0.2,method=1,nsteps=3,chroma=false)",preset="high")

GripBorders()
limiter()
ConverttoYUY2()

Regards,
FuPP


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