Files
AI-cut/scripts/user-shot-frames.mjs
T

8 lines
888 B
JavaScript

import fs from 'node:fs/promises';
import path from 'node:path';
import {run,ffmpeg} from '../desktop/core/media.mjs';
const sources=JSON.parse(await fs.readFile('.test-output/user-cut/sources.json','utf8'));const out=path.resolve('.test-output/user-cut/selected');await fs.mkdir(out,{recursive:true});
const choices=[[21,545.5],[21,549.5],[21,569.5],[21,574.5],[21,581.5],[21,666.5],[21,675.5],[21,687.5],[21,695.5],[21,708.5],[21,720.5],[21,729.5],[21,735.5],[11,649.5],[11,655.5],[11,664.5],[11,676.5],[11,682.5],[11,691.5],[5,1038.5],[5,1053.5],[5,1059.5],[5,1074.5],[5,1101.5],[8,1299.5],[8,1302.5],[8,1305.5]];
for(const [ep,t] of choices){const m=sources.find(m=>m.episode===ep);await run(ffmpeg,['-y','-v','error','-hwaccel','cuda','-ss',String(t),'-i',m.path,'-frames:v','1','-vf',"scale=320:-2",path.join(out,`${ep}-${t}.jpg`)]);}
console.log('Selected frames',choices.length);