View Single Post
Old 25th May 2015, 10:41   #163  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
I approve of this insanity. My idea for solving the reading (not tested but works in theory):

Code:
import vapoursynth as vs

c = vs.get_core()

src = c.ffms2.Source("rule6.avi")

superclip = c.mv.Super(src)
analysis = c.mv.Analyse(superclip, delta=1, isb=True)

vf = open("/stored/vectors.bin")
vector_width = analysis.get_frame(0).width
vector_template_clip = c.std.BlankClip(analysis, height=1, width=vector_width)

def vector_read(n, f):
  vf.seek(n * f.width)
  vector_data = vf.read(f.width)
  fout = f.copy()
  view = fout.get_write_array(0)
  for x in range(fout.width):
    view[0,x] = vector_data[x]
  return fout

vector_clip = c.std.ModifyFrame(clip=vector_template_clip, clips=vector_template_clip, selector=vector_read)
vector_clip.set_output()
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 25th May 2015 at 21:53. Reason: now with tested solution
Myrsloik is offline   Reply With Quote