feat: 开源轻映 AI 桌面剪辑工作台及抽帧复核功能
This commit is contained in:
1 parent
9af7c2fe86
commit
b51ef85dbd
46 files changed
+6916
-2
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import {run,ffmpeg} from '../desktop/core/media.mjs';
|
||||
const root=path.resolve('output/无职转生_30秒燃向卡点');
|
||||
const dest=path.resolve('.test-output/frame-audit-v1');await fs.mkdir(dest,{recursive:true});
|
||||
const sources=JSON.parse(await fs.readFile('.test-output/user-cut/sources.json','utf8'));
|
||||
const edl=JSON.parse(await fs.readFile(path.join(root,'剪辑清单.json'),'utf8'));
|
||||
for(const s of edl.shots){
|
||||
const m=sources.find(x=>x.episode===s.episode);
|
||||
for(const [kind,file,start,len] of [['source',m.path,s.sourceIn,s.sourceOut-s.sourceIn],['output',path.join(root,'无职转生_超燃卡点_30秒_RTX5080.mp4'),s.timelineStart,s.duration]]){
|
||||
await run(ffmpeg,['-y','-v','error','-hwaccel','cuda','-ss',String(start),'-i',file,'-vf',`select='eq(n,0)+gte(t,${len*.5})*lt(prev_selected_t,${len*.5})+gte(t,${len-.07})*lt(prev_selected_t,${len-.07})',scale=320:180,tile=3x1`,'-frames:v','1',path.join(dest,`${s.index}-${kind}.jpg`)]);
|
||||
}
|
||||
console.log('Compared frames',s.index);
|
||||
}
|
||||
await fs.writeFile(path.join(dest,'shots.json'),JSON.stringify(edl.shots,null,2));
|
||||
const src=sources.find(s=>s.episode===21);
|
||||
for(const [start,len] of [[540,60],[660,40],[700,45]]){
|
||||
await run(ffmpeg,['-y','-v','error','-hwaccel','cuda','-ss',String(start),'-t',String(len),'-i',src.path,'-vf',`fps=1,scale=320:180,setpts=PTS+${start}/TB,drawtext=fontfile='C\\:/Windows/Fonts/consola.ttf':text='%{pts\\:hms}':fontsize=22:fontcolor=white:box=1:boxcolor=black@0.8:x=5:y=5,tile=5x${Math.ceil(len/5)}`,'-frames:v','1',path.join(dest,`source21-${start}.jpg`)]);
|
||||
}
|
||||
Reference in new issue
Block a user