import pathlib,subprocess
root=pathlib.Path(__file__).parent
# Both recordings keep their entire interaction. Cover only private environment labels,
# synthetic workspace paths, and the composer footer that includes a runtime identifier.
filters=','.join(['drawbox=x=560:y=234:w=650:h=44:color=0xdddddd:t=fill','drawbox=x=1070:y=878:w=610:h=44:color=0xdddddd:t=fill','drawbox=x=600:y=1460:w=1700:h=120:color=0xdddddd:t=fill','scale=1280:800'])
for side in ['base','head']:
 subprocess.run(['ffmpeg','-y','-loglevel','error','-i',str(root/f'{side}-raw.mp4'),'-vf',('drawbox=x=2050:y=158:w=340:h=38:color=0xdddddd:t=fill'+(":enable='lt(t,61.5)'" if side=='head' else '')+','+filters),'-c:v','libx264','-preset','fast','-crf','20','-an',str(root/f'{side}-flow.mp4')],check=True)
# Captures were stable in two consecutive browser snapshots at least 500 ms apart.
for name in ['base-history','head-result']:
 subprocess.run(['ffmpeg','-y','-loglevel','error','-i',str(root/f'{name}-raw.png'),'-vf','crop=2560:800:0:0,scale=1280:400','-frames:v','1',str(root/f'{name}.png')],check=True)
