Jotley / website · jotley.ai / scripts / video-refresh / stage-ipad-generation.py
| 1 | from pathlib import Path |
| 2 | import subprocess,re,json |
| 3 | b=Path('/Volumes/Music/Jotley/Jotley-2.0-App-Store-Videos') |
| 4 | s=b/'capture-2.2-20261023/ios/Jotley-2.2-iPad-Summary.mp4';a=b/'refresh-website-social-20261023/composition/tutorial-ipad-16x9/assets' |
| 5 | 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) |
| 6 | p=a.parent/'index.html';t=p.read_text() |
| 7 | for ident,m in {'sv0':22.6,'sv2':0,'sv5':22.5}.items(): |
| 8 | t,n=re.subn(r'(<video\b[^>]*\bid="'+ident+r'"[^>]*\bdata-media-start=")[^"]*',lambda x:x[1]+str(m),t);assert n==1 |
| 9 | # Only the generation shot uses a disclosed editorial cut through the waiting period. |
| 10 | t=re.sub(r'(<video\b[^>]*\bid="sv2"[^>]*\bsrc=")[^"]*',r'\g<1>assets/ipad-summary-edit.mp4',t) |
| 11 | p.write_text(t) |
| 12 | print('iPad source offsets and generation-wait edit staged') |