Log in

View Full Version : Start/End Points


the viking
30th June 2006, 18:57
Hello,
I found this script to get picture in picture effect.

a=AVISource("I:\DV\DV_no1\Video 2_Galleri.avi")
b=AVISource("I:\DV\DV_no1\Video 1.avi",false)
b =b.ReduceBy2()
xpos = Width(a)-Width(b)-10
ypos = Height(a)-Height(b)-10
Overlay(a, b,x=xpos, y=ypos)

But there is one problem that I cant find any answer to:

-I want the AVISource "b" to start about
5 minutes after AVISource "a" start.

Anyone that can help me with that?

Thanks!

Wilbert
30th June 2006, 19:56
Something like the following:
5 min = 300 seconds = x frames

a = AVISource("I:\DV\DV_no1\Video 2_Galleri.avi")
a1 = a.Trim(0,x-1)
a2 = a.Trim(x,-1)
b = AVISource("I:\DV\DV_no1\Video 1.avi",false)
b = b.ReduceBy2()
xpos = Width(a)-Width(b)-10
ypos = Height(a)-Height(b)-10
a1 + Overlay(a2, b, x=xpos, y=ypos)

the viking
30th June 2006, 21:34
excuse my stupidity,but there is still something I do wrong.:stupid:

5 min = 300 seconds = x frames =7500 frames in PAL land.

So case one:

I want the "b" picture to start 5 minutes,
and end 6 minutes after the beginning,i.e. one minute with overlay, from frame 7500 in "a" to frame 9000 in "a".

So if I replace x with 7500 in the script,no overlay appears,
and the total lengt of the video shows 5 minutes.the correct is 35 min.So I do something totally wrong somewhere..


a = AVISource("I:\DV\DV_no1\Video 2_Galleri.avi")
a1 = a.Trim(0,x-1)
a2 = a.Trim(x,-1)
b = AVISource("I:\DV\DV_no1\Video 1.avi",false)
b = b.ReduceBy2()
xpos = Width(a)-Width(b)-10
ypos = Height(a)-Height(b)-10
a1 + Overlay(a2, b, x=xpos, y=ypos)

Case 2:
If I want the picture in picture effect to come back later in
the video,lets say from minute 9 to 11 and 15 to 16,
do I continue with

a3 =
a4 =
a5 =
and so on?

foxyshadis
1st July 2006, 05:34
You'd probably want to try stickboy's JDL_ReplaceRange in that case, or even ApplyEvery if it's at regular intervals.



a = AVISource("I:\DV\DV_no1\Video 2_Galleri.avi")
b = AVISource("I:\DV\DV_no1\Video 1.avi",false).ReduceBy2()
xpos = Width(a)-Width(b)-10
ypos = Height(a)-Height(b)-10
c=Overlay(a, b, x=xpos, y=ypos)

a
JDL_ReplaceRange(c,7500,9000)
JDL_ReplaceRange(c,15000,17500)
JDL_ReplaceRange(c,27500,79000)

the viking
1st July 2006, 12:08
thanks ,works fine with JDL functions.

but then a new queston appeared,
if I use the foxyshadis script ,the same part of video "b"
is overlayed every time replace range comes in,
a example:

JDL_ReplaceRange(c,7500,9000) lets say I want video "b" frames from 1000 to 2500 to be overlayed here...

JDL_ReplaceRange(c,15000,17500)...and "b" frames from 4000 to 6500 to be overlayed here....

JDL_ReplaceRange(c,27500,29000)..,.and "b" frames from 8000 to 9500 to be overlayed here....

Is it possible,I cant find a way to place the trim commands
to get it right?

foxyshadis
1st July 2006, 13:03
Oh, right, I forgot that would happen. Try adding this to the script and calling it instead:

function JDL_ReplaceRange2(clip c1, clip c2, int frame1, int frame2) {
JDL_ReplaceRange(c1,c2.trim(frame1,0),frame1,frame2)
}
Or you could just directly use the demonstrated principle, for more flexibility, or add a third parameter...

the viking
1st July 2006, 14:16
added the last function to the script and added
also clip3 and intframe 3 to the func.
So if I understood right,the trim parametres for video "b" has to
be in the last line of the function?
In all my tests the overlayed video starts at frame 1.

Import("C:\Program\AviSynth 2.5\plugins\jdl-util.avsi")
Import("C:\Program\AviSynth 2.5\plugins\jdl-range.avsi")
a = AVISource("I:\DV\DV_no1\Video 2_Galleri.avi")
b = AVISource("I:\DV\DV_no1\Video 1.avi",false).ReduceBy2()
xpos = Width(a)-Width(b)-10
ypos = Height(a)-Height(b)-10
c=Overlay(a, b, x=xpos, y=ypos)

a
JDL_ReplaceRange(c,7500,9000)
JDL_ReplaceRange(c,15000,17500)
JDL_ReplaceRange(c,27500,29000)

function JDL_ReplaceRange2(clip c1, clip c2,clip c3, int frame1, int frame2,int frame3) {
JDL_ReplaceRange(c1,c2.trim(frame1,0),frame1,frame2)}

but im my case it seems to be a better move to handle over the tapes to the local video shop,maybe :)