View Full Version : Can FreezeFrame be applied iteratively?


Chainmax
25th October 2013, 11:36
Let's say I have a video where bad frames fall more or less within a formula like x+y*n, for example, 175+20n (so, 175, 195, 215, etc...). Is there a way to have all the frames in falling in that formula be replaced by their following one with FreezeFrame? If not, what would you suggest to replicate it with?

Gavino
25th October 2013, 12:27
I think it could be done using stickboy's ApplyEvery (http://avisynth.nl/users/stickboy/ApplyEvery.zip) plugin in some way, but I don't have time to work out the details right now.

martin53
25th October 2013, 19:10
In Runtime Environment (untested),

c
ScriptClip("""
c = last
current_frame % n == x ? c.DeleteFrame(0) : c
""")

martin53
25th October 2013, 19:18
And I think also (assume to replace 2nd frame in group of 4)
Interleave(c, c.DeleteFrame(0), c.DeleteFrame(0,1,2), c.DeleteFrame(0,1,2)).SelectEvery(4)

Gavino
25th October 2013, 19:40
Interleave(c, c.DeleteFrame(0), c.DeleteFrame(0,1,2), c.DeleteFrame(0,1,2)).SelectEvery(4)
Doesn't that just give c?
(Interleaving 4 clips and taking the first frame of each group of 4 will give you the frames of the first clip.)

martin53
25th October 2013, 20:54
Doesn't that just give c?

Interleave(c, c.DeleteFrame(0), c.DeleteFrame(0,1,2), c.DeleteFrame(0,1,2)).SelectEvery(4)
Without the blue '2', yes. But I expect with the blue '2', the third frame (I accidentally wrote 2nd when I meant #2 counted from #0) is in fact one frame ahead.

EDIT: No, you are right, Gavino. SelectEvery takes only the 1st of the interleave group, which is c. Instead it should read
Interleave(c.SelectEvery(4), c.SelectEvery(4,1), c.SelectEvery(4,3), c.SelectEvery(4,3))

Gavino
25th October 2013, 21:37
Interleave(c.SelectEvery(4), c.SelectEvery(4,1), c.SelectEvery(4,3), c.SelectEvery(4,3))
That can be written simply as
c.SelectEvery(4, 0,1,3,3)
which works for the example you gave.

The original problem had groups of 20, which is more tedious to do this way (but clearly possible), but imagine if you wanted to freeze, say, every 100th frame, it starts to become a pain.

Gavino
25th October 2013, 22:27
I think it could be done using stickboy's ApplyEvery (http://avisynth.nl/users/stickboy/ApplyEvery.zip) plugin in some way, but I don't have time to work out the details right now.
This should work for the problem originally described (replace frames 175+20*n by following ones):
start = Trim(0, 174)
Trim(175, 0)
start + InterleaveEvery(DeleteEvery(20), SelectEvery(20,1), 20)

Chainmax
14th November 2013, 04:19
Thanks for the suggestion, I'll try it and get back you.