main
John Lauer Add verified 1080p master of the full build and thermal analysis video 7c44ee7
from pathlib import Path
import json,subprocess
R=Path(__file__).resolve().parents[1];O=R/'videos/cooling-volume';F=R/'videos/full-edit-with-thermal'
def run(a):subprocess.run(a,check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
a=json.loads((F/'edit-report.json').read_text());parts=[]
for s in a['segments']:
 out=O/(s['id']+'-1080p.mp4');run(['ffmpeg','-y','-i',str(O/(s['id']+'-raw.mp4')),'-i',str(O/(s['id']+'-tight.wav')),'-filter_complex',f"[0:v]setpts={(1/s['visualSpeed'])}*(PTS-STARTPTS),scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,fps=30,setsar=1[v]",'-map','[v]','-map','1:a','-t',str(s['audioSeconds']),'-c:v','libx264','-preset','fast','-crf','20','-g','30','-pix_fmt','yuv420p','-c:a','aac','-ar','48000','-b:a','128k',str(out)]);parts.append(out)
base=R/'videos/full-edit-r10-tight/electronic-load-r10-captioned-1080p.mp4';lst=F/'master-concat.txt';lst.write_text(''.join(f"file '{p}'\n" for p in [base,*parts]));out=F/'electronic-load-with-thermal-1080p.mp4';run(['ffmpeg','-y','-f','concat','-safe','0','-i',str(lst),'-c:v','libx264','-preset','fast','-crf','21','-g','30','-pix_fmt','yuv420p','-c:a','aac','-ar','48000','-b:a','128k','-movflags','+faststart',str(out)]);print(out.stat().st_size,flush=True)