const fs=require('node:fs'),path=require('node:path'),{spawnSync}=require('node:child_process'); const local=path.resolve('work/frame-builder/node_modules/ffmpeg-static/ffmpeg.exe'); const ff=process.env.PVF_FFMPEG||(fs.existsSync(local)?local:'ffmpeg'),d=__dirname,log=[]; function run(a){const r=spawnSync(ff,['-hide_banner','-nostdin','-y',...a],{cwd:d,maxBuffer:50e6});log.push({args:a,status:r.status,stderr:String(r.stderr)});fs.writeFileSync(d+'/command-output.txt',JSON.stringify(log,null,2));if(r.status)throw Error(String(r.stderr));return r;} const w=64,h=32,n=12,raw=Buffer.alloc(w*h*3*n); for(let f=0;fv!==(x%2?240:16)).length,lumaMin:Math.min(...luma),lumaMax:Math.max(...luma)}; } fs.writeFileSync(d+'/measurements.json',JSON.stringify(results,null,2));console.log(JSON.stringify(results,null,2));