View Single Post
Old 19th August 2017, 02:53   #9  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by TheFluff View Post
No that way won't work. vspipe normally writes frame data to stdout (assuming you use - as the output filename) and status/progress messages to stderr. You don't want raw frame data though, that's of no use to you. What you do want is frame numbers. My idea was that to capture the WWXD scene change numbers you'd tack on a FrameEval after WWXD and inspect the frame props in there. Once you have a frame number you can either make a list of them in python and write that to a file or something, or you can go with my original idea and just print() them. print() writes to stdout, so normally you don't want to do that in a .vpy since it'd get mixed in with your actual frame data that vspipe is writing to stdout at the same time, so you'd have to use . as the output filename to get vspipe to leave stdout alone. When you do that, you can read the frame numbers from the stdout pipe in caller.vpy by calling child.stdout.readlines(). You'll get them back as a line of strings.
um I still getting the same error even with the "." at the end of the vspipe command.

caller
Code:
import vapoursynth as vs
import subprocess

core = vs.get_core(accept_lowercase=True)

command = "vspipe child.vpy ."

sc_list = []

child = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

while True:
	line = child.stdout.readline()
	if line == '':   
		break
	sc_list.append(line)
child
Code:
import vapoursynth as vs

core = vs.get_core(accept_lowercase=True)

clip = core.ffms2.Source(r"abc.avi")
clip = core.wwxd.WWXD(clip)

def PrintSC(n,f,clip):
	if f.props.Scenechange:
		print(n)
	return clip

sc_clip = core.std.FrameEval(clip, functools.partial(PrintSC, clip=clip), clip)

sc_clip.set_output()
And are you sure that it will speed it up this way? Because I ran the child script in command line and the speed was the same as doing it with the for loop.
lansing is offline   Reply With Quote