PDA

View Full Version : New AVS filter creates Smoother playback?


crOOk
2nd November 2003, 23:49
Hello everyone!
I was bored so I created an avs filter named DoubleFramerate. It is supposed to give you a smoother playback (e.g. used with ffvfw when playing back avs files). I simply created frames between each pair of frames by averaging the two surrounding frames.
So basically this filter works like DoubleWeave(), but instead of combining two fields, it uses the average of each frame.
I don't know if it does any good, yet. Maybe some of you (the ones with good eyes, which I lack) would like to try it and tell me if it really creates a smoother vision. I hope I'll get some feedback.


# DoubleFramerate by crOOk
#
# Tries to create smooth vision for the purpose of playback by
# inserting blended frames between each pair of frames, resulting
# in a clip with twice the framecount and framerate.
#

Function DoubleFramerate( clip input) {
Even=input.SelectEven()
Odd=input.SelectOdd()
DoubleEven=ChangeFPS(Even,25.000)
DoubleOdd=ChangeFPS(Odd,25.000).DuplicateFrame(0)
Mixed=Layer(DoubleOdd,DoubleEven,"fast",255,0,0)
Interleaved=Interleave(input,Mixed)
Return Interleaved.DeleteFrame(Framecount(Interleaved)).DeleteFrame(Framecount(Interleaved))
}

crOOk

scharfis_brain
3rd November 2003, 00:12
there already exists a framerate doubler that does this either by blending nearby frames or by motion compensation written by tom barry called framedbl.

crOOk
3rd November 2003, 01:23
I've also tried to triple the framerate (using 75Hz when applying the filter to a pal movie), but did not succeed.
Something seems to be wrong, but I just can't figure out what it is.
Here's my code:

Function TripleFramerate( clip input) {
Even=input.SelectEven()
Odd=input.SelectOdd()

DoubleEven=ChangeFPS(Even,25.000)
DoubleOdd=ChangeFPS(Odd,25.000).DuplicateFrame(0)

Mixed1=Layer(DoubleOdd,DoubleEven,"add",170,0,0)
Mixed2=Layer(DoubleOdd,DoubleEven,"add",85,0,0)

Interleave(input,Mixed1,Mixed2)
}

The first three frames work perfectly fine, but after those it's all screwed up. It seems like the script does the following:
012: input(0), Mixed1(0), Mixed2(0)
345: input(1), Mixed2(1), Mixed1(1)
678: input(2), Mixed1(2), Mixed2(2)
...
What's wrong with the Interleave(input,Mixed1,Mixed2) command?
Someone PLEASE help me, I'm going insane here!

scharfis_brain
3rd November 2003, 08:31
why doing this that complex?

IMO this line returns double framerate output:

interleave(clip,layer(clip,trim(clip,1,0),"fast"))

and this one triple framerate

interleave(clip,layer(clip,trim(clip,1,0),level=170),layer(clip,trim(clip,1,0),level=85))

(both lines not tested in real-life, due to PC-restrictions)

mf
3rd November 2003, 12:28
Yay! More function writers. :D

crOOk
3rd November 2003, 13:17
@scharfis_brain
Thanks for the advice! I didn't realize it was that simple.
But still, your code should do the same as my triple fr function which did not work :(.
Maybe I'll just try it your way to see if the clips are properly interleaved. Just as a reminder: Doing it my way interleaved the clips in a pretty weird way:

3 Clips:
1: A1,B1,C1,D1
2: A2,B2,C2,D2
3: A3,B3,C3,D3

Interleave(1,2,3):
A1,A2,A3,B1,B3,B2,C1,C2,C3,D1,D3,D2

???

crOOk
3rd November 2003, 14:36
Uuups, my mistake. The input clips I used were not what I expected them to be. scharfis_brain's line was actually different from mine. It worked perfectly fine using his code. Thx again.

Couldn't the framerate doubler by tom barry be extended so you could actually set the framerate to the exact refresh rate of the monitor?
It certainly wouldn't be hard to do this with multiples of the original framerate, but everything else would be a pain in the ass I think. Would it even be possible to write a filter in avs which does this? I don't think so.