import json, pathlib, subprocess, sys
proof=json.load(open(sys.argv[1]))
out=pathlib.Path(sys.argv[2]); out.mkdir(exist_ok=True)
for side in ('base','head'):
 for source in proof[side]['captures']:
  narrow='narrow' in source
  box='151,148 325,166' if narrow else '488,193 882,212'
  subprocess.run(['convert',source,'-fill','#fafafa','-draw','rectangle '+box,str(out/(side+'-'+pathlib.Path(source).name))],check=True)

 for source in proof[side]['videos']:
  subprocess.run(['ffmpeg','-y','-i',source,'-vf','drawbox=x=148:y=147:w=180:h=22:color=white:t=fill,drawbox=x=485:y=191:w=405:h=24:color=white:t=fill','-an',str(out/(side+'-interaction.mp4'))],check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
