from pathlib import Path
import subprocess
root=Path(__file__).parent
for name,sha in [('before-citation','871b00907d'),('after-citation','0654628e44'),('before-escape','871b00907d'),('after-escape','0654628e44')]:
 side='BEFORE' if name.startswith('before') else 'AFTER'
 case='Cite during dictation, then finish' if 'citation' in name else 'Cite during dictation, focus comment, press Escape'
 footer=f'{side} {sha} | Web / Chromium / Linux | 1280 x 800 / light / synthetic microphone / local ASR'
 vf=f"fps=30,scale=1280:800,tpad=stop_mode=clone:stop_duration=6,pad=1280:872:0:0:color=0x141820,drawtext=text='{footer}':fontcolor=white:fontsize=18:x=16:y=813,drawtext=text='{case}':fontcolor=white:fontsize=18:x=16:y=843"
 subprocess.run(['ffmpeg','-y','-i',str(root/(name+'-raw.mp4')),'-t','16','-vf',vf,'-an','-r','30','-fps_mode','cfr','-c:v','libx264','-preset','ultrafast','-crf','20','-pix_fmt','yuv420p','-map_metadata','-1','-movflags','+faststart',str(root/(name+'.mp4'))],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,check=True)
 subprocess.run(['ffmpeg','-y','-i',str(root/(name+'.mp4')),'-vf','fps=1/2,scale=640:-1,tile=4x2','-frames:v','1',str(root/(name+'-final-review.png'))],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,check=True)
