|
|
Using Avisynth to help compressing files
I was wondering, which filters may be used to help compressing a good quality file (not anime)?
undot()
Fluxsmooth()
Good start?
Thanks,- Dan
Probably the best filter: BicubicResize() to a smaller size.
Otherwise have a look at this thread.
Thanks shOdan.
- Dan
Razorholt
I shoudn't advise to use Undot() for improving compressability of hi-quality video because it eliminates small fast-moving details (like rain-drops or snow-flakes) almost completely. Instead, I prefer to use light temporal denoising like
Code:
Temporalsoften(2,3,3,mode=2,scenechange=6)
FluxSmoothST(5,7)
(I stealed this from scripts generated by GordianKnot).
Also, light blur() (with strength of 0.15 or so) before BicubicResize() might gain the compressability, but it highly depends on source video.
i've never seen undot produce an artefact...?
removedirt can be a bit agressive as far as removing objects rather than just noise, but for compressibility gain versus detail it can't be beaten. if used with motion compensation (especially the new stuff being developed lately) it can give a practically artefact-free compressibility boost.
degrainmedian is also very good - doesn't give blocks like removedirt can if not used judiciously, and still gives a handy compressibility gain.
Perhaps the new GaussResize(), adjust P to select the right amount of blur
May I hop in with a small function?
SPresso() is one I use a lot (mostly for internal processing within more complex functions), but it also deals very well as a standalone.
(It doesn't matter if you like caffeine or not (I do) - SPresso stands for Spatial Pressdown.)
On my usual, usual-noisy DVB sources, compression gain usually is from 2% to 3% (light settings -gt; changes almost invisible) up to 10 to 12% (stronger settings -gt; slight, gentle softening, not very obvious).
Format:
SPresso( limit, bias, [RGmode] )
quot;limitquot; tells the maximum change to do to any pixel
quot;biasquot; is, well, something like quot;aggessivityquot;: '20' is a very light setting, '33' is already quite strong.
quot;RGmodequot; tells the RemoveGrain mode to use. The default of quot;4quot; is the best in most cases.
Posting screenshots makes not much sense, because there is so little difference to see. So just try it. Needed are MaskTools and RemoveGrain.
Code:
function SPresso(clip clp, int quot;limitquot;, int quot;biasquot;, int quot;RGmodequot;)
{
limit = default( limit, 2 )
bias = default( bias, 25 )
RGmode = default( RGmode, 4 )
LIM1 = (limitgt;0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limitlt;0) ? quot;1quot; : string(limit)
BIA = string(bias)
expr = (limitlt;0) ? quot;x y - abs quot;+LIM1+quot; lt; x x 1 x y - x y - abs / * - ?quot;\ : quot;x y = x x quot;+LIM1+quot; + y lt; x quot;+LIM2+quot; + x quot;+LIM1+quot; - y gt; x quot;+LIM2+quot; - quot; \ + quot;x 100 quot;+BIA+quot; - * y quot;+BIA+quot; * + 100 / ? ? ?quot;
yv12lutxy( clp, clp.removegrain(RGmode,-1), expr, U=2,V=2)
}
Note: Chroma is not touched at all. Spresso works only on the luma channel. Could be changed easily, however.
BTW: For those prefering tee over coffe, there's also a quot;TPressoquot; counterpart ... I just don't have it with me at the moment.
Thanks guys! I will try out your suggestions and post the results later on today. I've just finished the first test with a combinaision of:
Undot()
Unfilter(-5,-5)
BicubicResize()
Result: produced artifacts so I will give a 7 out of 10. (I will ellaborate more also later on)Thanks,
- Dan
Ok, here is below the script I'm quite happy with. I still need to try blur() as suggested.
Anything I can add? Maybe a filter to sharpen the clip a little? Artifacts are still noticeable but not quot;annoyingquot;.ConvertToYv12()
function SPresso(clip clp, int quot;limitquot;, int quot;biasquot;, int quot;RGmodequot;)
{
limit = default( limit, 2 )
bias = default( bias, 25 )
RGmode = default( RGmode, 4 )
LIM1 = (limitgt;0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limitlt;0) ? quot;1quot; : string(limit)
BIA = string(bias)
expr = (limitlt;0) ? quot;x y - abs quot;+LIM1+quot; lt; x x 1 x y - x y - abs / * - ?quot;\ : quot;x y = x x quot;+LIM1+quot; + y lt; x quot;+LIM2+quot; + x quot;+LIM1+quot; - y gt; x quot;+LIM2+quot; - quot; \ + quot;x 100 quot;+BIA+quot; - * y quot;+BIA+quot; * + 100 / ? ? ?quot;
yv12lutxy( clp, clp.removegrain(RGmode,-1), expr, U=2,V=2)
}
Undot()
ConvertToYUY2()
Unfilter(-5,-5)
Temporalsoften(2,3,3,mode=2,scenechange=6)
FluxSmoothST(5,7)
crop(2,0,0,0)
GaussResize(852,480)
You should probably make a seperate .avs or .avsi (auto loading) file for spresso. As is does that even call SPresso?
Also why the conversion to yuy2? IIRC unfilter, temporal soften and fluxsmooth all work in yv12.
ooh, and I have to test degrainmedian() too. What would be the recommended settings for that one?Thanks,
- Dan
Originally Posted by DryFireYou should probably make a seperate .avs or .avsi (auto loading) file for spresso. As is does that even call SPresso?
Also why the conversion to yuy2? IIRC unfilter, temporal soften and fluxsmooth all work in yv12.I tried to autoload SPresso.avs but it didn't work. The error message said that Avisynth couldn't load it.
Hey, I always use PixieDust to help with compressibilty in my rips, I know it produces subtle blocking artifacts, but i can never see them in the video when it's running and it more or less completly removes most noise.
'tis a little on the slow side though.
Originally Posted by TuesdayHey, I always use PixieDust to help with compressibilty in my rips, I know it produces subtle blocking artifacts, but i can never see them in the video when it's running and it more or less completly removes most noise.
'tis a little on the slow side though.Well, I wanted to try PixieDust but never found the right version I guess. Can you please advise me on this one?
Thanks,- Dan
Another set of filters. This time I decided to rezise the clip from 852x480 to 800x450. That helped reducing the artifacts.
ConvertToYv12()
function SPresso(clip clp, int quot;limitquot;, int quot;biasquot;, int quot;RGmodequot;)
{
limit = default( limit, 2 )
bias = default( bias, 25 )
RGmode = default( RGmode, 4 )
LIM1 = (limitgt;0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limitlt;0) ? quot;1quot; : string(limit)
BIA = string(bias)
expr = (limitlt;0) ? quot;x y - abs quot;+LIM1+quot; lt; x x 1 x y - x y - abs / * - ?quot;\ : quot;x y = x x quot;+LIM1+quot; + y lt; x quot;+LIM2+quot; + x quot;+LIM1+quot; - y gt; x quot;+LIM2+quot; - quot; \ + quot;x 100 quot;+BIA+quot; - * y quot;+BIA+quot; * + 100 / ? ? ?quot;
yv12lutxy( clp, clp.removegrain(RGmode,-1), expr, U=2,V=2)
}Unfilter(-5,-5)
Temporalsoften(2,3,3,mode=2,scenechange=6)
FluxSmoothST(5,7)
blur(0.15)
BicubicResize(800,450)
In your first post, you talked about a quot;good quality sourcequot;. Now you're always talking about artefacts that have to be reduced. Could you please decide what's the real deal?
The following script loads and uses Spresso correctly. Get the plugins, adapt the pathnames, and it'll work:Code:
LoadPlugin(quot;X:\path\to\MaskTools.dllquot;)
LoadPlugin(quot;X:\path\to\RemoveGrain.dllquot;)
Import(quot;Y:\path\to\SPresso.avsquot;)
XYZSource(quot;Z:\path\to\YourSourcequot;)
SPresso()
The filtering chain you currently have gives a rather blurry output for sure. One should look into what the problem is with the actual source, and do specific filtering. Better then to produce this kind of universal mush.
BTW, you'll have no fun with a framesize of 800*450. You should resize to 800*448.
(And in case you like mush, write quot;BicubicResize(800,448,1,0)quot; -- no more artefacts...) edit:
BTW2, I once put the quot;Dustquot; filter package online here. Those who are afraid of Dust's potential blocking artefacts might want to use PixieDustPP instead.
Ok Didée, here is the deal:
I have to compress a 25MB QuickTime file (movie trailer) down to 17MB (Mpeg-4) using MainConcept H.264. I wanted to keep the original screen resolution (854x480) but the quality wasn't that impressive so I decided to go with 800x450 (although I should go with 800x448 as per your suggestion ).
I know that my script looks like a messy bunch of filters put together with the hope that the combinaison could get me to the result espected, but so far so good
Regarding PixieDustPP (who's dying to join the group, I know it for sure) I can't make it to work. After importing the AVS file and loading the 3 plugins required I get the following error:
Script error: There is no function named quot;pixiedustquot;
(C:\Program Files\AviSynth 2.5\plugins\PixieDustPP.avs, line 47)Cheers.
I just got the PixieDustPP problem sorted I forgot to load LoadPluginEx, that's why it didn't work... I'm currently compressing the file wth that filter so I'll let you know the result.
It might be a great filter but the encoding time is a bit long. The time for the other tests varied between 41 and 52 minutes (VBR 2-pass), versus 1h42 with this pixiedustpp included. But we'll see...
- Dan
Mug Funky
gt; i've never seen undot produce an artefact...?
Undot() doesn't produce artifacts ( == additional details not exist in source video), just eliminates existing details with near-one-pixel size (especially fast-moving) and like quot;washesquot; fine-grained, slow-moving textures. Usually it is good, but sometimes it irritate like nothing else.
BicubicResize()
I am missing something.
BicubicResize() versus what ?
If it is against lanczos resize, I'd say yes.
If it is against normal resize, I'd say no.
If it is reducting the image size, I'd say yes, but the bicubic is not important here.
If I had to use a resize for downsampling and helping compressibility I would probably use bilinear resizing.
esby |
|