123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- var gif = require("../gifmaker");
- var st = new Date().getTime()
- console.log('正在生成Gif');
- gif.makewithfilters("../template/9564a00ec44567367a07bee43868c420a8c48e60.mp4",
- [
- {
- filter: "drawtext",
- options: {
- "text": "111",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,1.18,1.56)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "222",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,3.18,4.43)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "333",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,5.31,7.43)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "444",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,7.56,9.93)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "555",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,10.06,11.56)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "666",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,11.93,13.06)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "777",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,13.81,16.31)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "888",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,18.06,19.56)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- },
- {
- filter: "drawtext",
- options: {
- "text": "999",
- "x": "(w-text_w)/2",
- "y": "h-text_h-4",
- "enable": "between(t,19.59,21.60)",
- "fontfile": "simsun.ttc",
- "fontcolor": "white",
- "fontsize": "16"
- }
- }
- ]
- ).save("public/test.gif").on('end', function () {
- var tt = new Date().getTime() - st
- console.log(`成功生成Gif图,耗时:${tt}ms`);
- })
|