View Full Version : Multiple trims with denoising for each => resources exceeded?
moviefan
10th August 2008, 13:38
Hey guys,
I've got a clip that consists of many parts (like 100 or so) that I cut using the trim-function. I want to apply a denoising filter to each part because they alter between 16:9 and 4:3 and to be more efficient, I want to apply the filter for 16:9 parts to a cropped picture, which gets borders added after denoising. But when I do so for my ~100 trimmed parts, AviSynth crashes with an access violation and I noticed, it takes a lot of RAM... Is there a way to be more efficient? My script looks like this:
video = trim(...).crop(...).denoise_filter().AddBorders(...) \
+ trim(...).denoise_filter() \
+ trim(...).crop(...).denoise_filter().AddBorders(...) \
+ trim(...).denoise_filter() \
+ ...
Regards
Mystery Keeper
10th August 2008, 13:43
Try using Lom() or ApplyRange instead of tirm().
Leak
10th August 2008, 13:57
video = trim(...).crop(...).denoise_filter().AddBorders(...) \
+ trim(...).denoise_filter() \
+ trim(...).crop(...).denoise_filter().AddBorders(...) \
+ trim(...).denoise_filter() \
+ ...
Each time you use .denoise_filter() up there you'll create a new instance of the denoise filter that will of course chew up memory fast, depending on the filter used.
On the other hand Crop, Trim and AddBorders hardly use any resources at all.
So assuming that the same denoise filter settings are getting used several times use a clip variable for each of them to apply the denoise filter first, then trim the resulting clips:
a=denoise_filter1()
b=denoise_filter2()
...
video = a.trim(...).crop(...).AddBorders(...) \
+ b.trim(...) \
+ b.trim(...).crop(...).AddBorders(...) \
+ a.trim(...) \
+ ...
I don't think your denoise filter will behave much differently (maybe slower, but if it crashes now it'll at least work) if you denoise first and crop later.
You won't gain speed by trimming before the denoise filter as frames that aren't requested are never calculated.
np: Jah Wobble - Unknown Track (Umbra Sumus)
Gavino
10th August 2008, 16:32
a=denoise_filter1()
b=denoise_filter2()
...
video = a.trim(...).crop(...).AddBorders(...) \
+ b.trim(...) \
+ b.trim(...).crop(...).AddBorders(...) \
+ a.trim(...) \
+ ...
As you say, Crop and AddBorders don't use much resources, but assuming their parameters are also always the same, you may as well go further and do it like this:
a=denoise_filter1().crop(...).AddBorders(...)
b=denoise_filter2()
...
video = a.trim(...)\
+ b.trim(...) \
+ a.trim(...) \
+ b.trim(...) \
+ ...
Generalising, what Leak and I are both saying is it usually pays to factor out the common parts into a single filter instance, especially if the filter is an expensive one.
stickboy
10th August 2008, 21:03
As you say, Crop and AddBorders don't use much resources, but assuming their parameters are also always the same, you may as well go further and do it like this:
a=denoise_filter1().crop(...).AddBorders(...)
b=denoise_filter2()
...
video = a.trim(...)\
+ b.trim(...) \
+ a.trim(...) \
+ b.trim(...) \
+ ...And to go even further, you can avoid the multiple Trims/Splices and use my ReplaceFrames plug-in (http://www.avisynth.org/stickboy/) to mix frames from the two clips.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.