View Single Post
Old 5th October 2015, 21:07   #16  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,743
Quote:
Originally Posted by vivan View Post
I meant "unless" not "until", sorry. Yeah, that typo changed my explanation into a complete wrong one.
But no, you assign values to variables... Well, they will be objects in C#/Java, but still not functions. They have "clip" type, so lets simly call them clips.

You don't assign functions to anything, you assign their result. But that result is calculated "lazily", only when it's needed.
Just think about it as if clip was just a number.

Another thing to note is that every function uses "last" as first input if no input is specified. Or uses specified clip, if you write it like this: "clip.function()", which is equal to "function(clip)".

So this code
Code:
LWLibavVideoSource("Dji ext.mpg")
luma = SeparateFields().Trim(1, 0).Weave()
chroma = SeparateFields().SelectEvery(2, 1, 0).Trim(1, 0).Weave()
luma.MergeChroma(chroma)
actually means
Code:
last = LWLibavVideoSource("Dji ext.mpg")
luma = SeparateFields(last)
luma = Trim(luma, 1, 0)
luma = Weave(luma)
chroma = SeparateFields(last)
chroma = SelectEvery(chroma, 2, 1, 0)
chroma = Trim(chroma, 1, 0)
chroma = Weave(chroma)
last = MergeChroma(luma, chroma)
return last
Woaw, I will have to read it several times to understand it, I'm a little bit confused with this.

Quote:
Originally Posted by vivan View Post
While this works opening video twice is not a "clean" solution. Probably this way it will be easier to modify:
Code:
source = LWLibavVideoSource("P:\Dji ext.mpg")
luma = source.SeparateFields().Trim(1, 0).Weave()
chroma = source.SeparateFields().SelectEvery(2, 1, 0).Trim(1, 0).Weave()
result = luma.MergeChroma(chroma)
StackHorizontal(source, result)
Actually my script is simpler. The problem with yours is that I can't add easily functions (I like to see them one above the other).
Is there a way to open only 1 time the video and make a script a simple as mine, without result = and without typing source. each time a new line is added ?

Edit : I believe I have found, tell me if it's ok or if it has disadvantages ;
Code:
v1=LWLibavVideoSource("P:\Dji ext.mpg")
v2=v1
last=v1
luma = SeparateFields().Trim(1, 0).Weave()
chroma = SeparateFields().SelectEvery(2, 1, 0).Trim(1, 0).Weave()
luma.MergeChroma(chroma)
greyscale()#just to show that functions can be added this way
stackhorizontal(last,v2)#last is black and white, v2 is untouched (except its field order)
Quote:
Originally Posted by vivan View Post
Yes, after you do Weave() clip becomes BFF.

Wiki says thatHonestly I have no idea how it works.
There is no problem with weave, the result is logical, I was talking about the order in stackhorizontal.
Here is the explanation, that's what I guessed ;
http://avisynth.nl/index.php/StackHorizontal
Quote:
Most other information (sound track, frame rate, etc) is taken from the first clip
Which explains why the 2nd clip became BFF (as the 1st) while it was originally TFF.

Last edited by Music Fan; 5th October 2015 at 21:32.
Music Fan is offline   Reply With Quote