Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #strange v1.3 by mirkosp
- #Yet Another function similar to ApplyRange in purpose that works somewhat differently.
- #Start and end work exactly like first_frame and last_frame work with trim(), for the
- #sake of consistency, which means that you can use end as if it was -num_frames too.
- #ofps parameter tells whether to keep the original fps (true) or not (false).
- #For reference: http://avisynth.org/mediawiki/Trim
- function strange (clip c, int "start", int "end", clip "edit", bool "ofps") {
- #This function only makes sense with filters that return clips to begin with, so no
- #point in bothering with strings. It's both easier and better.
- start = default(start,0)
- end = default(end,0)
- edit = default(edit,blankclip(c,length=c.framecount()))#everybody loves blankclip
- amount = c.framecount()
- ofps = default(ofps,false)
- #Brainfarts check ahead.
- start = (start < 0) ? 0 : start
- end = (-end > amount-start) ? 0 : end
- start = (start > amount-1) ? amount-1 : start
- end = (end > amount-1) ? 0 : end
- #Match framerate in case user's custom filtering would change it
- c = !ofps ? c.assumefps(edit) : c
- edit = ofps ? edit.assumefps(c) : edit
- #I'm not a good programmer, so I'm not sure if this is slower than it could be.
- (start == 0) ? ((end == 0) || (end == amount-1)) ? edit :\
- (end < 0) ? edit.trim(0,end)+c.trim(start-end,0) :\
- edit.trim(0,end)+c.trim(end+1,0) :\
- (start == 1) ? ((end == 0) || (end == amount-1)) ? c.trim(0,-1)+edit.trim(start,0) :\
- (end < 0) ? c.trim(0,-1)+edit.trim(start,end)+c.trim(start-end,0) :\
- c.trim(0,-1)+edit.trim(start,end)+c.trim(end+1,0) :\
- ((end == 0) || (end == amount-1)) ? c.trim(0,start-1)+edit.trim(start,0) :\
- (end < 0) ? c.trim(0,start-1)+edit.trim(start,end)+c.trim(start-end,0) :\
- c.trim(0,start-1)+edit.trim(start,end)+c.trim(end+1,0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement