View Full Version : Specifying frame ranges in script?
Is there a way to specify a certain frame range for a specific filter to operate over as opposed to having to apply it over the entire videoclip?
I can think of two ways to do it...
1) Use "animate" with the frame range, with the same settings at the beggining and at the end. Probably slow and not all functions/plugins work OK
2) Break your stream in parts (with trim), apply the settings you want to each part and then assemble them again with ++
for example, let's supose you want to deinterlace frames 501 to 1000 but not the rest of them:
(at the beginning, load plugins, etc)
.....
Stream=Mpeg2Source(file.d2v)
Part1=trim(Stream,0,500)
Part2=trim(Stream,501,1000)
Part3=trim(Stream,1001,0)
FieldDeinterlace(Part2)
Part1+Part2+Part3
.....
If you prefer, you can do all in 1 line:
trim(Mpeg2Source(file.d2v),0,500)++FieldDeinterlace(trim(Mpeg2Source(file.d2v),501,1000))++trim(Mpeg2Source(file.d2v),1001,0)
Great, thats exactly what I was looking for :)
Next question:
If you "part2" in the parameter of FieldDeinterlace then where do the other parameters go?
part1+part2+part3 will join the three parts?
Basically, I have 5 separate areas/ranges where I want to apply a series of filters to.
A1 - normal filtering
A2 - normal + special filtering
A3 - normal filtering
A4 - normal + special filtering
A5 - normal filtering
A1, A2, ..., A5 all in sequential order, but I suppose you can process out of order as well?
Will I for each individual filter in the batch, have to specify say "A1"? Can I apply a batch of filters in series to A1 then batch to A2 and so on? Suggestions?
Well there are lots of ways to do that, and many of them equally good (although the "good" ways depend on the exact filters you want to apply; for example, if you want to resize and deinterlace, you MUST deinterlace first to get good results...)
A possible way to do it:
1) read the streams to a named clip:
Stream=mpeg2source(movie.d2v)
2) apply the "previous" common function
Stream=MyFunction(Stream)
3) break the stream in the appropiate sections
Section1=Trim(Stream,0,500)
Section2=Trim(Stream,501,1000)
Section3=Trim(Stream,1001,0)
4) apply the "special" functions in any order you want, simply remember to assign the output to a name you will use latter (can be the same of the original "trim" call or any other)
Section2=Special2(Section2)
Section1=Special1(Section1)
Section2=MoreSpecial(Section2)
NewSection1=MoreSpecial(Section1)
5) mount again everything
Stream=NewSection1+Section2+Section3
6) add more functions, for example add audio
Stream=AudioDub(Stream,WavSource("Movie.wav"))
7) "play" the stream you want
Stream
You can do 6 and 7 in one line (well, you can do almost everything in one line! but it is easier do that two at once)
6+7) add audio and "play" the stream
AudioDub(Stream,WavSource("Movie.wav"))
Where did you get this information from anyway?
You didnt answer my first two parts.
How is the MyFunction (Special1,2,etc) defined?
vinetu
5th May 2002, 23:32
Thanx Pko!!!:)
dividee
6th May 2002, 00:02
The avisynth language reference guide:
http://math.berkeley.edu/~benrg/avisynth-reference.html (old version)
http://www.videotools.net/doc/reference.htm (more up to date)
Basic avisynth tutorial:
http://math.berkeley.edu/~benrg/avisynth-tutorial.html
Important notes:
http://math.berkeley.edu/~benrg/avisynth-beta.html (you'll find how to define your own functions here)
Kedirekin
6th May 2002, 00:16
I think PKO got his information the same way most of us have - read the AviSynth filter manual (available off the AviSynth home page), experiment, and common sense.
I believe he answered all parts of your question. If you re-read it a few times, I'm sure you'll catch on.
Maybe this will help a little - it's a pretend sample script (and I'm just winging it here, so give me a little leeway if I make mistakes, syntax, typo or otherwise).
# get the source avi
origClip=Mpeg2Source("C:\movie.d2v")
# here's some common manipulation I to do to the entire avi
# before specific manipulation on individual sections
# these are the 'MyFunction' filters, but they
# aren't of course filters the I wrote
decombClip=telecide(origClip)
ivtcClip=decimate(decombClip,5)
# split avi into separate sections
section1=Trim(ivtcClip,0,500)
section2=Trim(ivtcClip,501,1000)
section3=Trim(ivtcClip,1001,0)
# apply special filtering to the sections
# (gosh, I can't think of any sample filters to use)
#section 1 - standard with TS
resize1=BicubicResize(section1,480,480,0,0,0.75,0)
ts1=TemporalSoften(resize1,2,2)
done1=ts1
#section 2 - cropped and very soft resize
crop2=Crop(section2,0,60,720,360)
resize2=BicubicResize(crop2,480,360,0,0,0.33,0.33)
borders2=AddBorders(resize2,0,60,0,60)
done2=borders2
#section 3 - credits, just get them done fast
resize3=BilinearResize(section3,480,480)
done3=resize3
# put the sections back together
allDone=done1+done2+done3
# if I wanted to, I could do more filtering to the
# new full clip, but I'm tired of typing, so I'll
# just return now
return allDone
Hope you found that helpfull.
Thanks to everyone who replied here. My script now works perfectly.
Ive read the first three links before...missed the fourth one for some reason. Just goes to show how much time and effort can be saved by being a little more careful when doing research.
Theres so many different combinations that can do the same thing...
/me goes to tweak script some more :D
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.