import pathlib, subprocess, sys
root=pathlib.Path(__file__).parent
for name in sys.argv[1:]:
    video=root/name
    duration=float(subprocess.check_output(['ffprobe','-v','quiet','-show_entries','format=duration','-of','csv=p=0',str(video)]))
    frames=[]
    for i,fraction in enumerate([.02,.3,.55,.7,.85,.98]):
        frame=root/(video.stem+f'-review-{i}.png');frames.append(str(frame))
        subprocess.run(['ffmpeg','-y','-ss',str(duration*fraction),'-i',str(video),'-vf','scale=480:-1','-frames:v','1',str(frame)],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,check=True)
    subprocess.run(['montage',*frames,'-tile','3x2','-geometry','+2+2',str(root/(video.stem+'-review.png'))],check=True)
