Log in

View Full Version : Weave() not giving expected results with regards to ScriptClip and current_frame


Ready_Eddie
15th March 2005, 03:04
Ow, my aching head!

I think I understand it now, but I’m not sure the behavior is as intended.

PS, first post to this forum, let me know if I’m in the wrong place or violating protocol please.

Consider the script:

mpeg2source("some source")

function F1(clip clip1)
{
clip1=clip1.SelectEvery(1,-1).SeparateFields()
clip1=clip1.FrameEvaluate("""clip1=last""",after_frame=true)
clip1=clip1.FrameEvaluate("""clip1=current_frame%2==0?
\ clip1.subtitle("EvenField="+string(current_frame),y=20):
\ clip1.subtitle("OddField="+string(current_frame),y=40)""",after_frame=true)
clip1=clip1.ScriptClip("""clip1""",after_frame=true)
return clip1.weave()
}

function F2(clip clip2)
{
clip2=clip2.FrameEvaluate("""clip2=last""",after_frame=true)
clip2=clip2.FrameEvaluate("""clip2=clip2.subtitle("Frame="+string(current_frame),y=100)""",after_frame=true)
clip2=clip2.ScriptClip("""clip2""",after_frame=true)
return clip2
}

F1()
showframenumber(true)
F2()

Resulting subtitle output:

EvenField: 0 2 4 6 8 …
OddField: 1 3 5 7 9 …
Frame: 1 3 5 7 9 … (not what expected)
showframenumber output: 0 1 2 3 4 … (expected)

Obviously, a result of weave() being implemented with doubleweave().selecteven()

But weird, huh?

Ready_Eddie
16th March 2005, 02:56
OK, I hacked a solution, seems to work:

function F1(clip clip1)
{
clip1=clip1.SelectEvery(1,-1).SeparateFields()
clip1=clip1.FrameEvaluate("""clip1=last""",after_frame=true)
clip1=clip1.FrameEvaluate("""clip1=current_frame%2==0?
\ clip1.subtitle("EvenField="+string(current_frame),y=20):
\ clip1.subtitle("OddField="+string(current_frame),y=40)""",after_frame=true)
clip1=clip1.FrameEvaluate("""current_frame=current_frame/2""",after_frame=true)
clip1=clip1.ScriptClip("""clip1""",after_frame=true)
return clip1.weave()
}

Is there any reason this would be a bad thing to do?

TIA