tnfe / FFCreator

A fast video processing library based on node.js (一个基于node.js的高速视频制作库)
http://tnfe.github.io/FFCreator/
MIT License
2.78k stars 392 forks source link

你好,添加了FFSubtitle后报错,仔细排查过应该不是资源内存不足的原因 #393

Open f1748x opened 10 months ago

f1748x commented 10 months ago
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. (/Users/thomas/web/node/ffcreate/node_modules/fluent-ffmpeg/lib/processor.js:180:22) at ChildProcess.emit (events.js:315:20) at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) Emitted 'error' event on FfmpegCommand instance at: at emitEnd (/Users/thomas/web/node/ffcreate/node_modules/fluent-ffmpeg/lib/processor.js:424:16) at endCB (/Users/thomas/web/node/ffcreate/node_modules/fluent-ffmpeg/lib/processor.js:544:13) at handleExit (/Users/thomas/web/node/ffcreate/node_modules/fluent-ffmpeg/lib/processor.js:170:11) at Socket. (/Users/thomas/web/node/ffcreate/node_modules/fluent-ffmpeg/lib/processor.js:197:11) at Socket.emit (events.js:327:22) at Pipe. (net.js:673:12) [nodemon] app crashed - waiting for file changes before starting..

f1748x commented 10 months ago

info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] 2 info using npm@6.14.11 3 info using node@v14.16.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle ffcreate@0.1.0~prestart: ffcreate@0.1.0 6 info lifecycle ffcreate@0.1.0~start: ffcreate@0.1.0 7 verbose lifecycle ffcreate@0.1.0~start: unsafe-perm in lifecycle true 8 verbose lifecycle ffcreate@0.1.0~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 ffcreate@0.1.0~start: CWD: /Users/thomas/web/node/ffcreate 10 silly lifecycle ffcreate@0.1.0~start: Args: [ '-c', 'node bin/www' ] 11 silly lifecycle ffcreate@0.1.0~start: Returned: code: 1 signal: null 12 info lifecycle ffcreate@0.1.0~start: Failed to exec start script 13 verbose stack Error: ffcreate@0.1.0 start: node bin/www 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:315:20) 13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:315:20) 13 verbose stack at maybeClose (internal/child_process.js:1048:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) 14 verbose pkgid ffcreate@0.1.0 15 verbose cwd /Users/thomas/web/node/ffcreate 16 verbose Darwin 21.6.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 18 verbose node v14.16.0 19 verbose npm v6.14.11 20 error code ELIFECYCLE 21 error errno 1 22 error ffcreate@0.1.0 start: node bin/www 22 error Exit status 1 23 error Failed at the ffcreate@0.1.0 start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

感谢回复🙏

f1748x commented 10 months ago

我的代码 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;

    })
luotingv1 commented 7 months ago

我也遇到了 怎么解决

drawcall commented 7 months ago

mark