Giter VIP home page Giter VIP logo

ffcreator's Issues

请问如何运行?

小白求教:
missing script: start

如何创建项目

如何启动项目

文档里写的不是很清晰

如何把案例运行起来?

How to set font `Microsoft YaHei`

const ftext = new FFText({text, x: width / 2, y: height - 50, fontSize: 25});
ftext.setColor('#fff');
ftext.setFont("微软雅黑")
// ftext.setFont("Microsoft YaHei")
OR:
var pathNameFont = "./assets/fonts/msyh.ttf";
const FONT_PATH = path.join(__dirname, pathNameFont);
ftext.setFont(FONT_PATH)

Doesn't work.


(process:12272): Pango-WARNING **: 00:40:24.754: couldn't load font " Not-Rotated 25px", falling back to "Sans Not-Rotated 25px", expect ugly output.

(process:12272): Pango-WARNING **: 00:40:24.815: couldn't load font "  25px", falling back to "Sans 25px", expect ugly output.

How to disable scene transition effect

If I set scene.setTransition( null,0); It thow error.
If I delete the line scene.setTransition('TricolorCircle', 1.5); It will automatically set a default scene transition

const creatScene = ({index, transition, text, fileNameFull}) => {
  const scene = new FFScene();
  scene.setBgColor('#000');
  scene.setDuration(5);
 // scene.setTransition( null);// transition, 1);

how to custom the start positon of album transition

can i custom the start position of album transtion
whe i use FFAlbum to create a photo album
the transition start postion don't meet my requirements
how can i custom it
the code:

const album = new FFAlbum({
  list: ['./temp/1.jpg', './temp/2.jpg', './temp/3.jpg'],   // Picture collection for album
  x: 540,
  y: 960,
  width: 1080,
  height: 1920,
});
// album.setTransition('fadeInRightBig');      // Set album switching animation
// album.setTransition('slideInRight');
album.setTransition('fadeInRight');
album.setDuration(2.5);             // Set the stay time of a single sheet
album.setTransTime(1.5);            // Set the duration of a single animation
scene.addChild(album);

the current behavior:

start position of slideInRight and fadeInRight
  | start positon of fadeInRightBig
  |   |
  V   V
<---img--->

my requirement:

         my requirement
          |
          V
<---img--->

/lib/utils/date.js cause some error……

return time < 100 ? time * 1000 : time;

return time > 100 ? time / 1000 : time;

[FF] Synthesis synthesis start: 
ffmpeg -framerate 60 -vcodec rawvideo -pixel_format bgra -video_size 1280x720 
-i /opt/peiyin/resource/cache/j8xn /opt/peiyin/resource/nls/1611649900185.0.mp3 
-i /opt/peiyin/resource/nls/1611649900185.1.mp3 
-i /opt/peiyin/resourc 
-i /opt/peiyin/resource/nls/1611649900185.3.mp3 
-i /opt/peiyin/resource/nls/1611649900185.4.mp3 -y 
-filter_complex 
[1]adelay=0|0[2280[audio1];
[3]adelay=54808|54808[audio2];
[4]adelay=241.944|241.944[audio3];
[5]adelay=254.26399999999998|254.26399999999998[audio4];
[audio0][audio1][audio2][de_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -r 24 -c:a aac -shortest /resource/nls/1611649900185.mp4

date.js 里的这个 toMilliseconds 和 toSeconds 方法中的这个判断。。。 在加入长音频的时候很容易出错的样子,打印出来的合成串里 adelay 明显就是出了错的,手工把这个写死成 return time * 1000 ;return time / 1000 ; 之后工作正常,但是不确定其他地方有没有影响。。。
话说为什么要加这个限制?

new FFImage file name does not support Chinese?中文名就报错了

  const img = path.join(__dirname, `./assets/imgs/trans/一0${index}.jpeg`);
  const bg = new FFImage({path: img, resetXY: true});
  scene.addChild(bg);

  // title text
  const ftext = new FFText({text, x: width / 2, y: height / 2 + 50, fontSize: 38});
  ftext.setColor('#30336b');
  ftext.alignCenter();
  ftext.setBackgroundColor('#ffffff');
  ftext.addEffect('fadeInRight', 1, 1.3);
  ftext.setStyle({padding: [4, 12, 6, 12]});
  scene.addChild(ftext);
(node:9836) ExperimentalWarning: The fs.promises API is experimental
(node:9836) UnhandledPromiseRejectionWarning: Error: ENOENT, No such file or directory 'C:\Users\asus\FFCreator\examples\assets\imgs\trans\一01.jpeg'
    at setSource (C:\Users\asus\FFCreator\node_modules\canvas\lib\image.js:91:13)
    at Image.set (C:\Users\asus\FFCreator\node_modules\canvas\lib\image.js:62:9)
    at Promise (C:\Users\asus\FFCreator\node_modules\canvas\index.js:34:15)
    at new Promise (<anonymous>)
    at loadImage (C:\Users\asus\FFCreator\node_modules\canvas\index.js:23:10)
    at Object.ENV.loadImage (C:\Users\asus\FFCreator\node_modules\spritejs\lib\platform\node-canvas.js:38:43)
    at loadTexture (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:28552:63)
    at _callee$ (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:28573:30)
    at tryCatch (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:10088:40)
    at Generator.invoke [as _invoke] (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:10318:22)
(node:9836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:9836) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:9836) UnhandledPromiseRejectionWarning: Error: ENOENT, No such file or directory 'C:\Users\asus\FFCreator\examples\assets\imgs\trans\一01.jpeg'
    at setSource (C:\Users\asus\FFCreator\node_modules\canvas\lib\image.js:91:13)
    at Image.set (C:\Users\asus\FFCreator\node_modules\canvas\lib\image.js:62:9)
    at Promise (C:\Users\asus\FFCreator\node_modules\canvas\index.js:34:15)
    at new Promise (<anonymous>)
    at loadImage (C:\Users\asus\FFCreator\node_modules\canvas\index.js:23:10)
    at Object.ENV.loadImage (C:\Users\asus\FFCreator\node_modules\spritejs\lib\platform\node-canvas.js:38:43)
    at loadTexture (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:28552:63)
    at _callee$ (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:28573:30)
    at tryCatch (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:10088:40)
    at Generator.invoke [as _invoke] (C:\Users\asus\FFCreator\node_modules\spritejs\dist\spritejs.js:10318:22)
(node:9836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
(node:9836) UnhandledPromiseRejectionWarning: Error: ENOENT, No such file or directory 'C:\Users\asus\FFCreator\examples\assets\imgs\trans\一02.jpeg'

How to make it enable to set float second value to the duration?

 SCENE_DURATION= Math.ceil(res.duration)
  // title text
  const subtitle = new FFSubtitle({
    comma: true, // 是否逗号分割
    backgroundColor: '#444359',
    color: '#fff',
    fontSize: 24,
    x: width / 2,
    y: height - 50
  });
  subtitle.setFont("Simsun")//FONT_PATH")
  subtitle.setText(text);
  subtitle.setSpeech(ttsFile); // 语音配音-tts
  subtitle.frameBuffer = 24;
  subtitle.setDuration(SCENE_DURATION)
  scene.addAudio(ttsFile)
  scene.addChild(subtitle);

If I set the duration to float, it will stop at about FFCreator progress: render-frame 65%.

Because the tts voice and the subtitle is not exactly at the same time in a long words. The time must set to very accurate.
Sometimes the subtile is faster, and sometimes the tts voice is faster appearing to the subtitle.
How to make it accurately?

Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found

node:internal/modules/cjs/loader:1161
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/username/server/node_modules/canvas/build/Release/canvas.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18)

Error: FFCreator error: ffmpeg exited with code 1: Unrecognized option 'preset'.

FFCreator error: ffmpeg exited with code 1: Unrecognized option 'preset'.
Error splitting the argument list: Option not found

[FF] Creator production error. [object Object]
[FF] Synthesis stdout:
stderr:Unrecognized option 'preset'.
Error splitting the argument list: Option not found
ffmpeg exited with code 1: Unrecognized option 'preset'.
Error splitting the argument list: Option not found

我遇到一些问题在 Apple Mac Mini M1 芯片上: `Error: Could not locate the bindings file.`

电脑系统:Apple Mac Mini M1 芯片, macOs Big Sur 11.2.3
Node 环境:

node -v
v14.15.3

node
> process.arch
'x64'
> process.platform
'darwin'
> 

FFmpeg 已安装:

ffmpeg
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/4.3.2_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

当我运行代码后,控制台出现如下报错

> node index.js

/Users/lorcannn/code/project/short-video-creator/node_modules/bindings/bindings.js:135
  throw err;
  ^

Error: Could not locate the bindings file. Tried:
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/Debug/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/Release/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/out/Debug/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/Debug/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/out/Release/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/Release/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/default/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/compiled/14.15.3/darwin/x64/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/addon-build/release/install-root/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/addon-build/debug/install-root/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/addon-build/default/install-root/webgl.node
 → /Users/lorcannn/code/project/short-video-creator/node_modules/gl/lib/binding/node-v83-darwin-x64/webgl.node
    at bindings (/Users/lorcannn/code/project/short-video-creator/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/Users/lorcannn/code/project/short-video-creator/node_modules/gl/src/javascript/native-gl.js:1:40)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/lorcannn/code/project/short-video-creator/node_modules/gl/src/javascript/webgl-rendering-context.js:4:58)
    at Module._compile (internal/modules/cjs/loader.js:1063:30) {
  tries: [
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/Debug/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/Release/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/out/Debug/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/Debug/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/out/Release/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/Release/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/build/default/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/compiled/14.15.3/darwin/x64/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/addon-build/release/install-root/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/addon-build/debug/install-root/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/addon-build/default/install-root/webgl.node',
    '/Users/lorcannn/code/project/short-video-creator/node_modules/gl/lib/binding/node-v83-darwin-x64/webgl.node'
  ]
}

当我注释以下代码后,其他代码正常运行

const {FFScene, FFImage, FFCreator} = require('ffcreator');

throw new Error("Sorry, your browser doesn't support WebGL.");

/Users/Downloads/FFCreator-master/node_modules/spritejs/dist/spritejs.js:10884
throw new Error("Sorry, your browser doesn't support WebGL.");
^
Error: Sorry, your browser doesn't support WebGL.
at setupWebGL (/Users/Downloads/FFCreator-master/node_modules/spritejs/dist/spritejs.js:10884:11)
at new Renderer (/Users/Downloads/FFCreator-master/node_modules/spritejs/dist/spritejs.js:9012:71)
at new Renderer (/Users/Downloads/FFCreator-master/node_modules/spritejs/dist/spritejs.js:8070:22)
at new Layer (/Users/Downloads/FFCreator-master/node_modules/spritejs/dist/spritejs.js:37719:24)
at /Users/Downloads/FFCreator-master/lib/node/cons.js:31:21
at Object.get (/Users/Downloads/FFCreator-master/lib/core/pool.js:19:63)
at FFCreator.createDisplay (/Users/Downloads/FFCreator-master/lib/node/cons.js:30:25)
at new FFCon (/Users/Downloads/FFCreator-master/lib/node/cons.js:22:10)
at new FFCreator (/Users/Downloads/FFCreator-master/lib/creator.js:35:5)

Chrome version 86.0.4240.193
this support WEBGL when I open some test webgl available webpage
mac os 10.13.4

Request update docs/guide/installation: 无显示设备启动方法

无显示设备的服务器请使用xvfb-run命令启动程序, 关于xvfb-run命令更多的参数可以点击这里查看。
xvfb-run -s "-ac -screen 0 1280x1024x24" npm start

实测在多进程方式启动时,如基于egg框架启动,上面的命令并不能给worker进程添加虚拟显示设备。
下面的命令可用于处理该情况:

export DISPLAY=:1 #增加虚拟显示设备环境变量
Xvfb :1 -ac & # 启动Xvfb服务
npm run start

one line:
(export DISPLAY=:1) && (Xvfb :1 -ac &) && npm run start

需要注意,webgl运行时也依赖DISPLAY环境变量,注意export的作用域问题

ERROR: ffmpeg exited with code 1: Unrecognized option 'preset'.

FFCreator error: {"type":"normal","output":"","error":"ffmpeg exited with code 1: Unrecognized option 'preset'.\nError splitting the argument list: Option not found\n","state":"","command":null,"percent":0,"pos":"Synthesis"}
[FF] Creator production error. [object Object]
[FF] Synthesis stdout:
stderr:Unrecognized option 'preset'.
Error splitting the argument list: Option not found
ffmpeg exited with code 1: Unrecognized option 'preset'.
Error splitting the argument list: Option not found

Error initializing complex filters

你好,我使用ffcreatorlite版本在本地合成视频是没有问题的,但是放到liunx上会报错:
ffmpeg exited with code 1: Error initializing complex filters
liunx上ffmpeg 版本为4.3.1 ffcreatorlite 版本为 1.4.7
请问,这是什么问题导致的?

内存泄露

定时执行视频生成,主进程内存不断升高

stderr:undefinedCannot find ffmpeg

FFCreator error: Cannot find ffmpeg
[FF] Creator production error. [object Object]
[FF] Synthesis stdout:undefined
stderr:undefinedCannot find ffmpeg

为什么无法进行npm start?显示缺少脚本?

image
使用cmd进行npm start总是报错,后来用powershell在安装目录下打开,运行npm run examples可以成功合成案例视频,但是无法显示进行自己成功开始新的视频编辑。。。
想知道如何解决该问题?
希望官方能出一个详细的安装到成功使用的教程,我已经很认真的根据你们出的使用文档安装依赖和配置环境了,还是不成功,最后花钱去淘宝找了外援程序员,他也是只能给进行跑到案例合成这一步。我们目前的业务非常需要使用FFCreator来进行测试效果,但这对新手来说确实有点难度。希望教程能再详细一点,感谢!

How to set text's delay time?

If the text is too long, I want to display first one text in 2 seconds then the second text in 2 seconds later, they both display in one scene. How to make it ?

const creatText=(text,duration)=>{
  const ftext = new FFText({text, x: width / 2, y: height - 50, fontSize: 25});
  ftext.setColor('#fff');
  ftext.setFont(FONT_PATH)
  // ftext.setFont("Microsoft YaHei")
  // ftext.alignCenter();
  ftext.setAnchor(0.5);
  ftext.setStyle({textAlign: 'bottom'});
  //ftext.setBackgroundColor('#ffffff');
//  ftext.addEffect('fadeInRight', 1, 1.3);
  ftext.setStyle({padding: [4, 12, 6, 12]});
  ftext.setDuration(duration);//ANIMATE_TIME/2);
  //ftext.addEffect()
  return ftext;
}

  // title text
  if ((text.length)>9){
    let texts=text.split("。")
    let size=(texts).length
    for (let t in texts){
      let ftext=creatText(t,ANIMATE_TIME/size)
      scene.addChild(ftext);
    }
  }else{
    let ftext=creatText(text,ANIMATE_TIME)
    scene.addChild(ftext);
  }

`npm run examples` throws error after selecting one of the options

I cloned the repo, did npm i and then ran npm run examples command.

After selecting one of the examples, I'm getting [FF] Creator production error. Sorry, your browser doesn't support WebGL. error. I'm using MacOS btw.

Am I doing something wrong? Anyway to fix it? Thanks!

11:23 $ npm run examples

> [email protected] examples /Users/jjtigeryx/FFCreator
> node ./examples/

? Please select the demo you want to run: album

 --- You can press the s key or the w key to restart! ---

[FF] Creator production error. Sorry, your browser doesn't support WebGL.

the 11th and 12th tts wav, are combined to the 1st scene's tts. I guess the 13th tts is also combined to the 1st scene tts too.

const transitionDemoTask = async () => {

}
{
  const subtitle = new FFSubtitle({
    comma: false, // 是否逗号分割
    backgroundColor: '#444359',
    color: '#fff',
    fontSize: 24,
    x: width / 2,
    y: height - 50
  });
  subtitle.setFont("Simsun")//FONT_PATH")
  subtitle.setText(text);
  subtitle.setSpeech(ttsFile); // 语音配音-tts
  subtitle.frameBuffer = 24;
  subtitle.setDuration(SCENE_DURATION)
  scene.addAudio(ttsFile)
  scene.addChild(subtitle);
  return scene;
};
FFCreatorCenter.addTask(transitionDemoTask)

the 11th and 12th tts wav, are combined to the 1st scene's tts. I guess the 13th tts is also combined to the 1st scene tts too.
I don't know why. I checked my code, no problems found.
Is it a bug in FFCreator?
image

如何设置字体为粗体

使用中发现,文档好像不够全,
1.能否设置字体加粗?
2.能否给字体加描边?
3.能否添加渐变色块?

以上是建议用canvas画好图后添加在视频中,还是直接在FFcreator中实现呢?

动画效果切换时有卡顿

//场景五
const fbg5 = new FFImage({path: bg, x: width / 2, y: height / 2});
scene5.addChild(fbg5);
const wubigti = new FFText({text: '污水处理设备'});
wubigti.setXY(86, 185);
wubigti.setColor('#f90909'); // 背景色
wubigti.addEffect('fadeInDown', 1, 0.8);
wubigti.setStyle({fontSize:112,fontWeight:700,fontFamily:'SimHei'}); // 设置样式object
scene5.addChild(wubigti);
const kwu1 = new FFImage({path: kuang});
kwu1.setXY(864, 1204);
kwu1.setAnchor(1);
kwu1.setWH(640, 480);
kwu1.addEffect('backInRight', 1, 0.8);
scene5.addChild(kwu1);
const tuwu1 = new FFImage({path: wuimg});
tuwu1.setXY(844, 1184);
tuwu1.setAnchor(1);
tuwu1.setWH(600, 440);
tuwu1.addEffect('backInRight', 1, 0.8);
scene5.addChild(tuwu1);
const wuti1 = new FFText({text: '造纸污水处理'});
wuti1.setXY(width / 2, 1248);
wuti1.setColor('#f60c0c'); // 背景色
wuti1.addEffect('fadeInDown', 1, 0.8); // 动画
wuti1.alignCenter(); // 文字居中
wuti1.setStyle({fontSize:48,fontWeight:900,fontFamily:'SimHei'}); // 设置样式object
scene5.addChild(wuti1);
scene5.setDuration(4);
scene5.setTransition('Lens', 1.5);
creator.addChild(scene5);

//场景六

const fbg6 = new FFImage({path: bg, x: width / 2, y: height / 2});
scene6.addChild(fbg6);
const liuti = new FFText({text: '专业污水处理厂家'});
liuti.setXY(width/2, height/2);
liuti.setColor('#f90e0e'); // 背景色
liuti.addEffect('fadeInDown', 1, 0.8); // 动画
liuti.alignCenter(); // 文字居中
liuti.setStyle({fontSize:100,fontWeight:700,fontFamily:'SimHei'}); // 设置样式object
scene6.addChild(liuti);
scene6.setDuration(4);
scene6.setTransition('Radiation', 1.5);
creator.addChild(scene6);

场景五切换到场景六时 场景6会有场景5的一些图片 等会就没了 为什么呢

请问如何可以指定最终输出的视频文件的路径和文件名?

我尝试在初始化是指定output

const output = '/home/penghui/my.mp4'
const creator = new FFCreator({
    cacheDir,
    outputDir: path.dirname(output), //这里不设置或者设置成 "" 或者 false 的效果都是当前目录 ./
    output,
    width,
    height,
    debug: false
});

发现输出的目录对了,但是文件名依旧是0l65fa6m48muuu5m.mp4这样的文件名,并非output指定的文件名。目前的解决方法是监听start事件,再设置一遍output

creator.on('start', () => {
    console.log(`FFCreator start`);
    creator.output(output)
    console.log("creator.getFile():", creator.getFile());
});

请问这样设置是否合适?有没有更好的设置方式呢?

谢谢!

添加声音文件时报错

添加声音mp3文件,当编译时报错,执行代码如下:
`
....
const voicePath = setPath(pathId, "voice.mp3");
...
const vioce_s2 = new FFAudio({ src: voicePath });
scene2.addChild(vioce_s2);

....
scene2.setDuration(5);
creator.addChild(scene2);

`
返回错误信息如下:

(node:4663) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'remove' of undefined
at Layer.appendChild (/Users/mzj/mw/git/video-demo/node_modules/spritejs/dist/spritejs.js:34380:10)
at FFScene.addChild (/Users/mzj/mw/git/video-demo/node_modules/ffcreator/lib/node/cons.js:55:18)
at createFFTask (/Users/mzj/mw/git/video-demo/src/videoEnglish.js:128:10)
at processTicksAndRejections (internal/process/task_queues.js:82:5)
(node:4663) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4663) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

以上如果删除添加FFAudio代码,执行是成功的,加上则报错,看能否解决。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.