main
John Lauer
Keep all six R11 review clips clean; deliver captions through the Wiki player
e1f6118
from pathlib import Path
import json,subprocess
R=Path(__file__).resolve().parents[1];O=R/'videos/compact-r11/chapter'
cues=[(0,2.211,'We turned the fan toward the side of the board,'),(2.574,5.075,'and rotated the molecule to suit the probe head.'),(5.489,8.388,'A new ground contact position keeps the tether clear.'),(8.832,11.437,'The revised board passes native rule checks,'),(11.765,14.387,'and the replay clears these cooling envelopes.'),(14.828,18.170,'The mounting hardware and fan harness\nstill need their own review.')]
def t(s):m=round(s*1000);return f'00:00:{m//1000:02}.{m%1000:03}'
(O/'05-sidefan.vtt').write_text('WEBVTT\n\n'+''.join(f'{t(a)} --> {t(b)}\n{c}\n\n'for a,b,c in cues));(O/'05-sidefan.srt').write_text('\n'.join(f"{i+1}\n{t(a).replace('.',',')} --> {t(b).replace('.',',')}\n{c}\n"for i,(a,b,c)in enumerate(cues)))
n=(O/'05-sidefan.txt').read_text().strip();vf=f"[0:v]trim=end=14.1,setpts=(PTS-STARTPTS)/{14.1/11.32},crop=2560:1396:0:132,scale=1280:698,pad=1280:720:0:0,fps=30,setsar=1[v0];[1:v]scale=-2:720,pad=1280:720:(ow-iw)/2:0,trim=duration=6.96,setpts=PTS-STARTPTS,fps=30,setsar=1[v1];[v0][v1]concat=n=2:v=1:a=0,pad=1280:810:0:0:color=0x101820[v];[2:a]atrim=end=18.28,loudnorm=I=-16:TP=-1.5:LRA=7[a]"
out=O/'05-sidefan-review.mp4';subprocess.run(['ffmpeg','-y','-loglevel','error','-i',str(R/'videos/compact-r11/window-3147662-20261014-023902.mp4'),'-loop','1','-i',str(R/'revisions/compact-r11/kicad/sidefan-v5-review.png'),'-i',str(O/'05-sidefan.mp3'),'-filter_complex',vf,'-map','[v]','-map','[a]','-t','18.28','-c:v','libx264','-preset','fast','-crf','23','-pix_fmt','yuv420p','-c:a','aac','-movflags','+faststart',str(out)],check=True)
r=subprocess.run(['ffmpeg','-hide_banner','-i',str(out),'-af','silencedetect=noise=-40dB:d=0.7','-f','null','-'],capture_output=True,text=True,check=True);(O/'05-sidefan-silence.log').write_text(r.stderr);assert 'silence_start'not in r.stderr
subprocess.run(['adom-video-post','manifest','add',str(O/'storyboard.json'),'--id','05-sidefan','--title','Side-fan layout clears the nominal probe replay','--description','Actual saved-model review at 1.25x and native v5 render. The 90-degree workcell orientation and relocated ground clear the main cooling envelopes; mount and harness are still missing.','--raw',str(out),'--narration',n,'--warning','Geometry-only STEP review omits copper and silk; native still includes them. Cooling bodies are envelopes, not a complete qualified assembly.'],check=True)
print('Fifth narrated/captioned review scene prepared; user review required before assembly.')