apply avistyn filters to only some parts.

The old Video Software Help forum, left visible as an archive.
Locked
User avatar
ajew
Joined: Sun May 16, 2004 10:44 pm
Org Profile

apply avistyn filters to only some parts.

Post by ajew » Mon Jul 26, 2004 5:05 am

How would you do this, would you use the trim command?

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Mon Jul 26, 2004 5:14 am

Yes.

User avatar
ajew
Joined: Sun May 16, 2004 10:44 pm
Org Profile

Post by ajew » Mon Jul 26, 2004 5:42 am

playing around and found that it does cut it but then I can only look through what frames i put start and finish
do I have each line for each cut of filters how would u work it out?

User avatar
badmartialarts
Bad Martial Artist
Joined: Sat Oct 25, 2003 5:31 am
Location: In ur Kitchen Stadium, eatin ur peppurz
Org Profile

Post by badmartialarts » Mon Jul 26, 2004 8:02 am

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]
Life's short.
eBayhard.

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Mon Jul 26, 2004 9:05 am

Sousaphonist 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()
The above code is more properly written

Code: Select all

f = MPEG2Source(...)
p1 = f.Trim(0, 230)
p2 = f.Trim(231, 0)
return Filter1(p1, ...) + Filter2(p2, ...)
because
(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
The above code splits the area into four sections: filter section 1, filter section 2, the tween into section 1, and the tween between section 1 and section 2.

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Mon Jul 26, 2004 9:11 am

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

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Mon Jul 26, 2004 10:24 am

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.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
badmartialarts
Bad Martial Artist
Joined: Sat Oct 25, 2003 5:31 am
Location: In ur Kitchen Stadium, eatin ur peppurz
Org Profile

Post by badmartialarts » Mon Jul 26, 2004 8:34 pm

See, I was jsut guessing, all this stuff's above my head.

Well, it's not above my head, it's above my laziness.
Life's short.
eBayhard.

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Post by Corran » Mon Jul 26, 2004 11:13 pm

Scintilla wrote:Thus rendering both my TweakScene() and Corran's SceneAdjust() or whatever it was obsolete.
Well... I don't know about obsolete. I still prefer my function over applyrange.

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
}

User avatar
ajew
Joined: Sun May 16, 2004 10:44 pm
Org Profile

Post by ajew » Mon Jul 26, 2004 11:18 pm

Some many methods confuse me..

Locked

Return to “Video Software Help Archive”