apply avistyn filters to only some parts.
- ajew
- Joined: Sun May 16, 2004 10:44 pm
apply avistyn filters to only some parts.
How would you do this, would you use the trim command?
- badmartialarts
- Bad Martial Artist
- Joined: Sat Oct 25, 2003 5:31 am
- Location: In ur Kitchen Stadium, eatin ur peppurz
I'm not too sure on the syntax....so don't worry about using this line for line.
Something like this: assuming you want to use something called Filter1 on the first 230 frames and Filter2 on the rest of a 4033-frame movie:
[/code]
Something like this: assuming you want to use something called Filter1 on the first 230 frames and Filter2 on the rest of a 4033-frame movie:
Code: Select all
firstpart=return mpeg2source("C:\myfootage.d2v").trim(0,230)
secondpart=return mpeg2source("C:\myfootage.d2v").trim(231,4032)
firstpart.Filter1() + secondpart.Filter2()
Life's short.
eBayhard.
eBayhard.
-
- is
- Joined: Tue Jul 23, 2002 5:54 am
- Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
- Location: N????????????????
The above code is more properly writtenSousaphonist wrote:I'm not too sure on the syntax....so don't worry about using this line for line.
Something like this: assuming you want to use something called Filter1 on the first 230 frames and Filter2 on the rest of a 4033-frame movie:
Code: Select all
firstpart=return mpeg2source("C:\myfootage.d2v").trim(0,230) secondpart=return mpeg2source("C:\myfootage.d2v").trim(231,4032) firstpart.Filter1() + secondpart.Filter2()
Code: Select all
f = MPEG2Source(...)
p1 = f.Trim(0, 230)
p2 = f.Trim(231, 0)
return Filter1(p1, ...) + Filter2(p2, ...)
(1) Filter1 and Filter2 are not members of the individual clips
(2) return escapes from the script entirely, and cannot be used in the context that it was used, as it is not within the scope of the AVISynth script grammar: http://www.avisynth.org/ScriptGrammar
---
Using Animate() in conjunction with Trim() can give you sections with different filtering that linearly blend together. Here's an example using saturation that I ripped out of an AVISynth script I've waved around here a few times.
Code: Select all
startsat = 1.3
endsat = 1.0
t1 = Trim(b1, 0, 24)
t2 = Trim(b1, 458, 482)
t1a = Animate(t1,0,Framecount(t1), "Tweak", 0,startsat,0,1,true, 0,endsat,0,1,true)
t2a = Animate(t2,0,Framecount(t2),"Tweak",0,endsat,0,1,true, 0,startsat,0,1,true)
b1a = t1a + Trim(b, (1823 + Framecount(t1)), (2305 - Framecount(t2))).Tweak(sat=endsat) + t2a
-
- is
- Joined: Tue Jul 23, 2002 5:54 am
- Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
- Location: N????????????????
enter key, enter key >_<
---
The Animate() thing only works in certain situations. In particular, it only works when you can tween the filter, and it also doesn't work with scripts.
Also, depending on what you're doing, an easier way to do all this would be to use ApplyRange: http://www.avisynth.org/Animate
---
The Animate() thing only works in certain situations. In particular, it only works when you can tween the filter, and it also doesn't work with scripts.
Also, depending on what you're doing, an easier way to do all this would be to use ApplyRange: http://www.avisynth.org/Animate
- Scintilla
- (for EXTREME)
- Joined: Mon Mar 31, 2003 8:47 pm
- Status: Quo
- Location: New Jersey
- Contact:
I was about to say something about ApplyScene(), but Trythil already mentioned it... with the <i>correct</i> name (ApplyRange()).
In 2.0.6, I wrote myself a function that would let me Tweak() only certain scenes without having to keep using Trim() all the time, but then I upgraded to 2.55 and found ApplyRange(), which does the same thing with <i>any</i> filter.
Thus rendering both my TweakScene() and Corran's SceneAdjust() or whatever it was obsolete.
In 2.0.6, I wrote myself a function that would let me Tweak() only certain scenes without having to keep using Trim() all the time, but then I upgraded to 2.55 and found ApplyRange(), which does the same thing with <i>any</i> filter.
Thus rendering both my TweakScene() and Corran's SceneAdjust() or whatever it was obsolete.
- badmartialarts
- Bad Martial Artist
- Joined: Sat Oct 25, 2003 5:31 am
- Location: In ur Kitchen Stadium, eatin ur peppurz
See, I was jsut guessing, all this stuff's above my head.
Well, it's not above my head, it's above my laziness.
Well, it's not above my head, it's above my laziness.
Life's short.
eBayhard.
eBayhard.
- Corran
- Joined: Mon Oct 14, 2002 7:40 pm
- Contact:
Well... I don't know about obsolete. I still prefer my function over applyrange.Scintilla wrote:Thus rendering both my TweakScene() and Corran's SceneAdjust() or whatever it was obsolete.
The thing about ApplyRange() that I don't like is the fact that you can only apply one filter at a time, and that entering arguments you don't need is a pain in the ass when you wish to keep them their defaults. On the plus side it is faster than the function I've written:
Code: Select all
####################################################################
# SceneAdjust by Corran Adapted from Scintilla's Tweakscene #
# Usage: SceneAdjust(start,end,filters) #
# #
# To use filters that use strings like deen("a3d",1) #
# you need to use triple quotes. #
# #
# e.g. SceneAdjust(30,80,filters="""deen("a3d",1).mftoon()""") #
####################################################################
function sceneadjust(clip a, int "start", int "end", string "filters") {
start = Default(start,0)
end = Default(end,a.framecount)
part1 = (start <= 1) ? a.Trim(0,-1) : a.trim(0,start-1)
part3 = (end >= a.framecount-1) ? a.trim(0,-1) : a.trim(end+1,a.framecount)
a=part1+Eval("a."+filters).trim(start,end)+part3
a = (start <= 1)? a.trim(1,a.framecount) : a
(end >= a.framecount-1) ? a.trim(0,a.framecount-2):a
}