FFCreator
FFCreator copied to clipboard
你好,添加了FFSubtitle后报错,仔细排查过应该不是资源内存不足的原因
scene1.addAudio({path:path.join(__dirname, "source/voice/1.wav")});
const subtitle = new FFSubtitle({
comma: true, // 是否逗号分割
backgroundColor: '#00219C',
color: '#fff',
fontSize: 24,
x: width / 2,
y: height / 2 + 300,
// 1. srt方式
// path:,
});
subtitle.setText(text);
subtitle.setFont(font1);
subtitle.setSpeech(path.join(__dirname, "./source/voice/1.wav"));
subtitle.frameBuffer = 24;
scene1.addChild(subtitle);
spawn ffprobe ENOENT [FF] Creator production error. FFEvent { type: 'error', pos: 'preProcessing', error: 'spawn ffprobe ENOENT' } events.js:292 throw er; // Unhandled 'error' event ^
Error: ffmpeg was killed with signal SIGKILL
at ChildProcess.
info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/thomas/web/node/ffcreate/node_modules/.bin:/Users/thomas/ffmpeg:/Users/thomas/.docker/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/thomas/ffmpeg:/Users/thomas/.docker/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/thomas/go_item/bin:GOROOT/bin:/Users/thomas/go_item/bin:GOROOT/bin
9 verbose lifecycle [email protected]~start: CWD: /Users/thomas/web/node/ffcreate
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node bin/www' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: node bin/www
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.node bin/www
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
感谢回复🙏
我的代码 go``` FFCreatorCenter.createTemplate(template_id, ({ text, num }) => { console.log("开始合成视频--------------------") // console.log(text) const font1 = path.join(__dirname, './source/font/font1.ttf'); const audio = path.join(__dirname, './bar.m4a'); console.log(num) const creator = new FFCreator({ cacheDir: path.join(__dirname, "./cache"), // outputDir: path.join(__dirname, "../output/voice_user"), outputDir: path.join(__dirname, "./output"), // output:"thomas.mp4", width: width, height: height, log: false, fps: 30, // fps threads: 4, // 多线程(伪造)并行渲染
});
const scene1 = new FFScene();
const video = new FFVideo({
path: path.join(__dirname,"./source/video/2.mp4"),
audio: false,
x: width/2,
y: height/2,
width: width,
height: height
});
console.log("视频高度------1----------")
scene1.addChild(video);
scene1.addAudio({path:audio});
let subtitle = new FFSubtitle({
comma: true, // 是否逗号分割
backgroundColor: '#00219C',
color: '#fff',
fontSize: 24,
x: width / 2,
y: height / 2 + 300,
// 1. srt方式
// path:,
});
subtitle.setText(text);
subtitle.setFont(font1);
subtitle.setSpeech(audio);
subtitle.frameBuffer = 24;
scene1.setDuration(20);
scene1.addChild(subtitle);
creator.addChild(scene1);
creator.start();
creator.openLog();
creator.on("error", (e) => {
console.log(`err-----------:: \n ${e.error}`);
});
creator.on("progress", (e) => {
console.log(
colors.yellow(`合成进度: ${(e.percent * 100) >> 0}%`)
);
});
creator.on("complete", (e) => {
console.log(
colors.yellow(`合成完成:\n ${e.output}`)
);
});
return creator;
})
我也遇到了 怎么解决
mark