from pathlib import Path import subprocess,re,json b=Path('/Volumes/Music/Jotley/Jotley-2.0-App-Store-Videos') s=b/'capture-2.2-20261023/ios/Jotley-2.2-iPad-Summary.mp4';a=b/'refresh-website-social-20261023/composition/tutorial-ipad-16x9/assets' subprocess.run(['ffmpeg','-v','error','-y','-i',str(s),'-filter_complex','[0:v]trim=start=5:end=8,setpts=PTS-STARTPTS[a];[0:v]trim=start=15.5:end=20,setpts=PTS-STARTPTS,tpad=stop_mode=clone:stop_duration=1.5[b];[a][b]concat=n=2:v=1:a=0,tpad=stop_mode=clone:stop_duration=5[v]','-map','[v]','-an','-c:v','libx264','-preset','fast','-crf','12','-pix_fmt','yuv420p','-movflags','+faststart',str(a/'ipad-summary-edit.mp4')],check=True) p=a.parent/'index.html';t=p.read_text() for ident,m in {'sv0':22.6,'sv2':0,'sv5':22.5}.items(): t,n=re.subn(r'(]*\bid="'+ident+r'"[^>]*\bdata-media-start=")[^"]*',lambda x:x[1]+str(m),t);assert n==1 # Only the generation shot uses a disclosed editorial cut through the waiting period. t=re.sub(r'(]*\bid="sv2"[^>]*\bsrc=")[^"]*',r'\g<1>assets/ipad-summary-edit.mp4',t) p.write_text(t) print('iPad source offsets and generation-wait edit staged')