Log in

View Full Version : work on a specific part of the video (time)


Mounir
17th August 2009, 02:31
I tried to review the official documentation but i can't seem to find so i'll ask here

Let's say i want to work from frame 47 to frame 120 on a video, how am i supposed to code that ?

thewebchat
17th August 2009, 05:30
Use ApplyRange().

Alex_ander
17th August 2009, 07:50
In case your filter(s) have many parameters, you'd have to mention all of them in ApplyRange (even with default values). Alternatively, there's an easier scripting:

trim(0,46)++trim(47,120).YourFilters()++trim(121,0)

Gavino
17th August 2009, 10:52
In case your filter(s) have many parameters, you'd have to mention all of them in ApplyRange (even with default values).
Just to clarify this, it's not necessary to mention all the parameters, only those up to the last non-default value you are using (and none if you're using all defaults). (Incidentally, the same goes for Animate.)

Another alternative, supporting named arguments, is stickboy's JDL_ApplyRange. And for applying a filter to several different ranges, his ReplaceFramesSimple function.

Mounir
17th August 2009, 14:37
Ok guys i'm a lil lost

Where should i write it in the following script:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
v=MPEG2Source("C:\Documents and Settings\Myvideo.d2v", info = 3)
a=wavsource("C:\Documents and Settings\MySound.wav")
audiodub(v,a)
TomsMoComp(1,5,1)
ConverttoRGB32(matrix="Rec601")

or even this script:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
v=avisource("C:\Documents and Settings\Myvideo.avi")
a=wavsource("C:\Documents and Settings\MySound.wav")
audiodub(v,a)
assumefps(29.970,true)
AssumeTFF()
TomsMoComp(1,5,1)
ConverttoRGB32(matrix="Rec601")

Thanks for your help

Gavino
17th August 2009, 16:45
What exactly is it you want to do with frames 47 to 120? That could influence the right place to put it.

Or perhaps we have misunderstood and you simply want to extract those frames as the result of your script? In that case, you would add Trim(47, 120) to the end.

Mounir
17th August 2009, 20:31
@ Gavino
I want to work on a SEGMENT / PORTION of the vid ex: from frame 47 to frame 120 , That's it

thewebchat
17th August 2009, 22:32
There is no need to YELL and type in ALL CAPS. What Gavino is trying to say is that the processing you want to do on frames 47-120 may affect where you should call ApplyRange(). For example, if you want to use some filter that expects progressive input, clearly ApplyRange() must go after TomsMoComp(). If your filter needs YUV, clearly you can not call it after ConvertToRGB32().

This reasoning applies to any other kind of filter placement decision for that matter.

JohannesL
19th August 2009, 11:00
Use JDL_ApplyRange().
Or:

Source()
s1 = Trim(0,46)
s2 = Trim(47,120).ProcessingHere()
s3 = Trim(121,0)
s1 ++ s2 ++ s3

Gavino
19th August 2009, 11:36
s3 = Trim(121,FrameCount())
s3 = Trim(121, FrameCount()-1)
or
s3 = Trim(121, 0)

EDIT: Somehow I missed this one earlier:
s2 = Trim(47,120).Eval("""
YourProcessingHere()
""")
That won't work - its equivalent to
s2 = Eval(Trim(47,120), """
YourProcessingHere()
""")
and Eval doesn't take a clip as an argument.

JohannesL
20th August 2009, 00:14
Fixed..