Log in

View Full Version : Possible to vary the amount of a filter over time?


wrybread
3rd March 2011, 15:54
I was wondering if its possible to fade a filter. So for example, something like the below code that would slowly increase the amount of red applied by RGBAdjust:

a = DirectShowSource(clip1, fps=29, convertfps=true)
a = a.ConvertToRGB32()

# slowly increase the red shift:
a = a.RGBAdjust(2, 1, 1)
a = a.RGBAdjust(3, 1, 1)
a = a.RGBAdjust(4, 1, 1)

Gavino
3rd March 2011, 18:08
What you have there is not varying the red level over time, it is simply applying a change cumulatively to all frames, equivalent to
a = a.RGBAdjust(24, 1, 1)
(since 2x3x4=24).

Animate (http://avisynth.org/mediawiki/Animate) can be used to vary the parameters of a filter over a range of frames, eg
a = a.Animate(0, 20, "RGBAdjust", 2.0, 4.0)
will vary the parameter from 2 to 4 over frames 0-20.

-Vit-
3rd March 2011, 18:10
...posted the exact same answer at the same time as Gavino....

[snip]

So I'll just add that with Animate you should use floating point values where you want floating point animation (or it will just snap from integer to integer)