Jotley / website · jotley.ai / scripts / video-refresh / stage-mac-sources.py
| 1 | #!/usr/bin/env python3 |
| 2 | """Conform verified native Mac footage for the existing website edits, at 1x speed.""" |
| 3 | from pathlib import Path |
| 4 | import json,subprocess |
| 5 | ROOT=Path('/Volumes/Music/Jotley/Jotley-2.0-App-Store-Videos') |
| 6 | WORK=ROOT/'refresh-website-social-20261023'; CAP=ROOT/'capture-2.2-20261023/mac'; A=WORK/'composition/tutorial-mac-16x9/assets'; WEB=WORK/'remotion/public' |
| 7 | receipts=[] |
| 8 | def cut(name,out,ranges,hold=0): |
| 9 | source=CAP/(name+'.mov') |
| 10 | filters=[] |
| 11 | for i,(a,b) in enumerate(ranges):filters.append(f'[0:v]trim=start={a}:end={b},setpts=PTS-STARTPTS[v{i}]') |
| 12 | labels=''.join(f'[v{i}]' for i in range(len(ranges))) |
| 13 | filters.append(f'{labels}concat=n={len(ranges)}:v=1:a=0,tpad=stop_mode=clone:stop_duration={hold},format=yuv420p[v]') |
| 14 | out.parent.mkdir(parents=True,exist_ok=True) |
| 15 | subprocess.run(['ffmpeg','-v','error','-y','-i',str(source),'-filter_complex',';'.join(filters),'-map','[v]','-an','-c:v','libx264','-preset','fast','-crf','12','-movflags','+faststart',str(out)],check=True) |
| 16 | receipts.append({'source':str(source),'output':str(out),'ranges':ranges,'speed':1,'last_frame_hold_seconds':hold}) |
| 17 | cut('Native-first-note',A/'mac-first-note.mp4',[(0,55)]) |
| 18 | cut('Native-summary-template',A/'mac-summary.mp4',[(6.4,31)],5) |
| 19 | cut('Native-summary-template',A/'mac-template.mp4',[(118,124.5),(147,150)],10) |
| 20 | cut('Native-library',A/'mac-organize.mp4',[(4,17),(22,40)],5) |
| 21 | cut('Native-settings',A/'mac-settings.mp4',[(7,23),(40,47)],5) |
| 22 | cut('Native-first-note',WEB/'captures/edits/Mac-Record.mp4',[(16,49)],3) |
| 23 | cut('Native-summary-template',WEB/'captures/edits/Mac-Summary-v21.mp4',[(6.4,25)],4) |
| 24 | cut('Native-summary-template',WEB/'captures/edits/Mac-Template-v21.mp4',[(118,124.5),(147,150)],10) |
| 25 | cut('Native-meeting-live',WEB/'v7/clips/Mac-meeting-live.mp4',[(9.8,20),(24.5,41)],3) |
| 26 | cut('Native-meeting-summary',WEB/'v7/clips/Mac-meeting-template.mp4',[(4,13),(35,41)],10) |
| 27 | # The fresh export take is conformed separately once its native recording has finalized. |
| 28 | (WORK/'mac-media-refresh.json').write_text(json.dumps(receipts,indent=2)+'\n') |
| 29 | print('Staged',len(receipts),'native Mac source edits') |