Thread: Vapoursynth
View Single Post
Old 1st May 2018, 22:44   #3073  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by ChaosKing View Post
Is it possible to compare the value of f.props.PlaneStatsAverage in a FrameEval function with the previous and the next frame (n-1 and n+1)? Sould I use get_frame_async() for that?

Code:
def g(n, f, clip, d_clip):
	clip=clip.text.Text("current: "+ f.props.PlaneStatsAverage)
	clip=clip.text.Text("\nPrev: "+ ???)
	clip=clip.text.Text("\n\nNext: "+ ???)
		
	return clip
clip = clip.std.FrameEval(functools.partial(g, d_clip=d_clip, clip=clip), prop_src=x)
Edit
This works but feels more like a hack.
Code:
x= clip.std.PlaneStats()
x1= clip.std.PlaneStats().std.DuplicateFrames(0) #prev
x2= clip.std.PlaneStats().std.Trim(1) #next

clip = clip.std.FrameEval(functools.partial(g, d_clip=d_clip, clip=clip), prop_src=[x, x1, x2])
That's the right way.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote