View Full Version : Influencing future frames in a function
wlndd6
22nd February 2012, 12:50
Is it possible to do something like this (pseudo code):
global int count=0
clip sceneChangeMask
clip normalMask
function returnMask (clip clp){
if(scenechange(clp))count=6;
if(count==0)return normalMask
else{ count--;
return sceneChangeMask}
}
What returnMask is supposed to do is return sceneChangeMask at a scene change and for the next 6 frames afterwards. Otherwise, just return normalMask.
Didée
22nd February 2012, 13:16
Using MaskTools for simplicity (Overlay() could do it too, but probably slower, and I'm not sure ATM about the exact syntax :o )
SC_mask = [however you create it]
SC_mask = SC_mask.mt_logic(SC_mask.selectevery(1,-1),"max")
\ .mt_logic(SC_mask.selectevery(1,-2),"max")
\ .mt_logic(SC_mask.selectevery(1,-3),"max")
\ .mt_logic(SC_mask.selectevery(1,-4),"max")
\ .mt_logic(SC_mask.selectevery(1,-5),"max")
\ .mt_logic(SC_mask.selectevery(1,-6),"max")
wlndd6
22nd February 2012, 14:11
Using MaskTools for simplicity (Overlay() could do it too, but probably slower, and I'm not sure ATM about the exact syntax :o )
SC_mask = [however you create it]
SC_mask = SC_mask.mt_logic(SC_mask.selectevery(1,-1),"max")
\ .mt_logic(SC_mask.selectevery(1,-2),"max")
\ .mt_logic(SC_mask.selectevery(1,-3),"max")
\ .mt_logic(SC_mask.selectevery(1,-4),"max")
\ .mt_logic(SC_mask.selectevery(1,-5),"max")
\ .mt_logic(SC_mask.selectevery(1,-6),"max")
Thanks for your help! So should your SC_mask act as a 6 frame clip? Been trying to use it with SCTools but it only shows up for one frame. Guess I'll have to try ConditionalFilter...
Didée
22nd February 2012, 14:44
What is SCTools?
The script assumes that "SC_mask" is the clip that contains the scenechanges: black frames when there is no scenechange, and white frame at scenechange.
If SC_mask is all black, but frame 12 is white (because a scenechange was detected at frame 12), then the result of above script is that frames (12,13,14,15,16,17,18) are white.
I.e. the script is doing exactly what you have asked for. Perhaps you need to explain more closely what you are doing.
wlndd6
22nd February 2012, 15:08
What is SCTools?
The script assumes that "SC_mask" is the clip that contains the scenechanges: black frames when there is no scenechange, and white frame at scenechange.
If SC_mask is all black, but frame 12 is white (because a scenechange was detected at frame 12), then the result of above script is that frames (12,13,14,15,16,17,18) are white.
I.e. the script is doing exactly what you have asked for. Perhaps you need to explain more closely what you are doing.
The problem above was that I was assuming that the scene change mask was always black, and that it replaces the normal mask based on a conditional (i.e. if scene change => use scene change mask) and didn't clearly say that. Sorry about that.
But what you posted is what I wanted anyway and it's working perfectly now, thanks again :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.