Firstly I must apologise, as it was me who added the second example.
I see now that it's not quite right. It should be:
Code:
...
Function CombingInfo(clip c) {
file = "interlace.log"
c = FrameEvaluate(c,"
diff = 0.50*YDifferenceFromPrevious() + 0.25*UDifferenceFromPrevious() + 0.25*VDifferenceFromPrevious()
b = IsMoving(diff)
a = IsCombed(combedthreshold)
")
c = WriteFile(c, file, "a", "sep", "b")
return c
}
...
That is, the WriteFile call should come
after the FrameEvaluate().
As it was, the values of
a and
b were not defined on the first frame (and on later frames wrongly referred to the
previous frame). That's because the YDifferenceFromPrevious() requests a frame from WriteFile before the variables have been assigned a value.
The first example works OK because there the input to YDifferenceFromPrevious (etc) is the global clip, and a frame is not requested from WriteFile until all the variables have been assigned.
So your function should work if you move the WriteFile call to be after FrameEvaluate().