import sys, subprocess
from PIL import Image, ImageDraw
from pathlib import Path
source, output = map(Path, sys.argv[1:])
if source.suffix == '.png':
    image=Image.open(source)
    draw=ImageDraw.Draw(image)
    draw.rectangle((890,140,1279,250),fill='white')
    draw.text((900,165),'[absolute filesystem path redacted]',fill='#666666')
    image.save(output)
else:
    subprocess.run(['ffmpeg','-y','-i',str(source),'-vf',"drawbox=x=880:y=80:w=400:h=250:color=white:t=fill,drawtext=text='Filesystem paths redacted':x=895:y=100:fontsize=16:fontcolor=gray",'-c:v','libvpx-vp9','-crf','32','-b:v','0','-an',str(output)],check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
