View Single Post
Old 18th November 2011, 17:21   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
From v1.02 update:

Quote:
Originally Posted by StainlessS View Post
Code:
#--------------------------------------------------------------------------------------------------------
    # Template, to KEEP frames where YDiffFromPrevious is greater than 0.1 (delete those that are less than).
    # The '|| current_frame==0' part of the condition is required for the first frame as it always results in 0
    # using YDifferenceFromPrevious on frame zero.
    # Could use other conditionals to keep/delete for other applications.

    Avisource("In.avi").ConvertToYV12() # Ensure Planar for YDifferenceFromPrevious (not necessary for Prune pass).
    assumeFPS(250.0)    # Fast as we can
    Writefileif("In_cmd.txt","YDifferenceFromPrevious>=0.1 || current_frame==0",""" "0," ""","current_frame",append=false)
    #--------------------------------------------------------------------------------------------------------

And for the 2nd pass for Prune(),
    #--------------------------------------------------------------------------------------------------------
    Avisource("In.avi")     # ConvertToYV12(), Not Necessary here.
    Prune(cmd="In_Cmd.txt")
    #--------------------------------------------------------------------------------------------------------

Just a little idea of where this might be useful, security cameras where you want just the interesting bits
and omit the masses of static frames that are of no interest but you might want to raise the condition above 0.1 as
used above to avoid false alarms.
ref: above
Also, if your security cam footage has some kind of timecode on it, you could blank it (temporarily)
for the WriteFileIf pass (using eg blankclip/resize/overlay) and remove for the Prune pass.
Also, if it did not have a timecode, then you could add one
during the Prune pass so you could examine interesting snips from the edited footage using the original clip.

Here is a snippet stolen from Gavino:
http://forum.doom9.org/showthread.ph...42#post1539542

EDIT:-
Code:
function DeleteFrames2(clip c, string condition, string fileName) {
  keepCondition = "!(" + condition + ")"
  WriteFileIf(c, fileName, keepCondition, """ "0," """, "current_frame", append=false)
}
}
The above snip, provides a more flexible interface than using the "WriteFileIf" directly but for deleting frames.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 18th November 2011 at 21:04.
StainlessS is offline   Reply With Quote