Log in

View Full Version : ConditionalSelect with smaller test clip


MysteryX
30th April 2017, 00:35
I have clip Mask that I can to evaluate with ConditionalSelect. Let's say this clip is 20x20 Y8.

Then I have 3x YV12 640x640 clips: Clip1, Clip2 and Clip3. I want to return either of the 3 clips based on the average value of Mask.

Problem is: ConditionalSelect requires the test clip to be of the same size and format as the return clips!

Is there any way around this limitation?

The only work-around I can see is to resize the mask to YV12 640x640, which will be a performance waste. Also, I can't call ConvertToYV12 but the source format could be YV16, YV24 or a variety of other formats so I'm not sure how to handle it.

Ideas?

raffriff42
30th April 2017, 03:42
Don't use ConditionalSelect - use ScriptClip. Just make sure that what comes out matches what went in.ColorbarsHD
ScriptClip(Last, """
A = ((current_frame % 3) == 0) [* any conditional statement *]
\ ? Last.BicubicResize(Width/4, Height/4)
\ : Last.BicubicResize(Width/2, Height/2)
return A.Info.BicubicResize(Width, Height) [* make samey same *]
\ .Subtitle(String(current_frame), size=Height, align=2)
""")
return Last

MysteryX
30th April 2017, 06:16
Great, that works -- with GScriptClip, otherwise I can't supply the 3 input clips.

StainlessS
30th April 2017, 08:58
You can replace any of the conditional type filters with ScriptClip/GScriptclip, it is much more versatile.

EDIT: Possible exception ConditionalReader().